From a1abf73c7642339c111646afed1d5d05ecada9c7 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Wed, 4 Mar 2020 19:50:38 +0000 Subject: [PATCH] Fix combine-change-calls-1 for when buffer-undo-list is t * lisp/subr.c (combine-change-calls-1): Bind before/after-change-functions to nil also when buffer-undo-list is t. --- lisp/subr.el | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index c1c4cad18d1..5b94343e499 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3959,19 +3959,18 @@ the function `undo--wrap-and-run-primitive-undo'." (let ((undo--combining-change-calls t)) (if (not inhibit-modification-hooks) (run-hook-with-args 'before-change-functions beg end)) - (if (eq buffer-undo-list t) - (setq result (funcall body)) - (let (;; (inhibit-modification-hooks t) - (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 + (let (;; (inhibit-modification-hooks t) + (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))) + (when (not (eq buffer-undo-list t)) + (let ((ap-elt (list 'apply (- end end-marker) beg -- 2.39.2