branch: externals/auctex commit f52479b816c0e6097293221b8488144cbdea9123 Author: Mosè Giordano <m...@gnu.org> Commit: Mosè Giordano <m...@gnu.org>
Improve checking of a TeX distribution and make it optional * tex-buf.el (TeX-check-TeX, TeX-check-TeX-command-not-found): New customizable options. (TeX-command): Do a better check for the presence of a TeX distribution. Run `call-process' instead of `executable-find', like `TeX-run-command' actually does. The point is that `call-process' and `start-process' use `PATH' environment variable, `executable-find' uses `exec-path' variable and they do not need to match, but we should check what `TeX-run-command' will really do. * doc/auctex.texi (Processor Options): Document `TeX-check-TeX'. * doc/changes.texi: Mention `TeX-check-TeX'. --- ChangeLog | 16 ++++++++++++++++ doc/auctex.texi | 17 +++++++++++++++++ doc/changes.texi | 10 +++++++--- tex-buf.el | 17 +++++++++++++++-- 4 files changed, 55 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d8a74b..387c136 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2015-11-06 Mos� Giordano <m...@gnu.org> + + * tex-buf.el (TeX-check-TeX, TeX-check-TeX-command-not-found): New + customizable options. + (TeX-command): Do a better check for the presence of a TeX + distribution. Run `call-process' instead of `executable-find', + like `TeX-run-command' actually does. The point is that + `call-process' and `start-process' use `PATH' environment + variable, `executable-find' uses `exec-path' variable and they do + not need to match, but we should check what `TeX-run-command' will + really do. + + * doc/auctex.texi (Processor Options): Document `TeX-check-TeX'. + + * doc/changes.texi: Mention `TeX-check-TeX'. + 2015-11-03 Mos� Giordano <m...@gnu.org> * doc/auctex.texi (Processor Options): Document diff --git a/doc/auctex.texi b/doc/auctex.texi index 6489c44..4b0f001 100644 --- a/doc/auctex.texi +++ b/doc/auctex.texi @@ -2989,6 +2989,23 @@ command can either be a variable or a string. An empty string or nil means there is no command available. @end defopt +In some systems, Emacs cannot inherit the PATH environment variable from +the shell and thus @AUCTeX{} may not be able to run @TeX{} commands. +Before running them, @AUCTeX{} checks if it able to find those commands +and will warn you in case it fails. You can skip this test by changing +the option @code{TeX-check-TeX}. + +@defopt TeX-check-TeX +@vindex TeX-command +@vindex TeX-check-TeX-command-not-found +If non-nil, @AUCTeX{} will check if it is able to find a working @TeX{} +distribution before running @TeX{}, @LaTeX{}, @ConTeXt{}, etc. It +actually checks if can run @code{TeX-command} command or the shell +returns a command not found error. The error code returned by the shell +in this case can be set in @code{TeX-check-TeX-command-not-found} +option. +@end defopt + Some @LaTeX{} packages requires the document to be compiled with a specific engine. Notable examples are fontspec and polyglossia packages, which require Lua@TeX{} and Xe@TeX{} engines. If you try to diff --git a/doc/changes.texi b/doc/changes.texi index ed3ad01..fb927f6 100644 --- a/doc/changes.texi +++ b/doc/changes.texi @@ -56,9 +56,13 @@ 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. +Before running commands like @TeX{} and @LaTeX{}, now @AUCTeX{} performs +some checks. If @code{TeX-check-TeX} is non-nil, it will test whether a +working @TeX{} distribution is actually present in the system and +available to Emacs. Instead, when @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. @item Basic support to @ConTeXt{} Mark IV has been added. Users can now diff --git a/tex-buf.el b/tex-buf.el index ec3653c..61a61ad 100644 --- a/tex-buf.el +++ b/tex-buf.el @@ -437,6 +437,16 @@ Do you want to select one of these engines?" (add-file-local-variable 'TeX-engine engine) (save-buffer)))))) +(defcustom TeX-check-TeX t + "Whether AUCTeX should check if a working TeX distribution is present." + :group 'TeX-command + :type 'boolean) + +(defcustom TeX-check-TeX-command-not-found 127 + "Numerical code returned by shell for a command not found error." + :group 'TeX-command + :type 'integer) + (defun TeX-command (name file &optional override-confirm) "Run command NAME on the file returned by calling FILE. @@ -481,8 +491,11 @@ been set." ;; Before running some commands, check that AUCTeX is able to find "tex" ;; program. - (and (member name '("TeX" "LaTeX" "AmSTeX" "ConTeXt" "ConTeXt Full")) - (not (executable-find TeX-command)) + (and TeX-check-TeX + (member name '("TeX" "LaTeX" "AmSTeX" "ConTeXt" "ConTeXt Full")) + (= TeX-check-TeX-command-not-found + (call-process TeX-shell nil nil nil + TeX-shell-command-option TeX-command)) (error (format "ERROR: AUCTeX cannot find a working TeX distribution. Make sure you have one and that TeX binaries are in PATH environment variable%s" (if (eq system-type 'darwin)