[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master c273efde: Honor file local variable (bug#65750)
From: |
Ikumi Keita |
Subject: |
master c273efde: Honor file local variable (bug#65750) |
Date: |
Sun, 10 Sep 2023 09:17:22 -0400 (EDT) |
branch: master
commit c273efdeb22a20bd19d6efb6e91103a884d21146
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>
Honor file local variable (bug#65750)
* context.el (ConTeXt-mode-common-initialization): Defer setups for
`ConTeXt-indent-item-re', `paragraph-start' and `outline-regexp' after
`run-mode-hooks'.
* tex-info.el (TeX-texinfo-mode): Defer setups for `page-delimiter',
`outline-heading-alist', `outline-regexp' and `TeX-complete-list'
after `run-mode-hooks'.
(): Add defvar for `outline-heading-alist' to silence compiler.
* tex.el (VirTeX-common-initialization): Add related comment.
---
context.el | 44 ++++++++++++++++++++++++++++++++++----------
tex-info.el | 60 +++++++++++++++++++++++++++++++++++++++++++++---------------
tex.el | 3 +++
3 files changed, 82 insertions(+), 25 deletions(-)
diff --git a/context.el b/context.el
index 8fb6d3ea..7920b6d3 100644
--- a/context.el
+++ b/context.el
@@ -1840,8 +1840,8 @@ that is, you do _not_ have to cater for this yourself by
adding \\\\\\=' or $."
(set symbol (symbol-value (intern (concat (symbol-name symbol) "-"
ConTeXt-current-interface)))))
- ;; Create certain regular expressions based on language
- (setq ConTeXt-indent-item-re (concat "\\\\\\(" (mapconcat #'identity
ConTeXt-item-list "\\|") "\\)\\>"))
+ ;; Moved after `run-mode-hooks'. (bug#65750)
+ ;; (setq ConTeXt-indent-item-re (concat "\\\\\\(" (mapconcat #'identity
ConTeXt-item-list "\\|") "\\)\\>"))
;; What's the deepest level at we can collapse a document?
;; set only if user has not set it. Need to be set before menu is created.
@@ -1863,12 +1863,13 @@ that is, you do _not_ have to cater for this yourself
by adding \\\\\\=' or $."
(set (make-local-variable 'paragraph-ignore-fill-prefix) t)
(set (make-local-variable 'fill-paragraph-function) #'LaTeX-fill-paragraph)
(set (make-local-variable 'adaptive-fill-mode) nil)
- (setq paragraph-start
- (concat
- "[ \t]*\\("
- (ConTeXt-paragraph-commands-regexp) "\\|"
- "\\$\\$\\|" ; Plain TeX display math
- "$\\)"))
+ ;; Moved after `run-mode-hooks'. (bug#65750)
+ ;; (setq paragraph-start
+ ;; (concat
+ ;; "[ \t]*\\("
+ ;; (ConTeXt-paragraph-commands-regexp) "\\|"
+ ;; "\\$\\$\\|" ; Plain TeX display math
+ ;; "$\\)"))
(setq paragraph-separate
(concat
"[ \t]*\\("
@@ -1888,7 +1889,8 @@ that is, you do _not_ have to cater for this yourself by
adding \\\\\\=' or $."
;; Outline support
(require 'outline)
(set (make-local-variable 'outline-level) #'ConTeXt-outline-level)
- (set (make-local-variable 'outline-regexp) (ConTeXt-outline-regexp t))
+ ;; Moved after `run-mode-hooks'. (bug#65750)
+ ;; (set (make-local-variable 'outline-regexp) (ConTeXt-outline-regexp t))
;;(make-local-variable 'outline-heading-end-regexp)
(setq TeX-header-end (ConTeXt-header-end)
TeX-trailer-start (ConTeXt-trailer-start))
@@ -1903,7 +1905,29 @@ that is, you do _not_ have to cater for this yourself by
adding \\\\\\=' or $."
;; run hooks
(setq TeX-command-default "ConTeXt")
(setq TeX-sentinel-default-function #'TeX-ConTeXt-sentinel)
- (run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'ConTeXt-mode-hook))
+ (run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'ConTeXt-mode-hook)
+
+ ;; Create certain regular expressions based on language.
+ ;; Don't overwrite the value the user set by hooks or file
+ ;; (directory) variables.
+ (or (local-variable-p 'ConTeXt-indent-item-re)
+ (setq-local ConTeXt-indent-item-re
+ (concat
+ "\\\\\\("
+ (mapconcat #'identity ConTeXt-item-list "\\|")
+ "\\)\\>")))
+
+ ;; Don't do locally-bound test for `paragraph-start'. See comments
+ ;; in similar part in latex.el.
+ (setq paragraph-start
+ (concat
+ "[ \t]*\\("
+ (ConTeXt-paragraph-commands-regexp) "\\|"
+ "\\$\\$\\|" ; Plain TeX display math
+ "$\\)"))
+
+ (or (local-variable-p 'outline-regexp)
+ (setq-local outline-regexp (ConTeXt-outline-regexp t))))
(defun context-guess-current-interface ()
"Guess what ConTeXt interface the current buffer is using."
diff --git a/tex-info.el b/tex-info.el
index 8bef02a1..4d339dd1 100644
--- a/tex-info.el
+++ b/tex-info.el
@@ -31,6 +31,9 @@
(require 'texinfo)
+;; Silence the compiler for variables:
+(defvar outline-heading-alist)
+
;;; Environments:
(defvar Texinfo-environment-list
'(("cartouche") ("command") ("copying") ("defcv") ("deffn") ("defivar")
@@ -650,11 +653,12 @@ value of `Texinfo-mode-hook'."
(use-local-map Texinfo-mode-map)
(set-syntax-table texinfo-mode-syntax-table)
- (set (make-local-variable 'page-delimiter)
- (concat
- "^@node [ \t]*[Tt]op\\|^@\\("
- texinfo-chapter-level-regexp
- "\\)"))
+ ;; Moved after `run-mode-hooks'. (bug#65750)
+ ;; (set (make-local-variable 'page-delimiter)
+ ;; (concat
+ ;; "^@node [ \t]*[Tt]op\\|^@\\("
+ ;; texinfo-chapter-level-regexp
+ ;; "\\)"))
(set (make-local-variable 'require-final-newline) mode-require-final-newline)
(set (make-local-variable 'indent-tabs-mode) nil)
(set (make-local-variable 'paragraph-separate)
@@ -676,13 +680,13 @@ value of `Texinfo-mode-hook'."
(set (make-local-variable 'syntax-propertize-function)
texinfo-syntax-propertize-function)
- ;; Outline settings.
- (setq-local outline-heading-alist
- (mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x)))
- texinfo-section-list))
- (setq-local outline-regexp
- (concat (regexp-opt (mapcar #'car outline-heading-alist) t)
- "\\>"))
+ ;; Moved after `run-mode-hooks'. (bug#65750)
+ ;; (setq-local outline-heading-alist
+ ;; (mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x)))
+ ;; texinfo-section-list))
+ ;; (setq-local outline-regexp
+ ;; (concat (regexp-opt (mapcar #'car outline-heading-alist) t)
+ ;; "\\>"))
;; Mostly AUCTeX stuff
(set (make-local-variable 'TeX-command-current) #'TeX-command-master)
@@ -697,9 +701,10 @@ value of `Texinfo-mode-hook'."
(setq TeX-trailer-start (format "^%s$"
(regexp-quote (concat TeX-esc "bye"))))
- (set (make-local-variable 'TeX-complete-list)
- (list (list "@\\([a-zA-Z]*\\)" 1 #'TeX-symbol-list-filtered nil)
- (list "" TeX-complete-word)))
+ ;; Moved after `run-mode-hooks'. (bug#65750)
+ ;; (set (make-local-variable 'TeX-complete-list)
+ ;; (list (list "@\\([a-zA-Z]*\\)" 1 #'TeX-symbol-list-filtered nil)
+ ;; (list "" TeX-complete-word)))
(set (make-local-variable 'TeX-font-list) Texinfo-font-list)
(set (make-local-variable 'TeX-font-replace-function)
@@ -865,6 +870,31 @@ value of `Texinfo-mode-hook'."
(Texinfo-reftex-hook))
(run-mode-hooks 'text-mode-hook 'Texinfo-mode-hook)
+
+ ;; Don't overwrite the value the user set by hooks or file
+ ;; (directory) variables.
+ (or (local-variable-p 'page-delimiter)
+ (setq-local page-delimiter
+ (concat
+ "^@node [ \t]*[Tt]op\\|^@\\("
+ texinfo-chapter-level-regexp
+ "\\)")))
+
+ ;; Outline settings.
+ (or (local-variable-p 'outline-heading-alist)
+ (setq-local outline-heading-alist
+ (mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x)))
+ texinfo-section-list)))
+ (or (local-variable-p 'outline-regexp)
+ (setq-local outline-regexp
+ (concat (regexp-opt (mapcar #'car outline-heading-alist) t)
+ "\\>")))
+
+ (or (local-variable-p 'TeX-complete-list)
+ (setq-local TeX-complete-list
+ (list (list "@\\([a-zA-Z]*\\)" 1 #'TeX-symbol-list-filtered
nil)
+ (list "" TeX-complete-word))))
+
(TeX-set-mode-name))
(defcustom Texinfo-clean-intermediate-suffixes
diff --git a/tex.el b/tex.el
index a85b8ef9..24d4bdeb 100644
--- a/tex.el
+++ b/tex.el
@@ -3779,6 +3779,9 @@ The algorithm is as follows:
;; (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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master c273efde: Honor file local variable (bug#65750),
Ikumi Keita <=