[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex f41fbc0eac 18/43: Improve mode cleanup functions
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex f41fbc0eac 18/43: Improve mode cleanup functions |
Date: |
Wed, 7 Feb 2024 06:07:10 -0500 (EST) |
branch: externals/auctex
commit f41fbc0eac09b1d1306124333bec7b88b9f55001
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>
Improve mode cleanup functions
* tex.el (TeX-mode, TeX-mode-cleanup): Set `TeX-complete-list' in
`TeX-mode-cleanup' so that buffer local value of `TeX-insert-braces'
and `TeX-complete-word' are used.
* latex.el (LaTeX-mode-cleanup, LaTeX-common-initialization): Set
`TeX-complete-list' in `LaTeX-mode-cleanup' in accord with the above
change.
(LaTeX-indent-commands-regexp-make): Fix doc string.
* plain-tex.el (plain-TeX-mode-cleanup): New function.
(plain-TeX-mode): Move tool bar related code into
`plain-TeX-mode-cleanup'.
* tex.el (TeX-mode-cleanup):
* latex.el (LaTeX-mode-cleanup):
* context.el (ConTeXt-mode-cleanup):
* tex-info.el (Texinfo-mode-cleanup):
Supply doc string.
; * context.el (ConTeXt-mode-common-initialization): Delete spurious code.
---
context.el | 3 ++-
latex.el | 66 +++++++++++++++++++++++++++++++-----------------------------
plain-tex.el | 21 ++++++++++---------
tex-info.el | 2 ++
tex.el | 41 ++++++++++++++++++++-----------------
5 files changed, 72 insertions(+), 61 deletions(-)
diff --git a/context.el b/context.el
index 237ba32693..df3ed2b953 100644
--- a/context.el
+++ b/context.el
@@ -1824,7 +1824,6 @@ that is, you do _not_ have to cater for this yourself by
adding \\\\\\=' or $."
(defun ConTeXt-mode-common-initialization ()
"Initialization code that is common for all ConTeXt interfaces."
(plain-TeX-common-initialization)
- (setq major-mode 'ConTeXt-mode)
(set (make-local-variable 'TeX-style-hook-dialect) ConTeXt-dialect)
@@ -1896,6 +1895,8 @@ that is, you do _not_ have to cater for this yourself by
adding \\\\\\=' or $."
(setq TeX-sentinel-default-function #'TeX-ConTeXt-sentinel))
(defun ConTeXt-mode-cleanup ()
+ "Cleanup function for `ConTeXt-mode'.
+Run after mode hooks and file local variables application."
;; Create certain regular expressions based on language.
;; Don't overwrite the value the user set by hooks or file
;; (directory) variables.
diff --git a/latex.el b/latex.el
index 0750d74985..94878b5a81 100644
--- a/latex.el
+++ b/latex.el
@@ -4145,7 +4145,7 @@ the regexp's which are stored in
`LaTeX-indent-mid-regexp-local' and
`LaTeX-indent-end-regexp-local' accordingly. Some standard
macros are added to the regexp's. This function is called in
-`LaTeX-common-initialization' to set the regexp's."
+`LaTeX-mode-cleanup' to set the regexp's."
(let* (cmds
symbs
(func (lambda (in regexp out)
@@ -8010,6 +8010,8 @@ of `LaTeX-mode-hook'."
(add-hook 'flymake-diagnostic-functions #'LaTeX-flymake nil t))
(defun LaTeX-mode-cleanup ()
+ "Cleanup function for `LaTeX-mode'.
+Run after mode hooks and file local variables application."
;; Defeat filladapt
(if (bound-and-true-p filladapt-mode)
(turn-off-filladapt-mode))
@@ -8041,7 +8043,37 @@ of `LaTeX-mode-hook'."
;; who need per-file customization of
;; `LaTeX-indent-begin-regexp-local' etc. should set
;; `LaTeX-indent-begin-list' and so on instead.
- (LaTeX-indent-commands-regexp-make))
+ (LaTeX-indent-commands-regexp-make)
+
+ (setq TeX-complete-list
+ (append '(("\\\\cite\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)"
+ 1 LaTeX-bibitem-list "}")
+ ("\\\\cite{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-bibitem-list "}")
+ ("\\\\cite{\\([^{}\n\r\\%]*,\\)\\([^{}\n\r\\%,]*\\)"
+ 2 LaTeX-bibitem-list)
+ ("\\\\nocite{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-bibitem-list "}")
+ ("\\\\nocite{\\([^{}\n\r\\%]*,\\)\\([^{}\n\r\\%,]*\\)"
+ 2 LaTeX-bibitem-list)
+ ("\\\\[Rr]ef{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")
+ ("\\\\eqref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")
+ ("\\\\pageref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")
+ ("\\\\\\(index\\|glossary\\){\\([^{}\n\r\\%]*\\)"
+ 2 LaTeX-index-entry-list "}")
+ ("\\\\begin{\\([A-Za-z]*\\)" 1
LaTeX-environment-list-filtered "}")
+ ("\\\\end{\\([A-Za-z]*\\)" 1 LaTeX-environment-list-filtered
"}")
+ ("\\\\renewcommand\\*?{\\\\\\([A-Za-z]*\\)"
+ 1 TeX-symbol-list-filtered "}")
+ ("\\\\renewenvironment\\*?{\\([A-Za-z]*\\)"
+ 1 LaTeX-environment-list-filtered "}")
+ ("\\\\\\(this\\)?pagestyle{\\([A-Za-z]*\\)"
+ 2 LaTeX-pagestyle-list "}")
+ (LaTeX--after-math-macro-prefix-p
+ 1 (lambda ()
+ (seq-filter #'stringp
+ (append (mapcar #'cadr LaTeX-math-list)
+ (mapcar #'cadr
LaTeX-math-default))))
+ (if TeX-insert-braces "{}")))
+ TeX-complete-list)))
;; COMPATIBILITY for Emacs<29
;;;###autoload
@@ -8185,36 +8217,6 @@ function would return non-nil and `(match-string 1)'
would return
("tabular" . LaTeX-item-array)
("tabular*" .
LaTeX-item-tabular*)))
- (setq TeX-complete-list
- (append '(("\\\\cite\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)"
- 1 LaTeX-bibitem-list "}")
- ("\\\\cite{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-bibitem-list "}")
- ("\\\\cite{\\([^{}\n\r\\%]*,\\)\\([^{}\n\r\\%,]*\\)"
- 2 LaTeX-bibitem-list)
- ("\\\\nocite{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-bibitem-list "}")
- ("\\\\nocite{\\([^{}\n\r\\%]*,\\)\\([^{}\n\r\\%,]*\\)"
- 2 LaTeX-bibitem-list)
- ("\\\\[Rr]ef{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")
- ("\\\\eqref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")
- ("\\\\pageref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")
- ("\\\\\\(index\\|glossary\\){\\([^{}\n\r\\%]*\\)"
- 2 LaTeX-index-entry-list "}")
- ("\\\\begin{\\([A-Za-z]*\\)" 1
LaTeX-environment-list-filtered "}")
- ("\\\\end{\\([A-Za-z]*\\)" 1 LaTeX-environment-list-filtered
"}")
- ("\\\\renewcommand\\*?{\\\\\\([A-Za-z]*\\)"
- 1 TeX-symbol-list-filtered "}")
- ("\\\\renewenvironment\\*?{\\([A-Za-z]*\\)"
- 1 LaTeX-environment-list-filtered "}")
- ("\\\\\\(this\\)?pagestyle{\\([A-Za-z]*\\)"
- 2 LaTeX-pagestyle-list "}")
- (LaTeX--after-math-macro-prefix-p
- 1 (lambda ()
- (seq-filter #'stringp
- (append (mapcar #'cadr LaTeX-math-list)
- (mapcar #'cadr
LaTeX-math-default))))
- (if TeX-insert-braces "{}")))
- TeX-complete-list))
-
(LaTeX-add-environments
'("document" LaTeX-env-document)
'("enumerate" LaTeX-env-item)
diff --git a/plain-tex.el b/plain-tex.el
index 37370aabce..e2389b4ad4 100644
--- a/plain-tex.el
+++ b/plain-tex.el
@@ -129,19 +129,20 @@ Entering `plain-TeX-mode' calls the value of
`text-mode-hook',
then the value of `TeX-mode-hook', and then the value
of `plain-TeX-mode-hook'."
:syntax-table nil
+ :after-hook (plain-TeX-mode-cleanup)
(plain-TeX-common-initialization)
(setq TeX-base-mode-name mode-name)
- (setq TeX-command-default "TeX")
-
- (add-hook 'plain-TeX-mode-hook
- (lambda ()
- ;; Don't install tool bar in AmSTeX mode.
- (when (eq major-mode 'plain-TeX-mode)
- (add-hook 'tool-bar-mode-hook
- #'plain-TeX-maybe-install-toolbar nil t)
- (plain-TeX-maybe-install-toolbar)))
- nil t))
+ (setq TeX-command-default "TeX"))
+
+(defun plain-TeX-mode-cleanup ()
+ "Cleanup function for `plain-TeX-mode'.
+Run after mode hooks and file local variables application."
+ ;; Don't install tool bar in AmSTeX mode.
+ (when (eq major-mode 'plain-TeX-mode)
+ (add-hook 'tool-bar-mode-hook
+ #'plain-TeX-maybe-install-toolbar nil t)
+ (plain-TeX-maybe-install-toolbar)))
;; COMPATIBILITY for Emacs<29
;;;###autoload
diff --git a/tex-info.el b/tex-info.el
index 390524ca2e..0d069716bf 100644
--- a/tex-info.el
+++ b/tex-info.el
@@ -866,6 +866,8 @@ value of `Texinfo-mode-hook'."
(Texinfo-reftex-hook)))
(defun Texinfo-mode-cleanup ()
+ "Cleanup function for `Texinfo-mode'.
+Run after mode hooks and file local variables application."
;; Don't overwrite the value the user set by hooks or file
;; (directory) variables.
(or (local-variable-p 'page-delimiter)
diff --git a/tex.el b/tex.el
index 13635f6152..d4fded7323 100644
--- a/tex.el
+++ b/tex.el
@@ -3796,24 +3796,6 @@ Not intended for direct use for user."
;; (make-display-table)))
;; (aset buffer-display-table ?\t (apply 'vector (append "<TAB>" nil)))
- ;; Symbol & length completion.
- ;; We have to move the setup of `TeX-complete-list' after
- ;; `run-mode-hooks' in order to reflect the file local customization
- ;; of `TeX-insert-braces' and `TeX-complete-word'.
- (setq-local TeX-complete-list
- (list (list "\\\\\\([a-zA-Z]*\\)"
- 1
- (lambda ()
- (append (TeX-symbol-list-filtered)
- (when (fboundp 'LaTeX-length-list)
- (LaTeX-length-list))
- (when (fboundp 'LaTeX-counter-list)
- (mapcar (lambda (x)
- `(,(concat "the" (car x))))
- (LaTeX-counter-list)))))
- (if TeX-insert-braces "{}"))
- (list "" TeX-complete-word)))
-
(funcall TeX-install-font-lock)
;; We want this to be early in the list, so we do not add it before
@@ -3857,6 +3839,29 @@ Not intended for direct use for user."
(TeX-update-style t)) nil t))
(defun TeX-mode-cleanup ()
+ "Cleanup function for `TeX-mode'.
+Run after mode hooks and file local variables application."
+ ;; Symbol & length completion.
+ (or (local-variable-p 'TeX-complete-list)
+ (setq-local TeX-complete-list
+ (list (list "\\\\\\([a-zA-Z]*\\)"
+ 1
+ (lambda ()
+ (append
+ (TeX-symbol-list-filtered)
+ ;; These LaTeX-*-list are called even
+ ;; in non-LaTeX mode buffers, but
+ ;; that is permissible because they
+ ;; return empty list immediately.
+ (when (fboundp 'LaTeX-length-list)
+ (LaTeX-length-list))
+ (when (fboundp 'LaTeX-counter-list)
+ (mapcar (lambda (x)
+ `(,(concat "the" (car x))))
+ (LaTeX-counter-list)))))
+ (if TeX-insert-braces "{}"))
+ (list "" TeX-complete-word))))
+
;; Complete style initialization in buffers which don't visit files
;; and which are therefore missed by the setting of above
;; `find-file-hook'. This is necessary for `xref-find-references',
- [elpa] externals/auctex 9b6130ad9a 11/43: Revert menu title, (continued)
- [elpa] externals/auctex 9b6130ad9a 11/43: Revert menu title, Tassilo Horn, 2024/02/07
- [elpa] externals/auctex 46f2f2215d 07/43: Inherit abbrevs saved in table with former mode name, Tassilo Horn, 2024/02/07
- [elpa] externals/auctex 43be8c047b 26/43: * doc/changes.texi: Document the change related mode name renewal., Tassilo Horn, 2024/02/07
- [elpa] externals/auctex 997bff87d2 23/43: Retain compatibility for directory local variables, Tassilo Horn, 2024/02/07
- [elpa] externals/auctex 9c6f701a0c 12/43: Use `define-derived-mode' for AUCTeX major modes, Tassilo Horn, 2024/02/07
- [elpa] externals/auctex 77ae6b5652 19/43: Restore tool bar on japanese-plain-TeX-mode, Tassilo Horn, 2024/02/07
- [elpa] externals/auctex f9fc9619a1 35/43: ; Replace keyword wp with text, Tassilo Horn, 2024/02/07
- [elpa] externals/auctex d7f1d28159 32/43: ; * tex.el (TeX-auto-parse-length): Fix Typo., Tassilo Horn, 2024/02/07
- [elpa] externals/auctex 5b61f6c563 42/43: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2024/02/07
- [elpa] externals/auctex 94127f5e10 37/43: Make banner regexp customizable, Tassilo Horn, 2024/02/07
- [elpa] externals/auctex f41fbc0eac 18/43: Improve mode cleanup functions,
Tassilo Horn <=
- [elpa] externals/auctex 52f903a4e9 08/43: Take care of `unload-feature', Tassilo Horn, 2024/02/07
- [elpa] externals/auctex ebc69e7ae7 14/43: Canonicalize mode names, Tassilo Horn, 2024/02/07
- [elpa] externals/auctex 77a02f837a 30/43: Mark options as buffer-local with the :local keyword, Tassilo Horn, 2024/02/07
- [elpa] externals/auctex 8cb64a3487 21/43: Augment suitable default entry for M-?, Tassilo Horn, 2024/02/07
- [elpa] externals/auctex c401a1130e 38/43: ; Arrange the documentation of the previous commit, Tassilo Horn, 2024/02/07
- [elpa] externals/auctex b407b239e2 36/43: Update style/simpleicons.el to package v11.1.0, Tassilo Horn, 2024/02/07
- [elpa] externals/auctex 4ddf6dd9bd 20/43: Tune docTeX mode abbrev table, Tassilo Horn, 2024/02/07
- [elpa] externals/auctex ebd04735e7 16/43: Merge branch 'master' into feature/fix-mode-names-overlap, Tassilo Horn, 2024/02/07
- [elpa] externals/auctex c12eba0ba2 17/43: Adjust menu, Tassilo Horn, 2024/02/07
- [elpa] externals/auctex f06778a7ae 27/43: * doc/changes.texi: Update the last change., Tassilo Horn, 2024/02/07