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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/yasnippet 9f253badfb 2/2: yasnippet.el: Work around Ema


From: ELPA Syncer
Subject: [elpa] externals/yasnippet 9f253badfb 2/2: yasnippet.el: Work around Emacs bug#65929 (see also issue#1175)
Date: Wed, 17 Jan 2024 15:59:19 -0500 (EST)

branch: externals/yasnippet
commit 9f253badfb21b88d83680535e7fab252332b060b
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    yasnippet.el: Work around Emacs bug#65929 (see also issue#1175)
    
    (yas--on-protection-overlay-modification): Ignore clearly bogus calls.
    (yas-keymap-disable-hook): Improve docstring.
---
 yasnippet-tests.el |  2 +-
 yasnippet.el       | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index c096c7356d..3e31dc9c04 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -1,6 +1,6 @@
 ;;; yasnippet-tests.el --- some yasnippet tests  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2012-2023  Free Software Foundation, Inc.
+;; Copyright (C) 2012-2024  Free Software Foundation, Inc.
 
 ;; Author: João Távora <joaot@siscog.pt>
 ;; Keywords: emulations, convenience
diff --git a/yasnippet.el b/yasnippet.el
index 0d9166a687..63ebfe0754 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -554,9 +554,12 @@ conditions.
     sexp))
 
 (defcustom yas-keymap-disable-hook nil
-  "The `yas-keymap' bindings are disabled if any function in this list returns 
non-nil.
+  "Abnormal hook run to decide when `yas-keymap' bindings are enabled.
+The bindings are disabled whenever any function in this list returns non-nil.
 This is useful to control whether snippet navigation bindings
-override bindings from other packages (e.g., `company-mode')."
+override bindings from other packages (e.g., `company-mode').
+This is run (several times) every time we perform a key lookup, so
+it has to be fast."
   :type 'hook)
 
 (defcustom yas-overlay-priority 100
@@ -3938,12 +3941,13 @@ Move the overlays, or create them if they do not exit."
              ;; (overlay-put ov 'evaporate t)
              (overlay-put ov 'modification-hooks 
'(yas--on-protection-overlay-modification)))))))
 
-(defun yas--on-protection-overlay-modification (_overlay after? beg end 
&optional length)
+(defun yas--on-protection-overlay-modification (overlay after? beg end 
&optional length)
   "Commit the snippet if the protection overlay is being killed."
   (unless (or yas--inhibit-overlay-hooks
               yas-inhibit-overlay-modification-protection
               (not after?)
               (= length (- end beg)) ; deletion or insertion
+              (>= beg (overlay-start overlay)) ;Emacs=29.1 bug#65929
               (yas--undo-in-progress))
     (let ((snippets (yas-active-snippets)))
       (yas--message 2 "Committing snippets. Action would destroy a protection 
overlay.")



reply via email to

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