branch: externals/auctex commit 6f77ad9ee30aebc8ed079a9a0190431b50364bfa Author: Mosè Giordano <m...@gnu.org> Commit: Mosè Giordano <m...@gnu.org>
Split TeX-expand-list into a builtin and a custom list. * tex.el (TeX-expand-list-builtin): New variable. (TeX-expand-list): Move all entries to `TeX-expand-list-builtin' and update docstring. (TeX-expand-list): New function. * tex-buf.el (TeX-command-expand): Use `TeX-expand-list' function. * doc/auctex.texi (Starting Viewers): Mention `TeX-expand-list-builtin'. * doc/changes.texi: Mention change to `TeX-expand-list'. --- ChangeLog | 14 +++++++++++++ doc/auctex.texi | 19 +++++++++-------- doc/changes.texi | 7 ++++++ tex-buf.el | 2 +- tex.el | 55 ++++++++++++++++++++++++++++++++++++++++------------- 5 files changed, 73 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec8171c..921c5cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2015-10-08 Mos� Giordano <m...@gnu.org> + + * tex.el (TeX-expand-list-builtin): New variable. + (TeX-expand-list): Move all entries to `TeX-expand-list-builtin' + and update docstring. + (TeX-expand-list): New function. + + * tex-buf.el (TeX-command-expand): Use `TeX-expand-list' function. + + * doc/auctex.texi (Starting Viewers): Mention + `TeX-expand-list-builtin'. + + * doc/changes.texi: Mention change to `TeX-expand-list'. + 2015-10-08 Arash Esbati <esb...@gmx.de> * style/longtable.el ("longtable"): Use `LaTeX-add-counters' on diff --git a/doc/auctex.texi b/doc/auctex.texi index e32cd2d..a7ac3ae 100644 --- a/doc/auctex.texi +++ b/doc/auctex.texi @@ -3124,14 +3124,15 @@ conditionalized by prefixing them with predicates from @code{TeX-view-predicate-list} or @code{TeX-view-predicate-list-builtin}. (See the doc string for the exact format to use.) The command line can also contain placeholders as -defined in @code{TeX-expand-list} which are expanded before the viewer -is called. +defined in @code{TeX-expand-list} and @code{TeX-expand-list-builtin} +which are expanded before the viewer is called. The third element of each item is a string, or a list of strings, with the name of the executable, or executables, needed to open the output -file in the viewer. Placeholders defined in @code{TeX-expand-list} can -be used here. This element is optional and is used to check whether the -viewer is actually available on the system. +file in the viewer. Placeholders defined in @code{TeX-expand-list} and +@code{TeX-expand-list-builtin} can be used here. This element is +optional and is used to check whether the viewer is actually available +on the system. A built-in viewer spec from @code{TeX-view-program-list-builtin} can be overwritten by defining a new viewer spec with the same name. @@ -3139,10 +3140,10 @@ overwritten by defining a new viewer spec with the same name. Note that the viewer selection and invocation as described above will only work if certain default settings in @AUCTeX{} are intact. For one, -the whole viewer selection machinery will only be triggered if the -@samp{%V} expander in @code{TeX-expand-list} is unchanged. So if you -have trouble with the viewer invocation you might check if there is an -older customization of the variable in place. In addition, the use of a +the whole viewer selection machinery will only be triggered if there is +no @samp{%V} expander in @code{TeX-expand-list}. So if you have trouble +with the viewer invocation you might check if there is an older +customization of the variable in place. In addition, the use of a function in @code{TeX-view-program-list} only works if the View command in @code{TeX-command-list} makes use of the hook @code{TeX-run-discard-or-function}. diff --git a/doc/changes.texi b/doc/changes.texi index 14fc510..0ed617e 100644 --- a/doc/changes.texi +++ b/doc/changes.texi @@ -49,6 +49,13 @@ Now @AUCTeX{} suggests to run @command{makeindex} when appropriate. each item, the name of the executable(s) needed to open the viewer. @item +@code{TeX-expand-list} variable has been split into +@code{TeX-expand-list} and @code{TeX-expand-list-builtin}. Only the +former is intended to be customized by the user, the latter contains +built-in expanders. You might want to keep in @code{TeX-expand-list} +only new expansion strings. + +@item When new option @code{TeX-check-engine} is non-nil, before running @LaTeX{} commands @AUCTeX{} will check whether the correct engine has been set, based upon known restrictions posed by @LaTeX{} packages. diff --git a/tex-buf.el b/tex-buf.el index d42b547..324be7a 100644 --- a/tex-buf.el +++ b/tex-buf.el @@ -502,7 +502,7 @@ without further expansion." (list "%%" (lambda nil (setq pos (1+ pos)) "%")) - (or list TeX-expand-list)) + (or list (TeX-expand-list))) pat (regexp-opt (mapcar #'car list))) (while (setq pos (string-match pat command pos)) (setq string (match-string 0 command) diff --git a/tex.el b/tex.el index d057cef..56fb51b 100644 --- a/tex.el +++ b/tex.el @@ -114,11 +114,11 @@ If nil, none is specified." :type 'hook :group 'TeX-misc) -;; This is the major configuration variable. Most sites will only -;; need to change the second string in each entry, which is the name -;; of a command to send to the shell. If you use other formatters -;; like AMSLaTeX or AMSTeX, you can add those to the list. See -;; TeX-expand-list for a description of the % escapes +;; This is the major configuration variable. Most sites will only need to +;; change the second string in each entry, which is the name of a command to +;; send to the shell. If you use other formatters like AMSLaTeX or AMSTeX, you +;; can add those to the list. See `TeX-expand-list' and +;; `TeX-expand-list-builtin' for a description of the % escapes (defcustom TeX-command-list `(("TeX" "%(PDF)%(tex) %(file-line-error) %(extraopts) %`%S%(PDFout)%(mode)%' %t" @@ -431,9 +431,8 @@ string." ;; TeX-command-list. Not likely to be changed, but you may e.g. want ;; to handle .ps files. -(defcustom TeX-expand-list - '(("%p" TeX-printer-query) ;%p must be the first entry - ("%q" (lambda () +(defvar TeX-expand-list-builtin + '(("%q" (lambda () (TeX-printer-query t))) ("%V" (lambda () (TeX-source-correlate-start-server-maybe) @@ -550,13 +549,31 @@ string." ("%a" (lambda nil (prin1-to-string (expand-file-name (buffer-file-name))))) ;; the following is for preview-latex. ("%m" preview-create-subdirectory)) - "List of expansion strings for TeX command names. + "List of built-in expansion strings for TeX command names. -Each entry is a list with two or more elements. The first element is -the string to be expanded. The second element is the name of a -function returning the expanded string when called with the remaining -elements as arguments. The special value `file' will be expanded to -the name of the file being processed, with an optional extension." +This should not be changed by the user who can use +`TeX-expand-list' variable. The latter variable also contains a +description of the data format. + +Programs should not use these variables directly but the function +`TeX-expand-list'.") + +(defcustom TeX-expand-list nil + "List of expansion strings for TeX command names defined by the user. + +Each entry is a list with two or more elements. The first +element is the string to be expanded. The second element is the +name of a function returning the expanded string when called with +the remaining elements as arguments. The special value `file' +will be expanded to the name of the file being processed, with an +optional extension. + +Built-in expansions provided in `TeX-expand-list-builtin' can be +overwritten by defining expansions strings with the same +expander. Only \"%p\" expander cannot be overwritten. + +Programs should not use these variables directly but the function +`TeX-expand-list'." :group 'TeX-command :type '(repeat (group (string :tag "Key") (sexp :tag "Expander") @@ -564,6 +581,16 @@ the name of the file being processed, with an optional extension." :tag "Arguments" (sexp :format "%v"))))) +(defun TeX-expand-list () + "Complete list of expansion strings for TeX command names. + +Concatenate `TeX-expand-list' and `TeX-expand-list-bultin' making +sure \"%p\" is the first entry." + (append + ;; %p must be the first entry, see `TeX-print-command'. + '(("%p" TeX-printer-query)) + TeX-expand-list + TeX-expand-list-builtin)) ;; The following dependencies are not done with autoload cookies since ;; they are only useful when tex.el is loaded, anyway. tex-buf.el