unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24749: Making sure syntax-propertize is called
@ 2016-10-20 21:14 Stefan Monnier
  2016-10-20 22:31 ` Dmitry Gutov
                   ` (3 more replies)
  0 siblings, 4 replies; 22+ messages in thread
From: Stefan Monnier @ 2016-10-20 21:14 UTC (permalink / raw)
  To: 24749

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.






^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2019-06-05 13:32 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-20 21:14 bug#24749: Making sure syntax-propertize is called Stefan Monnier
2016-10-20 22:31 ` Dmitry Gutov
2016-10-20 23:12   ` Stefan Monnier
2016-10-21 15:58     ` Dmitry Gutov
2016-10-21  6:56 ` Eli Zaretskii
2016-10-21 15:36   ` Stefan Monnier
2016-10-21 16:02     ` Eli Zaretskii
2016-10-21 16:34       ` Stefan Monnier
2016-10-21 17:27         ` Eli Zaretskii
2017-12-12  2:03           ` Noam Postavsky
2017-12-12 14:12             ` Stefan Monnier
     [not found] ` <handler.24749.D24749.151308794732170.notifdone@debbugs.gnu.org>
2017-12-12 17:54   ` bug#24749: closed (Re: bug#24749: Making sure syntax-propertize is called) Tassilo Horn
2017-12-12 19:45     ` Stefan Monnier
     [not found]     ` <jwv4lovu3xj.fsf-monnier+emacs@gnu.org>
2017-12-13  8:50       ` martin rudalics
     [not found] ` <87ef4awyb6.fsf@gmail.com>
     [not found]   ` <jwvblzewpgj.fsf-monnier+emacs@gnu.org>
2019-06-03 17:47     ` bug#24749: Making sure syntax-propertize is called Stefan Monnier
2019-06-03 19:25       ` Vitalie Spinu
2019-06-03 19:45         ` Stefan Monnier
2019-06-03 20:04           ` npostavs
2019-06-04  5:49           ` Vitalie Spinu
2019-06-04 13:08             ` Stefan Monnier
2019-06-05  5:25               ` Vitalie Spinu
2019-06-05 13:32                 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).