From: Stefan Monnier Date: Tue, 12 Dec 2017 14:11:17 +0000 (-0500) Subject: * lisp/subr.el (run-mode-hooks): Set parse-sexp-lookup-properties X-Git-Tag: emacs-27.0.90~6047 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=489d6466372f488adc53897435fff290394b62f7;p=emacs.git * 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. --- diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 1f86909362e..3d3ea079cff 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 2a867bb3655..bebb1bcba94 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 bf51c934cff..8468255ad2f 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 09da155f487..3e37edefb71 100644 --- a/lisp/textmodes/mhtml-mode.el +++ b/lisp/textmodes/mhtml-mode.el @@ -366,7 +366,6 @@ Code inside a