branch: master
commit 95d7a81f401858af6c2b7f1b038dca67c54b25f3
Author: Ikumi Keita <ik...@ikumi.que.jp>
Commit: Ikumi Keita <ik...@ikumi.que.jp>

    Fix "Honor file local variables" (bug#65750)
    
    * latex.el (TeX-latex-mode): Keep `LaTeX-paragraph-commands-regexp' in
    sync with `LaTeX-paragraph-commands' so that setting
    `LaTeX-paragraph-commands' in the file local variables works as
    expected.
    Fix typo in comment.
    * context.el (ConTeXt-mode-common-initialization): Defer setting
    `LaTeX-paragraph-commands-regexp' after `run-mode-hook' as well.
---
 context.el | 11 +++++++----
 latex.el   |  8 +++++++-
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/context.el b/context.el
index 7920b6d3..173fbf5c 100644
--- a/context.el
+++ b/context.el
@@ -1858,8 +1858,9 @@ that is, you do _not_ have to cater for this yourself by 
adding \\\\\\=' or $."
 
   ;; Paragraph formatting
   (set (make-local-variable 'LaTeX-syntactic-comments) nil)
-  (set (make-local-variable 'LaTeX-paragraph-commands-regexp)
-       (ConTeXt-paragraph-commands-regexp))
+  ;; Moved after `run-mode-hooks'. (bug#65750)
+  ;; (set (make-local-variable 'LaTeX-paragraph-commands-regexp)
+  ;;      (ConTeXt-paragraph-commands-regexp))
   (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)
@@ -1917,8 +1918,10 @@ that is, you do _not_ have to cater for this yourself by 
adding \\\\\\=' or $."
                    (mapconcat #'identity ConTeXt-item-list "\\|")
                    "\\)\\>")))
 
-  ;; Don't do locally-bound test for `paragraph-start'.  See comments
-  ;; in similar part in latex.el.
+  ;; Don't do locally-bound test for `LaTeX-paragraph-commands-regexp'
+  ;; and `paragraph-start'.  See comments in similar part in latex.el.
+  (setq-local LaTeX-paragraph-commands-regexp
+              (ConTeXt-paragraph-commands-regexp))
   (setq paragraph-start
         (concat
          "[ \t]*\\("
diff --git a/latex.el b/latex.el
index da2eaac6..548b18a9 100644
--- a/latex.el
+++ b/latex.el
@@ -8009,7 +8009,7 @@ of `LaTeX-mode-hook'."
   (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.
+  ;; (directory) local variables.
   (or (local-variable-p 'outline-regexp)
       (setq-local outline-regexp (LaTeX-outline-regexp t)))
   (or (local-variable-p 'outline-heading-alist)
@@ -8018,6 +8018,12 @@ of `LaTeX-mode-hook'."
                       (cons (concat "\\" (nth 0 x)) (nth 1 x)))
                     LaTeX-section-list)))
 
+  ;; Keep `LaTeX-paragraph-commands-regexp' in sync with
+  ;; `LaTeX-paragraph-commands' in case the latter is updated by
+  ;; hooks or file (directory) local variables.
+  (and (local-variable-p 'LaTeX-paragraph-commands)
+       (setq-local LaTeX-paragraph-commands-regexp
+                   (LaTeX-paragraph-commands-regexp-make)))
   ;; 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

Reply via email to