[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/yasnippet d3d6d70 7/8: Correct manual call to after-cha
From: |
Stefan Monnier |
Subject: |
[elpa] externals/yasnippet d3d6d70 7/8: Correct manual call to after-change-functions |
Date: |
Mon, 15 Mar 2021 22:25:53 -0400 (EDT) |
branch: externals/yasnippet
commit d3d6d70b1cd4818d271752468e0fdb0788db750d
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Correct manual call to after-change-functions
The pre-change-len argument passed to each element of
after-change-fucntions must reflect the length of the affected region
before the change happened.
In Yasnippet's case, the change enacted in yas--snippet-create is the
replacement of a region (which is almost always of length 0) with a
ready-to-navigate snippet template. The previous implementation
calculated the length of the affected region after that change
happened, which is wrong.
See https://github.com/joaotavora/eglot/issues/462 for a case where
this mattered.
* yasnippet.el (yas--snippet-create): Correct manual call to
after-change-functions.
---
yasnippet.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/yasnippet.el b/yasnippet.el
index ac25669..fe29fc9 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -4188,7 +4188,7 @@ Returns the newly created snippet."
(yas--snippet-parse-create snippet))
(run-hook-with-args 'after-change-functions
(point-min) (point-max)
- (- (point-max) (point-min))))
+ (- end begin)))
(when (listp buffer-undo-list)
(push (cons (point-min) (point-max))
buffer-undo-list))
- [elpa] externals/yasnippet updated (3bf9a3b -> 5cbdbf0), Stefan Monnier, 2021/03/15
- [elpa] externals/yasnippet 5b1217a 6/8: ; Add some notes about narrowing, font-lock cc-mode issues, Stefan Monnier, 2021/03/15
- [elpa] externals/yasnippet 1cc1996 5/8: Don't bind inhibit-modification-hooks in yas--snippet-create, Stefan Monnier, 2021/03/15
- [elpa] externals/yasnippet d3d6d70 7/8: Correct manual call to after-change-functions,
Stefan Monnier <=
- [elpa] externals/yasnippet 291873e 4/8: ; .travis.yml: Clean up validator warnings/infos, Stefan Monnier, 2021/03/15
- [elpa] externals/yasnippet ac03c2f 1/8: ; Test on Emacs 27, Stefan Monnier, 2021/03/15
- [elpa] externals/yasnippet 170d13d 3/8: Scan nested fields properly, Stefan Monnier, 2021/03/15
- [elpa] externals/yasnippet 7c02bc1 2/8: Fix failure on depth 2+ nested snippets, Stefan Monnier, 2021/03/15
- [elpa] externals/yasnippet 5cbdbf0 8/8: Handle errors during evaluation properly, Stefan Monnier, 2021/03/15