emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 222/299: New variable to pass options to the TeX processor.


From: Stefan Monnier
Subject: [elpa] 222/299: New variable to pass options to the TeX processor.
Date: Sun, 02 Nov 2014 03:11:34 +0000

monnier pushed a commit to branch externals/auctex
in repository elpa.

commit 2ebedb8cdc94cca0b941a6173c9825d2a1bfe465
Author: Mosè Giordano <address@hidden>
Date:   Thu Feb 20 22:25:46 2014 +0100

    New variable to pass options to the TeX processor.
    
    * tex.el (TeX-command-extra-options): New customizable variable.
    (TeX-expand-list): New `%(extraopts)' expander.
    (TeX-command-list): Use `%(extraopts)'.
    
    * doc/auctex.texi (Processor Options): Document
    `TeX-command-extra-options'.
    
    * doc/changes.texi: Document it.
---
 ChangeLog        |   11 +++++++++++
 doc/auctex.texi  |   17 +++++++++++++++++
 doc/changes.texi |    7 +++++++
 tex.el           |   20 +++++++++++++-------
 4 files changed, 48 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f5daeb8..d3e3c55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-02-20  Mos� Giordano  <address@hidden>
+
+       * tex.el (TeX-command-extra-options): New customizable variable.
+       (TeX-expand-list): New `%(extraopts)' expander.
+       (TeX-command-list): Use `%(extraopts)'.
+
+       * doc/auctex.texi (Processor Options): Document
+       `TeX-command-extra-options'.
+
+       * doc/changes.texi: Document it.
+
 2014-02-10  Tassilo Horn  <address@hidden>
 
        * style/english.el: New style for english documents so that
diff --git a/doc/auctex.texi b/doc/auctex.texi
index ce87075..a6f193f 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -2843,6 +2843,23 @@ command can either be a variable or a string.  An empty 
string or nil
 means there is no command available.
 @end defopt
 
+As shown above, @AUCTeX{} handles in a special way most of the main
+options that can be given to the @TeX{} processors.  When you need to
+pass to the @TeX{} processor arbitrary options not handled by @AUCTeX,
+you can use the file local variable @code{TeX-command-extra-options}.
address@hidden TeX-command-extra-options
+String with the extra options to be given to the TeX processor.  For
+example, if you need to enable the shell escape feature to compile a
+document, add the following line to the list of local variables of the
+source file:
address@hidden
+%%% TeX-command-extra-options: "-shell-escape"
address@hidden example
+By default this option is not safe as a file-local variable because a
+specially crafted document compiled with shell escape enabled can be
+used for malicious purposes.
address@hidden defopt
+
 You can customize @AUCTeX{} to show the processor output as it is
 produced.
 
diff --git a/doc/changes.texi b/doc/changes.texi
index bd7d782..6a4b55c 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -87,6 +87,13 @@ tex file.
 @item
 Commands for narrowing to a group (@code{TeX-narrow-to-group}) and to
 @LaTeX{} environments (@code{LaTeX-narrow-to-environment}) were added.
+
address@hidden
+Now arbitrary options can be passed to the @TeX{} processor on a
+per file basis using the @code{TeX-command-extra-options} option.
address@hidden rawfile
address@hidden Options}, for details.
address@hidden ifclear
 @end itemize
 
 @heading News since 11.87
diff --git a/tex.el b/tex.el
index 0d6280e..c6cbbf9 100644
--- a/tex.el
+++ b/tex.el
@@ -112,24 +112,24 @@ If nil, none is specified."
 ;; TeX-expand-list for a description of the % escapes
 
 (defcustom TeX-command-list
-  `(("TeX" "%(PDF)%(tex) %`%S%(PDFout)%(mode)%' %t"
+  `(("TeX" "%(PDF)%(tex) %(extraopts) %`%S%(PDFout)%(mode)%' %t"
      TeX-run-TeX nil
      (plain-tex-mode ams-tex-mode texinfo-mode) :help "Run plain TeX")
     ("LaTeX" "%`%l%(mode)%' %t"
      TeX-run-TeX nil
      (latex-mode doctex-mode) :help "Run LaTeX")
        ;; Not part of standard TeX.
-    ("Makeinfo" "makeinfo %t" TeX-run-compile nil
+    ("Makeinfo" "makeinfo %(extraopts) %t" TeX-run-compile nil
      (texinfo-mode) :help "Run Makeinfo with Info output")
-    ("Makeinfo HTML" "makeinfo --html %t" TeX-run-compile nil
+    ("Makeinfo HTML" "makeinfo %(extraopts) --html %t" TeX-run-compile nil
      (texinfo-mode) :help "Run Makeinfo with HTML output")
-    ("AmSTeX" "%(PDF)amstex %`%S%(PDFout)%(mode)%' %t"
+    ("AmSTeX" "%(PDF)amstex %(extraopts) %`%S%(PDFout)%(mode)%' %t"
      TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX")
     ;; support for ConTeXt  --pg
     ;; first version of ConTeXt to support nonstopmode: 2003.2.10
-    ("ConTeXt" "texexec --once --texutil %(execopts)%t"
+    ("ConTeXt" "texexec --once --texutil %(extraopts) %(execopts)%t"
      TeX-run-TeX nil (context-mode) :help "Run ConTeXt once")
-    ("ConTeXt Full" "texexec %(execopts)%t"
+    ("ConTeXt Full" "texexec %(extraopts) %(execopts)%t"
      TeX-run-TeX nil
      (context-mode) :help "Run ConTeXt until completion")
     ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run BibTeX")
@@ -301,7 +301,7 @@ The executable `latex' is LaTeX version 2e."
 
 (defcustom LaTeX-command-style
   ;; They have all been combined in LaTeX 2e.
-  '(("" "%(PDF)%(latex) %S%(PDFout)"))
+  '(("" "%(PDF)%(latex) %(extraopts) %S%(PDFout)"))
 "List of style options and LaTeX commands.
 
 If the first element (a regular expression) matches the name of one of
@@ -408,6 +408,11 @@ string."
   :group 'TeX-command
   :type '(repeat (group regexp (string :tag "Command"))))
 
+(defcustom TeX-command-extra-options ""
+  "String with the extra options to be given to the TeX processor."
+  :type 'string)
+(make-variable-buffer-local 'TeX-command-extra-options)
+
 ;; This is the list of expansion for the commands in
 ;; TeX-command-list.  Not likely to be changed, but you may e.g. want
 ;; to handle .ps files.
@@ -455,6 +460,7 @@ string."
     ("%(tex)" (lambda () (eval (nth 2 (assq TeX-engine (TeX-engine-alist))))))
     ("%(latex)" (lambda () (eval (nth 3 (assq TeX-engine 
(TeX-engine-alist))))))
     ("%(execopts)" ConTeXt-expand-options)
+    ("%(extraopts)" (lambda () TeX-command-extra-options))
     ("%S" TeX-source-correlate-expand-options)
     ("%dS" TeX-source-specials-view-expand-options)
     ("%cS" TeX-source-specials-view-expand-client)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]