mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 05:23:04 +00:00
Don't clobber match data in modification hooks
Since modification hooks run just after any function that changes buffer contents, it's important to save the match data, or else the code doing the modification can become really confused. See also Emacs bugs #23917 and #23869. * yasnippet.el (yas--on-field-overlay-modification): Wrap main body in `save-match-data'.
This commit is contained in:
parent
7661dc161d
commit
0db65ee0bb
@ -3416,6 +3416,7 @@ field start. This hook does nothing if an undo is in progress."
|
||||
(let* ((inhibit-modification-hooks t)
|
||||
(field (overlay-get overlay 'yas--field))
|
||||
(snippet (overlay-get yas--active-field-overlay 'yas--snippet)))
|
||||
(save-match-data
|
||||
(when (yas--skip-and-clear-field-p field beg end length)
|
||||
;; We delete text starting from the END of insertion.
|
||||
(yas--skip-and-clear field end))
|
||||
@ -3423,7 +3424,7 @@ field start. This hook does nothing if an undo is in progress."
|
||||
(yas--advance-end-maybe field (overlay-end overlay))
|
||||
(save-excursion
|
||||
(yas--field-update-display field))
|
||||
(yas--update-mirrors snippet))))
|
||||
(yas--update-mirrors snippet)))))
|
||||
|
||||
;;; Apropos protection overlays:
|
||||
;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user