bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#48478: 28.0.50; yank-from-kill-ring and kill-ring-yank-pointer


From: Juri Linkov
Subject: bug#48478: 28.0.50; yank-from-kill-ring and kill-ring-yank-pointer
Date: Sun, 06 Jun 2021 23:52:17 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> I think the conclusion up-thread was that if the entry is edited
> before it's inserted, then the edited entry should be added to the
> head of the kill-ring, and the pointer set there.  IOW, if I edit the
> previous kill and insert it, the edited string becomes the one I get
> on the next C-y.  The discussion concluded that doing this is possible
> without extensive changes, whereas the other alternative is "hard" as
> it goes against the current design and implementation of the functions
> involved in this.  I'm okay with this behavior, and it is easy to
> describe in the manual and easy to remember.

I'm still unsure why the command that only yanks text
should add new text to the kill-ring.  This goes against
the logic of yanking because currently only killing commands
can add text to the kill-ring.  So it would be very strange
to call 'kill-new' from 'yank-from-kill-ring':

diff --git a/lisp/simple.el b/lisp/simple.el
index 9e827320f1..1aa720edba 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5781,8 +5781,9 @@ yank-from-kill-ring
   (insert-for-yank string)
   (when yank-from-kill-ring-rotate
     (let ((pos (seq-position kill-ring string)))
-      (when pos
-        (setq kill-ring-yank-pointer (nthcdr pos kill-ring)))))
+      (if pos
+          (setq kill-ring-yank-pointer (nthcdr pos kill-ring))
+        (kill-new string))))
   (if (consp arg)
       ;; Swap point and mark like in `yank' and `yank-pop'.
       (goto-char (prog1 (mark t)





reply via email to

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