From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#48478: 28.0.50; yank-from-kill-ring and kill-ring-yank-pointer Date: Tue, 18 May 2021 00:10:57 +0300 Organization: LINKOV.NET Message-ID: <874kf1yq92.fsf@mail.linkov.net> References: <83h7j1twym.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34236"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 48478@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 18 00:31:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lillY-0008m8-4J for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 18 May 2021 00:31:12 +0200 Original-Received: from localhost ([::1]:48146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lillX-00014n-1e for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 17 May 2021 18:31:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lillO-00013j-UL for bug-gnu-emacs@gnu.org; Mon, 17 May 2021 18:31:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42442) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lillO-00065R-Kz for bug-gnu-emacs@gnu.org; Mon, 17 May 2021 18:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lillO-0003o0-Hv for bug-gnu-emacs@gnu.org; Mon, 17 May 2021 18:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 17 May 2021 22:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48478 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.162129061514563 (code B ref -1); Mon, 17 May 2021 22:31:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 May 2021 22:30:15 +0000 Original-Received: from localhost ([127.0.0.1]:53985 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lilkc-0003mo-So for submit@debbugs.gnu.org; Mon, 17 May 2021 18:30:15 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:49520) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lilkY-0003mT-QJ for submit@debbugs.gnu.org; Mon, 17 May 2021 18:30:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34252) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lilkY-0000pJ-20 for bug-gnu-emacs@gnu.org; Mon, 17 May 2021 18:30:10 -0400 Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:43353) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lilkV-0005NK-Sy; Mon, 17 May 2021 18:30:09 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 7FBA11C0002; Mon, 17 May 2021 22:30:02 +0000 (UTC) In-Reply-To: <83h7j1twym.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 17 May 2021 14:34:57 +0300") Received-SPF: pass client-ip=217.70.183.197; envelope-from=juri@linkov.net; helo=relay5-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:206749 Archived-At: --=-=-= Content-Type: text/plain > 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=read-from-kill-ring-prompt.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) --=-=-=--