[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: |
Tue, 18 May 2021 00:10:57 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
> If one uses "C-y M-y M-y ... C-y", the last C-y will yank the
> same kill-ring entry that the M-y before it. But if one uses
> "M-y M-y ... C-y", the last C-y will yank not the entry produced
> by the last M-y, but the one after it. Which means
> yank-from-kill-ring leaves the kill-ring-yank-pointer at a different
> entry than yank-pop does.
>
> Bug or feature? If the latter, what is the rationale for the
> different operation?
This is an unfinished feature, i.e. currently yank-from-kill-ring
simply has no special handling of kill-ring-yank-pointer.
When I tried to add it, I noticed that it has many possible
variants of implementation, so I stuck with analysis paralysis.
Perhaps we should have a new option with several choices:
1. Don't change kill-ring-yank-pointer (as it does now).
This is useful when the user wants to type a predictable
number of M-p in the minibuffer history to yank the same
previously-killed text from the kill-ring several times.
2. Adjust kill-ring-yank-pointer to point to the selected text.
3. Still unclear how to adjust kill-ring-yank-pointer
when the user selects a previous text
then edits it before yanking.
Regarding 7b82584c69, actually the description of 'M-y' in
(info "(emacs) Isearch Yank") was accurate. It correctly
described the behavior of isearch-yank-pop that activates
the minibuffer. The problem is that after recent controversy,
'M-y' was rebound to the backward-compatible command
isearch-yank-pop-only.
A FIXME from 7b82584c69 is implemented by this patch:
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 095f8ba145..c52718d94a 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2583,7 +2585,7 @@ isearch-yank-from-kill-ring
"Read a string from the `kill-ring' and append it to the search string."
(interactive)
(with-isearch-suspended
- (let ((string (read-from-kill-ring)))
+ (let ((string (read-from-kill-ring "Yank from kill-ring: ")))
(if (and isearch-case-fold-search
(eq 'not-yanks search-upper-case))
(setq string (downcase string)))
diff --git a/lisp/simple.el b/lisp/simple.el
index 90942df0da..08c7c903a8 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5587,7 +5587,8 @@ yank-pop
property, in the way that `yank' does."
(interactive "p")
(if (not (eq last-command 'yank))
- (yank-from-kill-ring (read-from-kill-ring) current-prefix-arg)
+ (yank-from-kill-ring (read-from-kill-ring "Yank from kill-ring: ")
+ current-prefix-arg)
(setq this-command 'yank)
(unless arg (setq arg 1))
(let ((inhibit-read-only t)
@@ -5676,7 +5677,7 @@ rotate-yank-pointer
(current-kill arg))
(defvar read-from-kill-ring-history)
-(defun read-from-kill-ring ()
+(defun read-from-kill-ring (prompt)
"Read a `kill-ring' entry using completion and minibuffer history."
;; `current-kill' updates `kill-ring' with a possible interprogram-paste
(current-kill 0)
@@ -5721,11 +5722,7 @@ read-from-kill-ring
(define-key map "?" nil)
map)))
(completing-read
- ;; FIXME: This prompt is specific to using this function from
- ;; yank-related commands, but the function could be used in
- ;; other contexts. Should the prompt be passed via an
- ;; argument?
- "Yank from kill-ring: "
+ prompt
(lambda (string pred action)
(if (eq action 'metadata)
;; Keep sorted by recency
@@ -5755,7 +5752,8 @@ yank-from-kill-ring
beginning of the inserted text and mark at the end, like `yank' does.
When called from Lisp, insert STRING like `insert-for-yank' does."
- (interactive (list (read-from-kill-ring) current-prefix-arg))
+ (interactive (list (read-from-kill-ring "Yank from kill-ring: ")
+ current-prefix-arg))
(push-mark)
(insert-for-yank string)
(if (consp arg)
- bug#48478: 28.0.50; yank-from-kill-ring and kill-ring-yank-pointer, Eli Zaretskii, 2021/05/17
- bug#48478: 28.0.50; yank-from-kill-ring and kill-ring-yank-pointer, Lars Ingebrigtsen, 2021/05/17
- bug#48478: 28.0.50; yank-from-kill-ring and kill-ring-yank-pointer,
Juri Linkov <=
- bug#48478: 28.0.50; yank-from-kill-ring and kill-ring-yank-pointer, Eli Zaretskii, 2021/05/18
- bug#48478: 28.0.50; yank-from-kill-ring and kill-ring-yank-pointer, Juri Linkov, 2021/05/18
- bug#48478: 28.0.50; yank-from-kill-ring and kill-ring-yank-pointer, Eli Zaretskii, 2021/05/18
- bug#48478: 28.0.50; yank-from-kill-ring and kill-ring-yank-pointer, Juri Linkov, 2021/05/19
- bug#48478: 28.0.50; yank-from-kill-ring and kill-ring-yank-pointer, Eli Zaretskii, 2021/05/20
- bug#48478: 28.0.50; yank-from-kill-ring and kill-ring-yank-pointer, Juri Linkov, 2021/05/20
- bug#48478: 28.0.50; yank-from-kill-ring and kill-ring-yank-pointer, Eli Zaretskii, 2021/05/20
- bug#48478: 28.0.50; yank-from-kill-ring and kill-ring-yank-pointer, Juri Linkov, 2021/05/20
- bug#48478: 28.0.50; yank-from-kill-ring and kill-ring-yank-pointer, Eli Zaretskii, 2021/05/20
- bug#48478: 28.0.50; yank-from-kill-ring and kill-ring-yank-pointer, Juri Linkov, 2021/05/20