From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#61535: 29.0.60; choose-completion erases in-region buffer Date: Sat, 18 Feb 2023 21:30:37 +0200 Message-ID: <83r0umydnm.fsf@gnu.org> 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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26165"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61535@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 18 20:31: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 1pTSvb-0006fO-7c for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Feb 2023 20:31:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pTSvM-00034m-2c; Sat, 18 Feb 2023 14:31:08 -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 1pTSvJ-00034K-G4 for bug-gnu-emacs@gnu.org; Sat, 18 Feb 2023 14:31:05 -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 1pTSvG-0002xF-0L for bug-gnu-emacs@gnu.org; Sat, 18 Feb 2023 14:31:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pTSvF-00088D-ME for bug-gnu-emacs@gnu.org; Sat, 18 Feb 2023 14:31:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Feb 2023 19:31:01 +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.167674864431216 (code B ref 61535); Sat, 18 Feb 2023 19:31:01 +0000 Original-Received: (at 61535) by debbugs.gnu.org; 18 Feb 2023 19:30:44 +0000 Original-Received: from localhost ([127.0.0.1]:44989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTSux-00087O-Hz for submit@debbugs.gnu.org; Sat, 18 Feb 2023 14:30:43 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51626) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTSuv-000878-Ob for 61535@debbugs.gnu.org; Sat, 18 Feb 2023 14:30:42 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pTSuq-0002pp-45; Sat, 18 Feb 2023 14:30:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=wViLbtfM2X14K/7kZ+A0Xhreyj/kORWB/ja5tRh1h+g=; b=j6WrkyAsri0h 1CbHQKOBBLiEg1t6KK8cxB5LjKEl6JoVF4JAtq0GVtFoqKfCwCW7bXqQPn/QRxwZA7IebOjc9lE1f /JUDkyPWaRPVgnjLDGV2JrSqejUZwd88EmWJWlH2IPuvkYTnuVQ/iyfhPwDhKZLcYN2yjoglkyvet 84eMjaH3rTUgZH+iMg+cCIEcO/xhJFQnjlYTTPSCLUSoqo+l79zGLaIA1nFrMCNWkI2ipdOyoK8dO WTCdUc14dSsMuBHcDtFBvQVRxa+OzvjonI7QKYf5B0mFa7OSbMgttjriq3Bu11W5yBLEoEM0PoxQd QsoSzCAozPhPJGo4o0n54A==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pTSun-0001BP-FO; Sat, 18 Feb 2023 14:30:35 -0500 In-Reply-To: <86h6vilsqe.fsf@mail.linkov.net> (message from Juri Linkov on Sat, 18 Feb 2023 20:43:21 +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:255990 Archived-At: > From: Juri Linkov > Cc: 61535@debbugs.gnu.org > Date: Sat, 18 Feb 2023 20:43:21 +0200 > > >> >> >> 1. type: (with-c C-M-i > >> >> >> 2. type: M-down ... M-RET > >> > >> Actually, this is not an old problem. It's in a new feature added in 29.1. > > > > Hmmm... I don't think I see that. Both completion-in-region-mode and > > the condition at that place haven't changed in a while. The addition > > of completion-use-base-affixes part is new, but since it's via 'and', > > it cannot have changed what the code before did, only cause it to do > > that in fewer cases. What am I missing? > > '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'. > > >> And this patch fixes the new feature. This is different from a similar > >> problem fixed now in bug#61479 that is really an old problem. > > > > This is all undecipherable for me, sorry. What is that "new feature", > > and how is it fixed here? > > New feature is 'M-RET', 'minibuffer-choose-completion', > 'completion-use-base-affixes'. What is fixed here > is their interaction. 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? 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?