auctex-diffs
[Top][All Lists]
Advanced

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

master 2151c383: Honor file local value for `LaTeX-section-list' (bug#65


From: Ikumi Keita
Subject: master 2151c383: Honor file local value for `LaTeX-section-list' (bug#65750)
Date: Sat, 9 Sep 2023 07:47:43 -0400 (EDT)

branch: master
commit 2151c3831fcff957a0c2b897010dea0c47c5df38
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>

    Honor file local value for `LaTeX-section-list' (bug#65750)
    
    Set up variables for `LaTeX-mark-section' after file local variables
    are ready.  Similar change for other major modes will follow soon.
    
    This is only a partial fix because `run-mode-hooks' doesn't run hooks
    and `hack-local-variables' when latex-mode is called as parent of
    doctex-mode.
    
    * latex.el (TeX-latex-mode, LaTeX-common-initialization): Move setups
    of `outline-regexp', `outline-heading-alist', `paragraph-start' and
    indent-related variables after `run-mode-hooks'.
---
 latex.el | 43 +++++++++++++++++++++++++++++++++++--------
 1 file changed, 35 insertions(+), 8 deletions(-)

diff --git a/latex.el b/latex.el
index d855b5c5..da2eaac6 100644
--- a/latex.el
+++ b/latex.el
@@ -8007,6 +8007,30 @@ of `LaTeX-mode-hook'."
                               (mapcar #'cdr LaTeX-provided-class-options)))))
             nil t)
   (run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'LaTeX-mode-hook)
+
+  ;; Don't overwrite the value the user set by hooks or file
+  ;; (directory) variables.
+  (or (local-variable-p 'outline-regexp)
+      (setq-local outline-regexp (LaTeX-outline-regexp t)))
+  (or (local-variable-p 'outline-heading-alist)
+      (setq outline-heading-alist
+            (mapcar (lambda (x)
+                      (cons (concat "\\" (nth 0 x)) (nth 1 x)))
+                    LaTeX-section-list)))
+
+  ;; Don't do locally-bound test for `paragraph-start' because it
+  ;; makes little sense; Style files casually call this function and
+  ;; overwrite it unconditionally.  Users who need per-file
+  ;; customization of `paragraph-start' should set
+  ;; `LaTeX-paragraph-commands' instead.
+  (LaTeX-set-paragraph-start)
+
+  ;; Don't do locally-bound test for similar reason as above.  Users
+  ;; 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)
+
   (when (fboundp 'LaTeX-preview-setup)
     (LaTeX-preview-setup))
   (TeX-set-mode-name)
@@ -8127,12 +8151,13 @@ function would return non-nil and `(match-string 1)' 
would return
 
   (require 'outline)
   (set (make-local-variable 'outline-level) #'LaTeX-outline-level)
-  (set (make-local-variable 'outline-regexp) (LaTeX-outline-regexp t))
-  (when (boundp 'outline-heading-alist)
-    (setq outline-heading-alist
-          (mapcar (lambda (x)
-                    (cons (concat "\\" (nth 0 x)) (nth 1 x)))
-                  LaTeX-section-list)))
+  ;; Moved after `run-mode-hooks'. (bug#65750)
+  ;; (set (make-local-variable 'outline-regexp) (LaTeX-outline-regexp t))
+  ;; (when (boundp 'outline-heading-alist)
+  ;;   (setq outline-heading-alist
+  ;;         (mapcar (lambda (x)
+  ;;                   (cons (concat "\\" (nth 0 x)) (nth 1 x)))
+  ;;                 LaTeX-section-list)))
 
   (setq-local TeX-auto-full-regexp-list
               (delete-dups (append LaTeX-auto-regexp-list
@@ -8141,7 +8166,8 @@ function would return non-nil and `(match-string 1)' 
would return
                                    (copy-sequence
                                     plain-TeX-auto-regexp-list))))
 
-  (LaTeX-set-paragraph-start)
+  ;; Moved after `run-mode-hooks'. (bug#65750)
+  ;; (LaTeX-set-paragraph-start)
   (setq paragraph-separate
         (concat
          "[ \t]*%*[ \t]*\\("
@@ -8157,7 +8183,8 @@ function would return non-nil and `(match-string 1)' 
would return
   (setq-local beginning-of-defun-function #'LaTeX-find-matching-begin)
   (setq-local end-of-defun-function       #'LaTeX-find-matching-end)
 
-  (LaTeX-indent-commands-regexp-make)
+  ;; Moved after `run-mode-hooks'. (bug#65750)
+  ;; (LaTeX-indent-commands-regexp-make)
 
   ;; Standard Emacs completion-at-point support.  We append the entry
   ;; in order to let `TeX--completion-at-point' be first in the list:



reply via email to

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