emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 3320fe2: * lisp/subr.el (combine-change-calls-1): D


From: Stefan Monnier
Subject: [Emacs-diffs] master 3320fe2: * lisp/subr.el (combine-change-calls-1): Don't combine syntax-ppss flushes
Date: Sat, 16 Mar 2019 20:11:52 -0400 (EDT)

branch: master
commit 3320fe2deeba6dcc40e934e8a03bef4945c86aff
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * lisp/subr.el (combine-change-calls-1): Don't combine syntax-ppss flushes
---
 lisp/emacs-lisp/syntax.el |  5 +++++
 lisp/subr.el              | 11 +++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index 11cab1d..d09d6c1 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -533,6 +533,11 @@ running the hook."
 
              ;; Setup the before-change function if necessary.
              (unless (or ppss-cache ppss-last)
+                ;; We should be either the very last function on
+                ;; before-change-functions or the very first on
+                ;; after-change-functions.
+                ;; Note: combine-change-calls-1 needs to be kept in sync
+                ;; with this!
                (add-hook 'before-change-functions
                          'syntax-ppss-flush-cache t t))
 
diff --git a/lisp/subr.el b/lisp/subr.el
index 4024c68..6c0ad00 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3686,7 +3686,7 @@ the specified region.  It must not change
 `before-change-functions' or `after-change-functions'.
 
 Additionally, the buffer modifications of BODY are recorded on
-the buffer's undo list as a single \(apply ...) entry containing
+the buffer's undo list as a single (apply ...) entry containing
 the function `undo--wrap-and-run-primitive-undo'."
   (let ((old-bul buffer-undo-list)
        (end-marker (copy-marker end t))
@@ -3699,7 +3699,14 @@ the function `undo--wrap-and-run-primitive-undo'."
        (if (eq buffer-undo-list t)
            (setq result (funcall body))
          (let (;; (inhibit-modification-hooks t)
-                before-change-functions after-change-functions)
+                (before-change-functions
+                 ;; Ugly Hack: if the body uses syntax-ppss/syntax-propertize
+                 ;; (e.g. via a regexp-search or sexp-movement trigerring
+                 ;; on-the-fly syntax-propertize), make sure that this gets
+                 ;; properly refreshed after subsequent changes.
+                 (if (memq #'syntax-ppss-flush-cache before-change-functions)
+                     '(syntax-ppss-flush-cache)))
+                after-change-functions)
            (setq result (funcall body)))
          (let ((ap-elt
                 (list 'apply



reply via email to

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