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

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

[elpa] externals/ivy-hydra a33af9b 356/395: Unset yank-undo-function in


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra a33af9b 356/395: Unset yank-undo-function in counsel-yank-pop
Date: Thu, 25 Feb 2021 08:32:37 -0500 (EST)

branch: externals/ivy-hydra
commit a33af9bfef82d4ab735728a30e91e8563224c5f8
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    Unset yank-undo-function in counsel-yank-pop
    
    * counsel.el (counsel-yank-pop-action): Unset yank-undo-function
    before calling yank-pop, to avoid deleting the region when
    yank-undo-function is set but the last command was not really a
    yank.  Suggested by Gustavo Barros.
    
    Fixes #2714.
---
 counsel.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/counsel.el b/counsel.el
index db0e612..b762b1a 100644
--- a/counsel.el
+++ b/counsel.el
@@ -4432,13 +4432,18 @@ Signal a `buffer-read-only' error if called from a 
read-only
 buffer position."
   (with-ivy-window
     (barf-if-buffer-read-only)
-    (setq last-command 'yank)
     (setq yank-window-start (window-start))
+    (unless (eq last-command 'yank)
+      ;; Avoid unexpected deletions with `yank-handler' properties.
+      (setq yank-undo-function nil))
     (condition-case nil
-        ;; Avoid unexpected additions to `kill-ring'
-        (let (interprogram-paste-function)
+        (let (;; Deceive `yank-pop'.
+              (last-command 'yank)
+              ;; Avoid unexpected additions to `kill-ring'.
+              interprogram-paste-function)
           (yank-pop (counsel--yank-pop-position s)))
       (error
+       ;; Support strings not present in the kill ring.
        (insert s)))
     (when (funcall (if counsel-yank-pop-after-point #'> #'<)
                    (point) (mark t))



reply via email to

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