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#61535: 29.0.60; choose-completion erases in-region buffer Date: Sun, 19 Feb 2023 19:31:27 +0200 Organization: LINKOV.NET Message-ID: <86sff1muj4.fsf@mail.linkov.net> References: <86y1oylrap.fsf@mail.linkov.net> <83ilg2afip.fsf@gnu.org> <86edqpebxy.fsf@mail.linkov.net> <83bklt2wz6.fsf@gnu.org> <86bklsem93.fsf@mail.linkov.net> <83mt5c1ydo.fsf@gnu.org> <86h6vilsqe.fsf@mail.linkov.net> <83r0umydnm.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11217"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 61535@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 19 18:34:23 2023 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 1pTnZv-0002lT-Dw for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Feb 2023 18:34:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pTnZd-0005oe-H9; Sun, 19 Feb 2023 12:34:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pTnZb-0005oB-6j for bug-gnu-emacs@gnu.org; Sun, 19 Feb 2023 12:34:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pTnZa-0003Vl-On for bug-gnu-emacs@gnu.org; Sun, 19 Feb 2023 12:34:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pTnZa-0006AI-2K for bug-gnu-emacs@gnu.org; Sun, 19 Feb 2023 12:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Feb 2023 17:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61535 X-GNU-PR-Package: emacs Original-Received: via spool by 61535-submit@debbugs.gnu.org id=B61535.167682799223600 (code B ref 61535); Sun, 19 Feb 2023 17:34:02 +0000 Original-Received: (at 61535) by debbugs.gnu.org; 19 Feb 2023 17:33:12 +0000 Original-Received: from localhost ([127.0.0.1]:49606 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTnYm-00068a-5U for submit@debbugs.gnu.org; Sun, 19 Feb 2023 12:33:12 -0500 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:43195) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTnYj-00068D-U3 for 61535@debbugs.gnu.org; Sun, 19 Feb 2023 12:33:11 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id C09FB1BF203; Sun, 19 Feb 2023 17:33:02 +0000 (UTC) In-Reply-To: <83r0umydnm.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 18 Feb 2023 21:30:37 +0200") 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:256093 Archived-At: >> >> >> >> 1. type: (with-c C-M-i >> >> >> >> 2. type: M-down ... M-RET >> >> 'M-RET' above is new. It's bound to the new function >> 'minibuffer-choose-completion' that let-binds >> 'completion-use-base-affixes' to t that works >> only in the minibuffer, not in 'completion-in-region-mode'. > > Sorry, I'm still confused. The patch you want to install is > > diff --git a/lisp/simple.el b/lisp/simple.el > index c58acfe3adc..1924567cc3f 100644 > --- a/lisp/simple.el > +++ b/lisp/simple.el > @@ -9882,7 +9882,8 @@ choose-completion > (with-current-buffer buffer > (choose-completion-string > choice buffer > - (or (and completion-use-base-affixes base-affixes) > + (or (and (not completion-in-region-mode) > + completion-use-base-affixes base-affixes) > base-position > ;; If all else fails, just guess. > (list (choose-completion-guess-base-position choice))) > > But by default, completion-in-region-mode is t and > completion-use-base-affixes is nil. So this code is never executed in > the recipe you posted, right? M-RET is bound to minibuffer-choose-completion in completion-in-region-mode-map. minibuffer-choose-completion let-binds completion-use-base-affixes to t before calling choose-completion. Therefore completion-use-base-affixes should be ignored in choose-completion for completion-in-region-mode. > Moreover, if I look at buffer-undo-list, I don't think I see there > that the entire buffer text of *scratch* was deleted and recreated. > > So what am I missing, and what is the problem you are trying to fix? Here is the output of 'C-h v buffer-undo-list' after typing M-RET in the *scratch* buffer: buffer-undo-list is a variable defined in ‘C source code’. Its value is shown below. Value: (nil (1 . 166) (#(";; This buffer is for text that is not saved, and for Lisp evaluation. ;; To create a file, visit it with C-x C-f and enter text in its buffer. (with-c" 0 3 ...