[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 3b758bf 06/48: Use `TeX-search-files-by-type' to
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 3b758bf 06/48: Use `TeX-search-files-by-type' to assist input \includegraphics |
Date: |
Sun, 16 Sep 2018 01:47:20 -0400 (EDT) |
branch: externals/auctex
commit 3b758bf2076402b973925f32c0db4f0584705b91
Author: Ikumi Keita <address@hidden>
Commit: Ikumi Keita <address@hidden>
Use `TeX-search-files-by-type' to assist input \includegraphics
* style/graphicx.el (LaTeX-includegraphics-extensions-list): New
function.
(LaTeX-includegraphics-extensions): Delegate most of its task to the
above new function and become its wrapper.
(LaTeX-includegraphics-global-files): New variable.
(LaTeX-includegraphics-read-file-TeX): Use `TeX-search-files-by-type'
rather than `TeX-search-files' and cache global value in the above
new variable.
Reflect the option `LaTeX-includegraphics-strip-extension-flag'.
* tex.el (TeX-search-files-type-alist): Remove `graphics' entry,
which is supplied in latex-mode by `LaTeX-search-files-type-alist'.
(TeX-normal-mode): Add `LaTeX-includegraphics-global-files' to list of
variables to be cleared.
---
style/graphicx.el | 126 +++++++++++++++++++++++++++++++-----------------------
tex.el | 4 +-
2 files changed, 75 insertions(+), 55 deletions(-)
diff --git a/style/graphicx.el b/style/graphicx.el
index 08dbf75..94ec51c 100644
--- a/style/graphicx.el
+++ b/style/graphicx.el
@@ -105,65 +105,85 @@ key-val's."
LaTeX-graphicx-key-val-options))
optional)))
+(defun LaTeX-includegraphics-extensions-list ()
+ "Return appropriate extensions for input files to \\includegraphics.
+Return value is a list of regexps."
+ (let ((temp (copy-sequence LaTeX-includegraphics-extensions)))
+ (cond (;; 'default TeX-engine:
+ (eq TeX-engine 'default)
+ (if ;; we want to produce a pdf
+ (if TeX-PDF-mode
+ ;; Return t if default compiler produces PDF,
+ ;; nil for "Dvips" or "Dvipdfmx"
+ (not (TeX-PDF-from-DVI))
+ ;; t if pdftex is used in dvi-mode
+ TeX-DVI-via-PDFTeX)
+ ;; We're using pdflatex in pdf-mode
+ (TeX-delete-duplicate-strings
+ (append LaTeX-includegraphics-pdftex-extensions
+ temp))
+ ;; We're generating a .dvi to process with dvips or dvipdfmx
+ (progn
+ (dolist (x '("jpe?g" "pdf" "png"))
+ (setq temp (delete x temp)))
+ (TeX-delete-duplicate-strings
+ (append LaTeX-includegraphics-dvips-extensions
+ temp)))))
+ ;; Running luatex in pdf or dvi-mode:
+ ((eq TeX-engine 'luatex)
+ (if TeX-PDF-mode
+ (TeX-delete-duplicate-strings
+ (append LaTeX-includegraphics-pdftex-extensions
+ temp))
+ (progn
+ (dolist (x '("jpe?g" "pdf" "png"))
+ (setq temp (delete x temp)))
+ (TeX-delete-duplicate-strings
+ (append LaTeX-includegraphics-dvips-extensions
+ temp)))))
+ ;; Running xetex in any mode:
+ ((eq TeX-engine 'xetex)
+ (TeX-delete-duplicate-strings
+ (append LaTeX-includegraphics-xetex-extensions
+ temp)))
+ ;; For anything else
+ (t
+ temp))))
+
(defun LaTeX-includegraphics-extensions (&optional list)
- "Return appropriate extensions for input files to \\includegraphics."
- (let* ((temp (copy-sequence LaTeX-includegraphics-extensions))
- (LaTeX-includegraphics-extensions
- (cond (;; 'default TeX-engine:
- (eq TeX-engine 'default)
- (if ;; we want to produce a pdf
- (if TeX-PDF-mode
- ;; Return t if default compiler produces PDF,
- ;; nil for "Dvips" or "Dvipdfmx"
- (not (TeX-PDF-from-DVI))
- ;; t if pdftex is used in dvi-mode
- TeX-DVI-via-PDFTeX)
- ;; We're using pdflatex in pdf-mode
- (TeX-delete-duplicate-strings
- (append LaTeX-includegraphics-pdftex-extensions
- temp))
- ;; We're generating a .dvi to process with dvips or dvipdfmx
- (progn
- (dolist (x '("jpe?g" "pdf" "png"))
- (setq temp (delete x temp)))
- (TeX-delete-duplicate-strings
- (append LaTeX-includegraphics-dvips-extensions
- temp)))))
- ;; Running luatex in pdf or dvi-mode:
- ((eq TeX-engine 'luatex)
- (if TeX-PDF-mode
- (TeX-delete-duplicate-strings
- (append LaTeX-includegraphics-pdftex-extensions
- temp))
- (progn
- (dolist (x '("jpe?g" "pdf" "png"))
- (setq temp (delete x temp)))
- (TeX-delete-duplicate-strings
- (append LaTeX-includegraphics-dvips-extensions
- temp)))))
- ;; Running xetex in any mode:
- ((eq TeX-engine 'xetex)
- (TeX-delete-duplicate-strings (append
LaTeX-includegraphics-xetex-extensions
- temp)))
- ;; For anything else
- (t
- temp))))
- (concat "\\."
- (mapconcat 'identity
- (or list LaTeX-includegraphics-extensions)
- "$\\|\\.")
- "$")))
+ "Return appropriate extensions for input files to \\includegraphics.
+Return value is a single regexp.
+Optional argument LIST if non-nil is used as list of regexps of
+extensions to be matched."
+ (unless list
+ (setq list (LaTeX-includegraphics-extensions-list)))
+ (concat "\\." (mapconcat #'identity list "$\\|\\.") "$"))
+
+(defvar LaTeX-includegraphics-global-files nil
+ "List of the non-local graphic files to include in LaTeX documents.
+Initialized once at the first time you prompt for an input file.
+May be reset with `\\[universal-argument] \\[TeX-normal-mode]'.")
(defun LaTeX-includegraphics-read-file-TeX ()
"Read image file for \\includegraphics.
Offers all graphic files found in the TeX search path. See
`LaTeX-includegraphics-read-file' for more."
- (completing-read
- "Image file: "
- (TeX-delete-dups-by-car
- (mapcar 'list
- (TeX-search-files nil LaTeX-includegraphics-extensions t t)))
- nil nil nil))
+ (let ((LaTeX-includegraphics-extensions
+ (LaTeX-includegraphics-extensions-list)))
+ (unless LaTeX-includegraphics-global-files
+ (message "Searching for graphic files...")
+ (setq LaTeX-includegraphics-global-files
+ (TeX-search-files-by-type
+ 'graphics 'global t
+ LaTeX-includegraphics-strip-extension-flag))
+ (message "Searching for graphic files...done"))
+ (completing-read
+ "Image file: "
+ (append
+ (TeX-search-files-by-type 'graphics 'local t
+ LaTeX-includegraphics-strip-extension-flag)
+ LaTeX-includegraphics-global-files)
+ nil nil nil)))
(defun LaTeX-includegraphics-read-file-relative ()
"Read image file for \\includegraphics.
diff --git a/tex.el b/tex.el
index 8e1f7ee..42759c5 100644
--- a/tex.el
+++ b/tex.el
@@ -4608,7 +4608,6 @@ If optional argument EXTENSIONS is not set, use
`TeX-file-extensions'"
(defvar TeX-search-files-type-alist
'((texinputs "${TEXINPUTS}" ("tex/") TeX-file-extensions)
(docs "${TEXDOCS}" ("doc/") TeX-doc-extensions)
- (graphics "${TEXINPUTS}" ("tex/") LaTeX-includegraphics-extensions)
(bibinputs "${BIBINPUTS}" ("bibtex/bib/") BibTeX-file-extensions)
(bstinputs "${BSTINPUTS}" ("bibtex/bst/") BibTeX-style-extensions))
"Alist of filetypes with locations and file extensions.
@@ -6020,7 +6019,8 @@ With optional argument ARG, also reload the style hooks."
BibLaTeX-global-style-files nil
TeX-Biber-global-files nil
TeX-global-input-files nil
- LaTeX-global-class-files nil))
+ LaTeX-global-class-files nil
+ LaTeX-includegraphics-global-files nil))
(let ((TeX-auto-save t))
(if (buffer-modified-p)
(save-buffer)
- [elpa] externals/auctex updated (0e878e9 -> f761ab4), Tassilo Horn, 2018/09/16
- [elpa] externals/auctex f107ca1 02/48: Make compatible with emacs 24, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex cff0781 01/48: Fix incorrect FSF address, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex e783b97 04/48: Fix TeX-dwim-master, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 6112351 12/48: ; * style/geometry.el (LaTeX-geometry-preamble-key-val-options): Add luatex key., Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 3b758bf 06/48: Use `TeX-search-files-by-type' to assist input \includegraphics,
Tassilo Horn <=
- [elpa] externals/auctex a16a510 22/48: Replace another cl function with cl-lib, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 1a7b2bf 18/48: Adjust coding system for Japanese pTeX engine on w32, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 52d6a54 03/48: Make `TeX-clean' to work in ams-tex-mode, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 15d3d97 08/48: Quote %b expansion string for SumatraPDF, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 68095a3 15/48: Fix previous removal of xemacs compatibility code, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 59fa964 05/48: Resolve conflict of argument spec between regexp and literal, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 94378c1 09/48: Correct record in changes.texi, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 00f0e0e 13/48: ; * tex.el (TeX-expand-list): Fix docstring (bug#31217)., Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 59a9e5b 10/48: Correct how `TeX-record-buffer' is used, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex c64a0e1 27/48: Quote %b expansion string for Zathura, Tassilo Horn, 2018/09/16