emacs-diffs
[Top][All Lists]
Advanced

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

master 83be3e9: * lisp/simple.el (read-from-kill-ring): Add new arg PROM


From: Juri Linkov
Subject: master 83be3e9: * lisp/simple.el (read-from-kill-ring): Add new arg PROMPT (bug#48478).
Date: Tue, 18 May 2021 16:24:03 -0400 (EDT)

branch: master
commit 83be3e9598530eb77e6bbcc93b2e16934d2606af
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/simple.el (read-from-kill-ring): Add new arg PROMPT (bug#48478).
    
    * lisp/simple.el (yank-pop, yank-from-kill-ring):
    * lisp/isearch.el (isearch-yank-from-kill-ring):
    Use arg PROMPT in the call read-from-kill-ring.
---
 lisp/isearch.el |  2 +-
 lisp/simple.el  | 17 ++++++++---------
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 536c76e..00969e5 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2538,7 +2538,7 @@ If search string is empty, just beep."
   "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 3f211bf..2d9b7dd 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5587,7 +5587,8 @@ This command honors the `yank-handled-properties' and
 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,8 +5677,9 @@ With ARG, rotate that many kills forward (or backward, if 
negative)."
   (current-kill arg))
 
 (defvar read-from-kill-ring-history)
-(defun read-from-kill-ring ()
-  "Read a `kill-ring' entry using completion and minibuffer history."
+(defun read-from-kill-ring (prompt)
+  "Read a `kill-ring' entry using completion and minibuffer history.
+PROMPT is a string to prompt with."
   ;; `current-kill' updates `kill-ring' with a possible interprogram-paste
   (current-kill 0)
   (let* ((history-add-new-input nil)
@@ -5721,11 +5723,7 @@ With ARG, rotate that many kills forward (or backward, 
if negative)."
              (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 +5753,8 @@ With \\[universal-argument] as argument, this command 
puts point at
 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)



reply via email to

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