emacs-elpa-diffs
[Top][All Lists]
Advanced

[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))



reply via email to

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