[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#24749: Making sure syntax-propertize is called
From: |
Stefan Monnier |
Subject: |
bug#24749: Making sure syntax-propertize is called |
Date: |
Thu, 20 Oct 2016 17:14:40 -0400 |
Package: Emacs
Version: 25.2.50
Nowadays, syntax-propertize is automatically called ondemand by the sexp
functions, but only if parse-sexp-lookup-properties is non-nil.
See bug#4920 for an example of the problem and the fix we installed.
I suggest we install the patch below instead, so as to fix this bug in
more/all major modes at once.
Stefan
diff --git a/lisp/subr.el b/lisp/subr.el
index 8c29395..38bfc5f 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1844,8 +1844,15 @@ run-mode-hooks
(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/progmodes/js.el b/lisp/progmodes/js.el
index f1fa7cb..848e357 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3728,7 +3728,6 @@ js-mode
(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 4cb8886..fd87c1e 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -2214,7 +2214,6 @@ sh-set-shell
(funcall mksym "rules")
:forward-token (funcall mksym "forward-token")
:backward-token (funcall mksym "backward-token")))
- (setq-local parse-sexp-lookup-properties t)
(if sh-make-vars-local
(sh-make-vars-local))
(message "Indentation setup for shell type %s" sh-shell))
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index 9f72659..6982fb9 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -620,7 +620,6 @@ texinfo-mode
(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.
- bug#24749: Making sure syntax-propertize is called,
Stefan Monnier <=