[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-devel] bugs in LaTeX-includegraphics-extensions; incompatibility
From: |
Ikumi Keita |
Subject: |
[AUCTeX-devel] bugs in LaTeX-includegraphics-extensions; incompatibility with old emacsens |
Date: |
Tue, 12 Sep 2017 02:51:27 +0900 |
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 &optional 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))))
patch-for-graphicx-el
Description: patch
- [AUCTeX-devel] bugs in LaTeX-includegraphics-extensions; incompatibility with old emacsens,
Ikumi Keita <=