emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 489d646: * lisp/subr.el (run-mode-hooks): Set parse


From: Stefan Monnier
Subject: [Emacs-diffs] master 489d646: * lisp/subr.el (run-mode-hooks): Set parse-sexp-lookup-properties
Date: Tue, 12 Dec 2017 09:11:24 -0500 (EST)

branch: master
commit 489d6466372f488adc53897435fff290394b62f7
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * lisp/subr.el (run-mode-hooks): Set parse-sexp-lookup-properties
    
    if syntax-propertize-function is set (bug#24749).
    * lisp/progmodes/sh-script.el (sh-set-shell):
    * lisp/textmodes/texinfo.el (texinfo-mode):
    * lisp/textmodes/mhtml-mode.el (mhtml-mode):
    * lisp/progmodes/js.el (js-mode): Don't set parse-sexp-lookup-properties.
---
 lisp/progmodes/js.el         | 1 -
 lisp/progmodes/sh-script.el  | 1 -
 lisp/subr.el                 | 9 ++++++++-
 lisp/textmodes/mhtml-mode.el | 1 -
 lisp/textmodes/texinfo.el    | 1 -
 5 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 1f86909..3d3ea07 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3869,7 +3869,6 @@ If one hasn't been set, or if it's stale, prompt for a 
new one."
   (setq-local prettify-symbols-alist js--prettify-symbols-alist)
 
   (setq-local parse-sexp-ignore-comments t)
-  (setq-local parse-sexp-lookup-properties t)
   (setq-local which-func-imenu-joiner-function #'js--which-func-joiner)
 
   ;; Comments
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 2a867bb..bebb1bc 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -2392,7 +2392,6 @@ whose value is the shell name (don't quote it)."
                       (funcall mksym "rules")
                       :forward-token  (funcall mksym "forward-token")
                       :backward-token (funcall mksym "backward-token")))
-        (setq-local parse-sexp-lookup-properties t)
         (unless sh-use-smie
           (setq-local sh-kw-alist (sh-feature sh-kw))
           (let ((regexp (sh-feature sh-kws-for-done)))
diff --git a/lisp/subr.el b/lisp/subr.el
index bf51c93..8468255 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1876,8 +1876,15 @@ running their FOO-mode-hook."
        (push hook delayed-mode-hooks))
     ;; Normal case, just run the hook as before plus any delayed hooks.
     (setq hooks (nconc (nreverse delayed-mode-hooks) hooks))
+    (and syntax-propertize-function
+         (not (buffer-local-p 'parse-sexp-lookup-properties))
+         ;; `syntax-propertize' sets `parse-sexp-lookup-properties' for us, but
+         ;; in order for the sexp primitives to automatically call
+         ;; `syntax-propertize' we need `parse-sexp-lookup-properties' to be
+         ;; set first.
+         (setq-local parse-sexp-lookup-properties t))
     (setq delayed-mode-hooks nil)
-    (apply 'run-hooks (cons 'change-major-mode-after-body-hook hooks))
+    (apply #'run-hooks (cons 'change-major-mode-after-body-hook hooks))
     (if (buffer-file-name)
         (with-demoted-errors "File local-variables error: %s"
           (hack-local-variables 'no-mode)))
diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el
index 09da155..3e37ede 100644
--- a/lisp/textmodes/mhtml-mode.el
+++ b/lisp/textmodes/mhtml-mode.el
@@ -366,7 +366,6 @@ Code inside a <script> element is indented using the rules 
from
 `js-mode'; and code inside a <style> element is indented using
 the rules from `css-mode'."
   (setq-local indent-line-function #'mhtml-indent-line)
-  (setq-local parse-sexp-lookup-properties t)
   (setq-local syntax-propertize-function #'mhtml-syntax-propertize)
   (setq-local font-lock-fontify-region-function
               #'mhtml--submode-fontify-region)
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index be8bcc5..8070132 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -610,7 +610,6 @@ value of `texinfo-mode-hook'."
   (setq font-lock-defaults
        '(texinfo-font-lock-keywords nil nil nil backward-paragraph))
   (setq-local syntax-propertize-function texinfo-syntax-propertize-function)
-  (setq-local parse-sexp-lookup-properties t)
   (setq-local add-log-current-defun-function #'texinfo-current-defun-name)
 
   ;; Outline settings.



reply via email to

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