Hi Keita, thank you, the change you propose looks good, indeed `LaTeX-includegraphics-extensions' isn't used as it's supposed to be used.
However, I'd wait before applying this (slightly) breaking patch, especially regarding XEmacs support. As suggested by Tassilo, we'll release a final version of AUCTeX in the 11.* series still supporting XEmacs, we'll then apply breaking changes in the 12.* series. Bye, Mosè 2017-10-03 12:45 GMT+02:00 Ikumi Keita <[email protected]>: > Hi all, > > [Breif summary of this message] > Is it acceptable to change a little the implicit specification of > EXTENSION argument of `TeX-search-files-kpathsea'? > > [Detail] > I'm currently considering to adjust > `LaTeX-includegraphics-read-file-TeX' in style/graphicx.el to use > `TeX-search-files-by-type'. It now uses only `TeX-search-files', so it > doesn't benefit from kpathsea library. > > At first I thought it is a simple job of replacing `TeX-search-files' > with `TeX-search-files-by-type' at a glance of > `LaTeX-search-files-type-alist' having "graphics" entry: > ---------------------------------------------------------------------- > (defcustom LaTeX-search-files-type-alist > '((texinputs "${TEXINPUTS.latex}" ("tex/generic/" "tex/latex/") > TeX-file-extensions) > (docs "${TEXDOCS}" ("doc/") TeX-doc-extensions) > (graphics "${TEXINPUTS}" ("tex/") LaTeX-includegraphics-extensions) > ... > ---------------------------------------------------------------------- > However, it turned out not so easy because of small conflicts in > treatment of EXTENSIONS argument between `TeX-search-files' and > `TeX-search-files-kpathsea'. > > (1) `TeX-search-files-kpathsea' treats EXTENSIONS as list of _literal_ > extensions according to this line: > ---------------------------------------------------------------------- > (setq extensions (concat "\\." (regexp-opt extensions t) "\\'") > ---------------------------------------------------------------------- > Thus we cannot supply regexps in EXTENSIONS. > > (2) `TeX-search-files' hands over EXTENSIONS to `TeX-match-extension' > and `TeX-strip-extension'. The latter hands over EXTENSIONS to the > former, thus it is `TeX-match-extension' that determines the treatment > of EXTENSIONS. Since it does > ---------------------------------------------------------------------- > (let ((regexp (concat "\\.\\(" > (mapconcat 'identity extensions "\\|") > "\\)$")) > ---------------------------------------------------------------------- > , EXTENSIONS is regarded as a list of _regexps_. > > `TeX-search-files-by-type' first tries `TeX-search-files-kpathsea' and > fallbacks on `TeX-search-files'. It just gives the EXTENSION argument > to both functions as-is. This doesn't cause much problem when EXTENSION > doesn't contain regexp meta chars. For example, the default value of > `TeX-file-extensions' is ("tex" "sty" "cls" "ltx" "texi" "txi" "texinfo" > "dtx"), which is totally valid as both the literal extensions and the > regular expressions. > > However, this is not the case for `LaTeX-includegraphics-extensions', > whose typical value contains "jpe?g". Therefore, if > `LaTeX-includegraphics-extensions' is given as EXTENSION argument of > `TeX-search-files-kapthsea', the function never searches for files with > "jpeg" or "jpg" as their extension but instead files with _literal_ > "jpe?g" extensions. > > My current idea is to modify `TeX-search-files-kapthsea' so that it > treats EXTENSIONS argument as a list of regexps, not of literal > extensions. The attached patch #1 implements this idea. It also > adjusts related functions and :type arguments of relavant defcustom's. > > Are these changes acceptable? Or should I make out a more sophisticated > approach which preserves the default behavior of > `TeX-search-files-kapthsea'? If OK, the attached patch #2 implements > actual change of using `TeX-search-files-by-type' in > `LaTeX-includegraphics-read-file-TeX' and #3 adds support for dvipdfmx > in graphicx.el. > > N.B. The patch #2 assumes the policy to drop support for older emacsen > so that it gives a list, not alist, as a completion table for > `completing-read'. > > Best, > Ikumi Keita > > > _______________________________________________ > auctex-devel mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/auctex-devel > _______________________________________________ auctex-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/auctex-devel
