[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 454f02a588 25/37: Take care of temporal buffers
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 454f02a588 25/37: Take care of temporal buffers (bug#65912) |
Date: |
Wed, 11 Oct 2023 03:41:56 -0400 (EDT) |
branch: externals/auctex
commit 454f02a588dae8e3ea42f114cda1f7249c3e9b72
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>
Take care of temporal buffers (bug#65912)
* font-latex.el (font-latex-setup): Set up font lock in temporal
buffers so that functions dependent on syntax propertization should
work.
* latex.el (docTeX-mode): Reset `font-lock-set-defaults' in case the
above sets up has taken place already.
(TeX-latex-mode):
* plain-tex.el (TeX-plain-tex-mode, ams-tex-mode):
Run style hooks in temporal buffers.
* tests/context/context-test.el:
* tests/latex/font-latex-test.el:
* tests/latex/latex-test.el ():
(LaTeX-filling, LaTeX-style-hook-with-class-option):
* tests/latex/texmathp-test.el:
Arrange in accord with the above changes.
---
font-latex.el | 12 +++++++++++-
latex.el | 13 ++++++++++++-
plain-tex.el | 16 ++++++++++++++--
tests/context/context-test.el | 6 ------
tests/latex/font-latex-test.el | 6 ------
tests/latex/latex-test.el | 12 ++----------
tests/latex/texmathp-test.el | 2 --
7 files changed, 39 insertions(+), 28 deletions(-)
diff --git a/font-latex.el b/font-latex.el
index 8fc567e292..95b88815e0 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -1353,7 +1353,17 @@ triggers Font Lock to recognize the change."
;; Make sure fontification will be refreshed if a user sets variables
;; influencing fontification in her file-local variables section.
- (add-hook 'hack-local-variables-hook
#'font-latex-after-hacking-local-variables t t))
+ (add-hook 'hack-local-variables-hook
#'font-latex-after-hacking-local-variables t t)
+
+ ;; We may be using the mode programmatically to extract data, and we
+ ;; then need this to be set up first so that a command like
+ ;; `xref-find-references' doesn't bug out when matching hits in
+ ;; files that Emacs isn't visiting. (bug#65912)
+ ;; We need this treatment because the current syntax propertize
+ ;; facility depends on font lock machinery. We can remove this
+ ;; when syntax propertization decouples font lock.
+ (unless buffer-file-truename
+ (font-lock-set-defaults)))
(defun font-latex-update-font-lock (&optional _syntactic-kws)
"Tell font-lock about updates of fontification rules.
diff --git a/latex.el b/latex.el
index 3abb00f216..f374e558c4 100644
--- a/latex.el
+++ b/latex.el
@@ -8045,7 +8045,14 @@ of `LaTeX-mode-hook'."
filladapt-mode)
(turn-off-filladapt-mode))
;; Set up flymake backend, see latex-flymake.el
- (add-hook 'flymake-diagnostic-functions #'LaTeX-flymake nil t))
+ (add-hook 'flymake-diagnostic-functions #'LaTeX-flymake nil t)
+
+ ;; Complete style initialization in buffers which don't visit files
+ ;; and which are therefore missed by the setting of `find-file-hook'
+ ;; in `VirTeX-common-initialization'. This is necessary for
+ ;; `xref-find-references', for example. (bug#65912)
+ (unless buffer-file-truename
+ (TeX-update-style)))
(TeX-abbrev-mode-setup doctex-mode)
@@ -8068,6 +8075,10 @@ runs the hooks in `docTeX-mode-hook'."
TeX-comment-start-regexp "\\(?:%\\(?:<[^>]+>\\)?\\)")
(setq TeX-base-mode-name "docTeX")
(TeX-set-mode-name)
+ ;; We can remove the next `setq' when syntax propertization
+ ;; decouples font lock and `font-latex-setup' stops calling
+ ;; `font-lock-set-defaults'.
+ (setq font-lock-set-defaults nil)
(funcall TeX-install-font-lock))
;; Enable LaTeX abbrevs in docTeX mode buffer.
diff --git a/plain-tex.el b/plain-tex.el
index 0800b2f3da..b4c78fe489 100644
--- a/plain-tex.el
+++ b/plain-tex.el
@@ -135,7 +135,13 @@ of `plain-TeX-mode-hook'."
(add-hook 'tool-bar-mode-hook #'plain-TeX-maybe-install-toolbar nil t)
(plain-TeX-maybe-install-toolbar)
(run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'plain-TeX-mode-hook)
- (TeX-set-mode-name))
+ (TeX-set-mode-name)
+ ;; Complete style initialization in buffers which don't visit files
+ ;; and which are therefore missed by the setting of `find-file-hook'
+ ;; in `VirTeX-common-initialization'. This is necessary for
+ ;; `xref-find-references', for example. (bug#65912)
+ (unless buffer-file-truename
+ (TeX-update-style)))
(defun plain-TeX-common-initialization ()
"Common initialization for plain TeX like modes."
@@ -308,7 +314,13 @@ of `AmS-TeX-mode-hook'."
(setq TeX-base-mode-name "AmS-TeX")
(setq TeX-command-default "AmSTeX")
(run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'AmS-TeX-mode-hook)
- (TeX-set-mode-name))
+ (TeX-set-mode-name)
+ ;; Complete style initialization in buffers which don't visit files
+ ;; and which are therefore missed by the setting of `find-file-hook'
+ ;; in `VirTeX-common-initialization'. This is necessary for
+ ;; `xref-find-references', for example. (bug#65912)
+ (unless buffer-file-truename
+ (TeX-update-style)))
(defcustom AmSTeX-clean-intermediate-suffixes
TeX-clean-default-intermediate-suffixes
diff --git a/tests/context/context-test.el b/tests/context/context-test.el
index cc7c8d549f..4eeab4b67a 100644
--- a/tests/context/context-test.el
+++ b/tests/context/context-test.el
@@ -24,12 +24,6 @@
(require 'ert)
(require 'context)
-;; We need to ensure that font-lock has put the syntax properties
-;; already which won't happen in batch mode. So trigger font-lock
-;; immediately.
-(define-advice ConTeXt-mode-common-initialization (:after ())
- (font-lock-ensure))
-
(AUCTeX-set-ert-path
'ConTeXt-indent-test/in
"context-indentation-in.tex"
diff --git a/tests/latex/font-latex-test.el b/tests/latex/font-latex-test.el
index 40f9633a1a..94150ac04d 100644
--- a/tests/latex/font-latex-test.el
+++ b/tests/latex/font-latex-test.el
@@ -27,12 +27,6 @@
(defvar font-lock-beg)
(defvar font-lock-end)
-;; We need to ensure that font-lock has put the syntax properties
-;; already which won't happen in batch mode. So trigger font-lock
-;; immediately.
-(define-advice LaTeX-common-initialization (:after ())
- (font-lock-ensure))
-
(ert-deftest font-latex-three-dollars ()
"Test three consecutive dollar is ignored."
;; When the function `font-latex-match-dollar-math' encounters three
diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el
index fbd64e0953..13cbf4820d 100644
--- a/tests/latex/latex-test.el
+++ b/tests/latex/latex-test.el
@@ -24,12 +24,6 @@
(require 'ert)
(require 'latex)
-;; We need to ensure that font-lock has put the syntax properties
-;; already which won't happen in batch mode. So trigger font-lock
-;; immediately.
-(define-advice LaTeX-common-initialization (:after ())
- (font-lock-ensure))
-
(AUCTeX-set-ert-path
'LaTeX-indent-tabular-test/in
"tabular-in.tex"
@@ -174,11 +168,10 @@
(should (string=
(with-temp-buffer
(insert-file-contents LaTeX-filling/in)
- (LaTeX-mode)
(let ((fill-column 70)
(LaTeX-shortvrb-chars '(?\"))
(TeX-parse-self t))
- (TeX-update-style t)
+ (LaTeX-mode)
(search-forward "Lorem")
(fill-paragraph)
@@ -416,9 +409,8 @@ backend=biber % here is a comment
;; dvipdfmx option should not trigger `TeX-PDF-from-DVI' for
;; XeLaTeX document
- (latex-mode)
(let ((TeX-engine 'xetex))
- (TeX-update-style))
+ (LaTeX-mode))
(should TeX-PDF-mode)
(should (not (TeX-PDF-from-DVI)))
(should (not (member "dvipdfmx" TeX-active-styles)))
diff --git a/tests/latex/texmathp-test.el b/tests/latex/texmathp-test.el
index 121af22c7f..a18df63acd 100644
--- a/tests/latex/texmathp-test.el
+++ b/tests/latex/texmathp-test.el
@@ -55,7 +55,6 @@
(should-not (with-temp-buffer
(insert "a $b$ \\verb|$| c ")
(LaTeX-mode)
- (font-lock-ensure)
(texmathp)))
(should-not (with-temp-buffer
@@ -67,7 +66,6 @@ $
\\end{verbatim}
c")
(LaTeX-mode)
- (font-lock-ensure)
(texmathp)))))
;;; texmathp-test.el ends here
- [elpa] externals/auctex 0df824d5d2 19/37: Remove menu title inconsistency, (continued)
- [elpa] externals/auctex 0df824d5d2 19/37: Remove menu title inconsistency, Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 90960e2be9 21/37: ; * .gitignore: Ignore Finder files on macOS., Tassilo Horn, 2023/10/11
- [elpa] externals/auctex aabf144dfb 22/37: Arrange indent of tabular-like environments (bug#65648), Tassilo Horn, 2023/10/11
- [elpa] externals/auctex a228137f66 24/37: Don't count braces in verbatim constructs for indentation, Tassilo Horn, 2023/10/11
- [elpa] externals/auctex ad81644cf1 26/37: ; * tex.el (TeX-brace-count-line): Fix last change., Tassilo Horn, 2023/10/11
- [elpa] externals/auctex bb5e6c0a27 27/37: Remove let-binding for `max-specpdl-size', Tassilo Horn, 2023/10/11
- [elpa] externals/auctex d9a6c248d0 35/37: ; Minor improvement of documentation, Tassilo Horn, 2023/10/11
- [elpa] externals/auctex c290376d5d 15/37: Allow programmatic folding, Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 91da27754b 13/37: Keep preview images when killing indirect buffer (bug#65462), Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 95d7a81f40 20/37: Fix "Honor file local variables" (bug#65750), Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 454f02a588 25/37: Take care of temporal buffers (bug#65912),
Tassilo Horn <=
- [elpa] externals/auctex 34a94db2ae 29/37: * tex.el (plain-TeX-auto-regexp-list): Save regexp groups., Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 7b1d4156b2 32/37: * latex.el (LaTeX-auto-counter-regexp-list): Save regexp groups., Tassilo Horn, 2023/10/11
- [elpa] externals/auctex b18e98cbec 04/37: Follow-up fix for doc string (bug#65195), Tassilo Horn, 2023/10/11
- [elpa] externals/auctex e2f18de580 23/37: ; * auctex.el.in: Provide the final product., Tassilo Horn, 2023/10/11
- [elpa] externals/auctex c139490c7e 28/37: Tune special modes, Tassilo Horn, 2023/10/11
- [elpa] externals/auctex d436191cef 31/37: * latex.el (LaTeX-auto-class-regexp-list): Save regexp groups., Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 846cce4378 36/37: Fix documentations about Texinfo mode, Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 75702683d0 37/37: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 3c03ee089a 01/37: Add missing alternative for custom type, Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 034c528741 33/37: * latex.el (LaTeX-auto-regexp-list): Save regexp groups., Tassilo Horn, 2023/10/11