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#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer Date: Tue, 14 Nov 2023 09:39:49 +0200 Organization: LINKOV.NET Message-ID: <86ttpoizeq.fsf@mail.linkov.net> References: <8635574n10.fsf@mail.linkov.net> <868rema032.fsf@mail.linkov.net> <83r0se4bwf.fsf@gnu.org> <87pm7xkqsd.fsf@catern.com> <83jzy419bk.fsf@gnu.org> <874jourckv.fsf@catern.com> <83lei6mxa0.fsf@gnu.org> <86wn1jutxv.fsf@mail.linkov.net> <83zg6eby5t.fsf@gnu.org> <83r0qjzj22.fsf@gnu.org> <86h6rccz9c.fsf@mail.linkov.net> <83v8fsw0r9.fsf@gnu.org> <86v8fruwur.fsf@mail.linkov.net> <83352vwb6v.fsf@gnu.org> <86edjfyx84.fsf@mail.linkov.net> 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="20052"; 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: 62700@debbugs.gnu.org, sbaugh@catern.com To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 14 08:44:01 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 1r2o5Y-00051m-IB for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 Nov 2023 08:44:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2o51-0007aX-4N; Tue, 14 Nov 2023 02:43:27 -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 1r2o4u-0007MB-7y for bug-gnu-emacs@gnu.org; Tue, 14 Nov 2023 02:43:23 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r2o4t-0003nq-Vs for bug-gnu-emacs@gnu.org; Tue, 14 Nov 2023 02:43:20 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r2o5Z-0003rU-K0 for bug-gnu-emacs@gnu.org; Tue, 14 Nov 2023 02:44:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 Nov 2023 07:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62700 X-GNU-PR-Package: emacs Original-Received: via spool by 62700-submit@debbugs.gnu.org id=B62700.169994781914806 (code B ref 62700); Tue, 14 Nov 2023 07:44:01 +0000 Original-Received: (at 62700) by debbugs.gnu.org; 14 Nov 2023 07:43:39 +0000 Original-Received: from localhost ([127.0.0.1]:59979 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2o5C-0003qj-TJ for submit@debbugs.gnu.org; Tue, 14 Nov 2023 02:43:39 -0500 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:53859) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2o55-0003qG-VD for 62700@debbugs.gnu.org; Tue, 14 Nov 2023 02:43:38 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 19FA91BF208; Tue, 14 Nov 2023 07:42:41 +0000 (UTC) In-Reply-To: <86edjfyx84.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 03 Sep 2023 20:37:15 +0300") X-GND-Sasl: juri@linkov.net 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:274299 Archived-At: --=-=-= Content-Type: text/plain > For example, with (setq completion-use-base-affixes t) > if there is some text in the current buffer after point, > then typing 'M-C-i' and selecting a candidate to insert to the buffer, > it replaces all the text after point with an empty string. > > Before this change, the suffix was set to the text after point, > and after inserting the selected candidate the suffix was > re-inserted to the same buffer. Here is a patch that should support 'completion-in-region': --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=minibuffer-completion-help-base-suffix.patch diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 07a284134d6..a2d0fabd9c5 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2405,9 +2410,14 @@ minibuffer-completion-help (base-prefix (buffer-substring (minibuffer--completion-prompt-end) (+ start base-size))) (base-suffix - (if (eq (alist-get 'category (cdr md)) 'file) - (buffer-substring (save-excursion (or (search-forward "/" nil t) (point-max))) - (point-max)) + (if (or (eq (alist-get 'category (cdr md)) 'file) + completion-in-region-mode-predicate) + (buffer-substring + (save-excursion + (if completion-in-region-mode-predicate + (point) + (or (search-forward "/" nil t) (point-max)))) + (point-max)) "")) (all-md (completion--metadata (buffer-substring-no-properties start (point)) --=-=-=--