combine-change-calls-1: Fix case where body
also changes other bufs
* lisp/subr.el (combine-change-calls-1): Only set the current buffer's part of the `*-change-functions` hooks.
This commit is contained in:
parent
bb76ab015a
commit
c99815fffa
1 changed files with 20 additions and 10 deletions
30
lisp/subr.el
30
lisp/subr.el
|
@ -4823,16 +4823,26 @@ 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))
|
||||
(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 triggering
|
||||
;; 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 ((bcf before-change-functions)
|
||||
(acf after-change-functions)
|
||||
(local-bcf (local-variable-p 'before-change-functions))
|
||||
(local-acf (local-variable-p 'after-change-functions)))
|
||||
(unwind-protect
|
||||
;; FIXME: WIBNI we could just use `inhibit-modification-hooks'?
|
||||
(progn
|
||||
;; Ugly Hack: if the body uses syntax-ppss/syntax-propertize
|
||||
;; (e.g. via a regexp-search or sexp-movement triggering
|
||||
;; on-the-fly syntax-propertize), make sure that this gets
|
||||
;; properly refreshed after subsequent changes.
|
||||
(setq-local before-change-functions
|
||||
(if (memq #'syntax-ppss-flush-cache bcf)
|
||||
'(syntax-ppss-flush-cache)))
|
||||
(setq-local after-change-functions nil)
|
||||
(setq result (funcall body)))
|
||||
(if local-bcf (setq before-change-functions bcf)
|
||||
(kill-local-variable 'before-change-functions))
|
||||
(if local-acf (setq after-change-functions acf)
|
||||
(kill-local-variable 'after-change-functions))))
|
||||
(when (not (eq buffer-undo-list t))
|
||||
(let ((ap-elt
|
||||
(list 'apply
|
||||
|
|
Loading…
Add table
Reference in a new issue