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

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

[elpa] externals/auctex c0f3659 21/95: Fix TeX-view-predicate-list-built


From: Tassilo Horn
Subject: [elpa] externals/auctex c0f3659 21/95: Fix TeX-view-predicate-list-builtin predicates wrt class opts
Date: Sun, 16 Apr 2017 01:26:48 -0400 (EDT)

branch: externals/auctex
commit c0f3659059a138aaf5fa610f2913035d63225bfb
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    Fix TeX-view-predicate-list-builtin predicates wrt class opts
    
    * latex.el (LaTeX-match-class-option): New function.
    * tex.el (TeX-view-predicate-list-builtin): Use above function to check
    paper sizes orientation from documentclass options (bug#25563).
---
 latex.el |  6 ++++++
 tex.el   | 28 ++++++++++++++++++++--------
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/latex.el b/latex.el
index e8c3b04..bd64f7f 100644
--- a/latex.el
+++ b/latex.el
@@ -1703,6 +1703,12 @@ See also `LaTeX-provided-package-options'.")
 The value is actually the tail of the list of options given to CLASS."
   (member option (cdr (assoc class LaTeX-provided-class-options))))
 
+(defun LaTeX-match-class-option (regexp)
+  "Check if a documentclass option matching REGEXP is active."
+  (TeX-member regexp (apply #'append
+                           (mapcar #'cdr LaTeX-provided-class-options))
+             'string-match))
+
 (defvar LaTeX-provided-package-options nil
   "Alist of options provided to LaTeX packages.
 For each element, the CAR is the name of the package, the CDR is
diff --git a/tex.el b/tex.el
index 73d4927..590568c 100644
--- a/tex.el
+++ b/tex.el
@@ -1167,21 +1167,33 @@ all the regular expressions must match for the element 
to apply."
     (mode-io-correlate
      TeX-source-correlate-mode)
     (paper-landscape
-     (TeX-match-style "\\`landscape\\'"))
+     (and (fboundp 'LaTeX-provided-class-options)
+         (LaTeX-match-class-option "\\`landscape\\'")))
     (paper-portrait
-     (not (TeX-match-style "\\`landscape\\'")))
+     (not (and (fboundp 'LaTeX-provided-class-options)
+              (LaTeX-match-class-option "\\`landscape\\'"))))
     (paper-a4
-     (TeX-match-style "\\`a4paper\\|a4dutch\\|a4wide\\|sem-a4\\'"))
+     (let ((regex "\\`a4paper\\|a4dutch\\|a4wide\\|sem-a4\\'"))
+       (or (TeX-match-style regex)
+          (and (fboundp 'LaTeX-match-class-option)
+               (LaTeX-match-class-option regex)))))
     (paper-a5
-     (TeX-match-style "\\`a5paper\\|a5comb\\'"))
+     (let ((regex "\\`a5paper\\|a5comb\\'"))
+       (or (TeX-match-style regex)
+          (and (fboundp 'LaTeX-match-class-option)
+               (LaTeX-match-class-option regex)))))
     (paper-b5
-     (TeX-match-style "\\`b5paper\\'"))
+     (and (fboundp 'LaTeX-match-class-option)
+         (LaTeX-match-class-option "\\`b5paper\\'")))
     (paper-letter
-     (TeX-match-style "\\`letterpaper\\'"))
+     (and (fboundp 'LaTeX-match-class-option)
+         (LaTeX-match-class-option "\\`letterpaper\\'")))
     (paper-legal
-     (TeX-match-style "\\`legalpaper\\'"))
+     (and (fboundp 'LaTeX-match-class-option)
+         (LaTeX-match-class-option "\\`legalpaper\\'")))
     (paper-executive
-     (TeX-match-style "\\`executivepaper\\'")))
+     (and (fboundp 'LaTeX-match-class-option)
+         (LaTeX-match-class-option "\\`executivepaper\\'"))))
   "Alist of built-in predicates for viewer selection and invocation.
 See the doc string of `TeX-view-predicate-list' for a short
 description of each predicate.")



reply via email to

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