[AUCTeX-devel] bugs in LaTeX-includegraphics-extensions; incompatibility with old emacsens

2017-09-11 Thread Ikumi Keita
Hello all,

I found `LaTeX-includegraphics-extensions' in style/graphicx.el doesn't
work well in two aspects.

(1) It doesn't return expected extensions if `TeX-engine' is not
`default'.
   [How to confirm]
   a. Open the following file.
--- sample.tex --
\documentclass{article}
\usepackage{graphicx}

\begin{document}
dummy
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-parse-self: t
%%% TeX-engine: xetex
%%% End:
--
   b. Evaluate (LaTeX-includegraphics-extensions) .
  It returns "\.eps$\|\.mps$\|\.EPS$" only.  Bunch of extensions
  defined in `LaTeX-includegraphics-xetex-extensions' don't come
  out.

   The reason for this issue is that the structure of the first argument
   of `cond' is not adequate.

(2) The value of `LaTeX-includegraphics-extensions' is truncated
inadvertently as side effect.
   [How to confirm]
   a. Open the following file.
--- sample2.tex --
\documentclass{article}
\usepackage{graphicx}

\begin{document}
dummy
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-parse-self: t
%%% TeX-engine: default
%%% TeX-PDF-mode: t
%%% TeX-PDF-from-DVI: nil
%%% End:
--
   b. Evaluate (LaTeX-includegraphics-extensions) .  The return value is
  irrelavant this time.
   c. Examine the value of `LaTeX-includegraphics-extensions'.  It is
  now just ("eps"), not the default value of ("eps" "jpe?g" "pdf"
  "png").

   The reason for this issue is:
   1: `delete-dups' operates destructively on its arguments.
   2: `append' doesn't copy its last argument.

I expect that the attached patch matches the intent of the author of the
original code.

And that's not the end of the story; Actually, `delete-dups' is not
available on emacs 21.4 and xemacs 21.4. (Emacs 22.3 and xemacs 21.5.31
have it.) What should we do?  `delete-dups' is used at several places in
the current AUCTeX[1].
Drop support for old emacsens which don't have `delete-dups'?  (In that
case, we have to examine whether similar truncation of the value of list
variables takes place at other places.  I have already discovered that
`TeX-search-files-by-type' in tex.el has this problem.)
Or replace it with `TeX-delete-duplicate-strings' and
`TeX-delete-dups-by-car'? (They can only deal with list of strings and
alist of cons with string car respectively, so it might be required to
develop other compatibility function.)
Or copy the definition of `delete-dups' from the current emacs and make
a new compatibility function in AUCTeX?

Regards,
Ikumi Keita

[1] The output of `grep -E delete-dups *.el style/*.el' is:
latex.el: (TeX-delete-dups-by-car
tex.el:(defun TeX-delete-dups-by-car (alist  keep-list)
tex.el:  (TeX-delete-dups-by-car (append TeX-engine-alist 
TeX-engine-alist-builtin)))
tex.el:(delete-dups
style/caption.el:  (delete-dups (apply #'append 
(list val) val-match)))
style/caption.el: (pushnew (list key (delete-dups (apply #'append 
(list val) val-match)))
style/caption.el:   (pushnew (list key (delete-dups (apply #'append val 
val-match)))
style/enumitem.el:(pushnew (list key (delete-dups (apply 'append (list 
val) val-match)))
style/enumitem.el:  (pushnew (list key (delete-dups (apply 'append (list 
val) val-match)))
style/floatrow.el:   (pushnew (list x (delete-dups (append (list 
val) val-match)))
style/floatrow.el:   (pushnew (list x (delete-dups (append (list 
val) val-match)))
style/floatrow.el: (pushnew (list key (delete-dups (append (list 
val) val-match)))
style/graphicx.el:   (delete-dups
style/graphicx.el:   (delete-dups
style/graphicx.el:   (delete-dups
style/graphicx.el:   (delete-dups
style/graphicx.el:   (delete-dups (append 
LaTeX-includegraphics-xetex-extensions
style/graphicx.el:   (TeX-delete-dups-by-car
style/listings.el:(pushnew (list key (delete-dups
style/mdframed.el:  (pushnew (list key (delete-dups
style/menukeys.el:  (delete-dups (mapcar #'car 
(LaTeX-menukeys-newmenumacro-list

diff -r db5d7448744b -r f85ec5e68004 style/graphicx.el
--- a/style/graphicx.el	Sun Sep 03 19:56:34 2017 +0900
+++ b/style/graphicx.el	Sun Sep 03 22:04:37 2017 +0900
@@ -23,7 +23,7 @@
 
 ;;; Commentary:
 
-;;  This package supports the includegraphcics macro in graphicx style.
+;;  This package supports the includegraphics macro in graphicx style.
 
 ;; Acknowledgements
 ;;  Dr. Thomas Baumann 
@@ -109,23 +109,22 @@
   "Return appropriate extensions for input files to \\includegraphics."
   (let* ((temp (copy-sequence LaTeX-includegraphics-extensions))
 	 (LaTeX-includegraphics-extensions
-	  (cond (;; 'default TeX-engine:
-		 (if 

Re: [AUCTeX-devel] [PATCH] When using SyncTeX with Evince, do not switch focus after syncing.

2017-09-11 Thread Hong Xu
On 09/06/2017 01:09 PM, Hong Xu wrote:
> On 08/20/2017 08:33 AM, Mosè Giordano wrote:
>> Hi!
>>
>> 2017-08-20 17:21 GMT+02:00  :
>>> Dear Mosè and Hong,
>>>
>>> I also use a setup similar to Hong's: I have the pdf viewer and emacs side 
>>> by side; at times I update the pdf just to see how the text looks like, but 
>>> I still keep on working on the tex file.
>>
>> Eventually someone explained it clearly, thanks!  Emacs and the viewer
>> are side by side.  That's not my usual setup and couldn't figure out
>> this was Hong's one.  Ok, now I see the point of the proposed patch.
>>
>>> I imagine that maybe 50% of users might like Hong's proposed behaviour, and 
>>> the other 50% might not like it.
>>
>> If this is optional, it shouldn't upset anyone.
>>
> 
> Hi everyone,
> 
> I've now attached an updated version to add an option for that.
> 
> Hong
> 

Are we still interested in this patch? :)

Hong


___
auctex-devel mailing list
auctex-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex-devel