[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] [elpa] externals/auctex 7ede3be 03/67: Make style hooks a
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] [elpa] externals/auctex 7ede3be 03/67: Make style hooks associated with class options valid again |
Date: |
Fri, 8 Feb 2019 11:40:27 -0500 (EST) |
branch: externals/auctex
commit 7ede3be86f862f033051ca4c4a7c0a5aa3aeeb53
Author: Ikumi Keita <address@hidden>
Commit: Ikumi Keita <address@hidden>
Make style hooks associated with class options valid again
* latex.el (TeX-latex-mode): Add a function on `TeX-update-style-hook'
to run style hooks associated with class options.
(LaTeX-common-initialization): Set `TeX-PDF-from-DVI' to suitable
value when a class option "dvips" or "dvipdfmx" is given.
* style/geometry.el ("geometry"):
* style/graphicx.el ("graphicx"): Set `TeX-PDF-from-DVI' to "Dvipdfmx"
when a package option "dvipdfmx" is given.
* tests/latex/latex-test.el (LaTeX-style-hook-with-class-option): New
test.
---
latex.el | 16 +++++++++++++++-
style/geometry.el | 8 ++++++--
style/graphicx.el | 8 ++++++--
tests/latex/latex-test.el | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
4 files changed, 73 insertions(+), 6 deletions(-)
diff --git a/latex.el b/latex.el
index 3315614..4c0a75b 100644
--- a/latex.el
+++ b/latex.el
@@ -5929,6 +5929,13 @@ of `LaTeX-mode-hook'."
(lambda ()
(if (local-variable-p 'LaTeX-biblatex-use-Biber (current-buffer))
(setq LaTeX-using-Biber LaTeX-biblatex-use-Biber))) nil t)
+ (add-hook 'TeX-update-style-hook
+ (lambda ()
+ ;; Run style hooks associated with class options.
+ (apply #'TeX-run-style-hooks
+ (apply #'append
+ (mapcar #'cdr LaTeX-provided-class-options))))
+ nil t)
(TeX-run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'LaTeX-mode-hook)
(when (fboundp 'LaTeX-preview-setup)
(LaTeX-preview-setup))
@@ -6449,13 +6456,20 @@ function would return non-nil and `(match-string 1)'
would return
(TeX-add-style-hook "pdftex" 'TeX-PDF-mode-on LaTeX-dialect)
(TeX-add-style-hook "pdftricks" 'TeX-PDF-mode-on LaTeX-dialect)
(TeX-add-style-hook "pst-pdf" 'TeX-PDF-mode-on LaTeX-dialect)
- (TeX-add-style-hook "dvips" 'TeX-PDF-mode-off LaTeX-dialect)
+ (TeX-add-style-hook "dvips"
+ (lambda ()
+ (setq TeX-PDF-from-DVI "Dvips"))
+ LaTeX-dialect)
;; This is now done in style/pstricks.el because it prevents other
;; pstricks style files from being loaded.
;; (TeX-add-style-hook "pstricks" 'TeX-PDF-mode-off)
(TeX-add-style-hook "psfrag" 'TeX-PDF-mode-off LaTeX-dialect)
(TeX-add-style-hook "dvipdf" 'TeX-PDF-mode-off LaTeX-dialect)
(TeX-add-style-hook "dvipdfm" 'TeX-PDF-mode-off LaTeX-dialect)
+ (TeX-add-style-hook "dvipdfmx"
+ (lambda ()
+ (setq TeX-PDF-from-DVI "Dvipdfmx"))
+ LaTeX-dialect)
;; (TeX-add-style-hook "DVIoutput" 'TeX-PDF-mode-off)
;;
;; Well, DVIoutput indicates that we want to run PDFTeX and expect to
diff --git a/style/geometry.el b/style/geometry.el
index 7e59fe0..b7dabec 100644
--- a/style/geometry.el
+++ b/style/geometry.el
@@ -1,6 +1,6 @@
;;; geometry.el --- AUCTeX style for `geometry.sty' (v5.6)
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
;; Author: Arash Esbati <address@hidden>
;; Maintainer: address@hidden
@@ -137,7 +137,11 @@ package.")
("newgeometry" "{")
("savegeometry" "{")
("loadgeometry" "{"))
- 'function)))
+ 'function))
+
+ ;; Option management
+ (if (LaTeX-provided-package-options-member "geometry" "dvipdfmx")
+ (setq TeX-PDF-from-DVI "Dvipdfmx")))
LaTeX-dialect)
(defun LaTeX-geometry-package-options ()
diff --git a/style/graphicx.el b/style/graphicx.el
index bb89b13..41ce1ec 100644
--- a/style/graphicx.el
+++ b/style/graphicx.el
@@ -1,6 +1,6 @@
;;; graphicx.el --- AUCTeX style file for graphicx.sty
-;; Copyright (C) 2000, 2004, 2005, 2014--2017 by Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2004, 2005, 2014--2018 by Free Software Foundation, Inc.
;; Author: Ryuichi Arafune <address@hidden>
;; Created: 1999/3/20
@@ -299,7 +299,11 @@ doesn't works with Emacs 21.3 or XEmacs. See
(font-latex-add-keywords '(("graphicspath" "{")
("DeclareGraphicsExtensions" "{")
("DeclareGraphicsRule" "{{{{"))
- 'function)))
+ 'function))
+
+ ;; Option management
+ (if (LaTeX-provided-package-options-member "graphicx" "dvipdfmx")
+ (setq TeX-PDF-from-DVI "Dvipdfmx")))
LaTeX-dialect)
(defvar LaTeX-graphicx-package-options
diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el
index b3a22c5..776be6c 100644
--- a/tests/latex/latex-test.el
+++ b/tests/latex/latex-test.el
@@ -1,6 +1,6 @@
;;; latex-test.el --- tests for LaTeX mode
-;; Copyright (C) 2014--2017 Free Software Foundation, Inc.
+;; Copyright (C) 2014--2018 Free Software Foundation, Inc.
;; This file is part of AUCTeX.
@@ -257,4 +257,49 @@ backend=biber % here is a comment
(equal (sort (LaTeX-includegraphics-extensions-list) #'string<)
(sort '("eps" "jpe?g" "pdf" "png") #'string<))))))
+(ert-deftest LaTeX-style-hook-with-class-option ()
+ "Check style hooks associated with class option are processed."
+ (with-temp-buffer
+ (let ((TeX-parse-self t))
+ ;; test for dvips option
+ ;; This depends on the following code in latex.el:
+ ;; (TeX-add-style-hook "dvips"
+ ;; (lambda ()
+ ;; (setq TeX-PDF-from-DVI "Dvips"))
+ ;; LaTeX-dialect)
+ (insert "\documentclass[dvips]{article}
")
+ (latex-mode)
+ (TeX-update-style t)
+ (should (string-equal TeX-PDF-from-DVI "Dvips"))
+
+ ;; test for dvipdfmx option
+ (erase-buffer)
+ ;; This depends on the following code in latex.el:
+ ;; (TeX-add-style-hook "dvipdfmx"
+ ;; (lambda ()
+ ;; (setq TeX-PDF-from-DVI "Dvipdfmx"))
+ ;; LaTeX-dialect)
+ (insert "\documentclass[dvipdfmx]{article}
")
+ (latex-mode)
+ (TeX-update-style t)
+ (should (string-equal TeX-PDF-from-DVI "Dvipdfmx"))
+
+ ;; test for pdftricks option
+ (erase-buffer)
+ ;; This depends on the following code in latex.el:
+ ;; (TeX-add-style-hook "pdftricks" 'TeX-PDF-mode-on LaTeX-dialect)
+ (insert "\documentclass[pdftricks]{article}
")
+ (latex-mode)
+ (TeX-update-style t)
+ (should TeX-PDF-mode)
+
+ ;; test for psfrag option
+ (erase-buffer)
+ ;; This depends on the following code in latex.el:
+ ;; (TeX-add-style-hook "psfrag" 'TeX-PDF-mode-off LaTeX-dialect)
+ (insert "\documentclass[psfrag]{article}
")
+ (latex-mode)
+ (TeX-update-style t)
+ (should (not TeX-PDF-mode)))))
+
;;; latex-test.el ends here
- [AUCTeX-diffs] [elpa] externals/auctex updated (eca4ffe -> f34ce5a), Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex dad0c60 11/67: Surround both \langle and angle with math delimiter, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 3694373 05/67: Deal with space in path of MikTeX gs executable (Bug#32251), Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 8d0e9cd 13/67: style/enumitem.el ("enumitem"): Use `TeX-argument-prompt' for query., Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 06226ea 09/67: Adjust preview-latex in case sub file isn't in master directory, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 7ede3be 03/67: Make style hooks associated with class options valid again,
Tassilo Horn <=
- [AUCTeX-diffs] [elpa] externals/auctex f213b1b 10/67: Set `TeX-command-buffer' always (bug#33377), Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 866eae1 20/67: Remove references to XEmacs from the manual, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 2152678 04/67: Change regexp for clarity, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 10047fb 07/67: * style/fancyvrb.el (LaTeX-fancyvrb-key-val-options): Add vspace key., Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 0970844 02/67: Deal with partial ^^-quoting in preview-latex, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex c8a8d47 08/67: Don't block emacs during viewing document, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex a20430d 15/67: Add new style/dashundergaps.el, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 8b5e53d 24/67: Remove unnecessary parentheses, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 12f7a21 18/67: Add suggestions for non-privileged installation, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 32bc548 12/67: ; Fix typos and doc string, Tassilo Horn, 2019/02/08