branch: externals/auctex
commit 92c090dae23076ccbbbb4f017ad6fedde79a21fa
Author: Ikumi Keita <[email protected]>
Commit: Ikumi Keita <[email protected]>
Fix treatment of class and package options
* preview.el.in (preview-auctex-font-size): Consult
`LaTeX-provided-{class,package}-options' instead of
`(TeX-style-list)'. This function has been accidentally disabled
since AUCTeX began not to include the class and package options into
the styles. Similar problem with bug#25563.
* latex.el (LaTeX-match-class-option): Update doc string because the
above change depends on its implicit behavior.
---
latex.el | 3 ++-
preview.el.in | 15 ++++++++++-----
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/latex.el b/latex.el
index f5f186d..064199d 100644
--- a/latex.el
+++ b/latex.el
@@ -1701,7 +1701,8 @@ 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."
+ "Check if a documentclass option matching REGEXP is active.
+Return first found class option matching REGEXP, or nil if not found."
(TeX-member regexp (apply #'append
(mapcar #'cdr LaTeX-provided-class-options))
'string-match))
diff --git a/preview.el.in b/preview.el.in
index 3134232..30bf45b 100644
--- a/preview.el.in
+++ b/preview.el.in
@@ -1363,11 +1363,16 @@ This is for matching screen font size and previews."
If packages, classes or styles were called with an option
like 10pt, size is taken from the first such option if you
had let your document be parsed by AucTeX."
- (catch 'return (dolist (option (TeX-style-list))
- (if (string-match "\\`\\([0-9]+\\)pt\\'" option)
- (throw 'return
- (string-to-number
- (match-string 1 option)))))))
+ (let* ((regexp "\\`\\([0-9]+\\)pt\\'")
+ (option
+ (or
+ (LaTeX-match-class-option regexp)
+ ;; We don't have `LaTeX-match-package-option'.
+ (TeX-member regexp
+ (apply #'append
+ (mapcar #'cdr LaTeX-provided-package-options))
+ #'string-match))))
+ (if option (string-to-number (match-string 1 option)))))
(defsubst preview-document-pt ()
"Calculate the default font size of document."