auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 7ede3be86f862f033051c


From: Ikumi Keita
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 7ede3be86f862f033051ca4c4a7c0a5aa3aeeb53
Date: Tue, 30 Oct 2018 10:13:53 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  7ede3be86f862f033051ca4c4a7c0a5aa3aeeb53 (commit)
      from  097084443771d6716c6870f2f8d329e9c0949d97 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7ede3be86f862f033051ca4c4a7c0a5aa3aeeb53
Author: Ikumi Keita <address@hidden>
Date:   Tue Oct 30 23:03:56 2018 +0900

    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.

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}\n")
+      (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}\n")
+      (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}\n")
+      (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}\n")
+      (latex-mode)
+      (TeX-update-style t)
+      (should (not TeX-PDF-mode)))))
+
 ;;; latex-test.el ends here

-----------------------------------------------------------------------

Summary of changes:
 latex.el                  | 16 +++++++++++++++-
 style/geometry.el         |  8 ++++++--
 style/graphicx.el         |  8 ++++++--
 tests/latex/latex-test.el | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 73 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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