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: Fri, 07 Apr 2023 19:37:51 +0300 Organization: LINKOV.NET Message-ID: <86h6tr4pi8.fsf@mail.linkov.net> References: <864jpsrgaz.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39660"; 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 To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 07 18:43:31 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 1pkpBT-000A9K-3u for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 07 Apr 2023 18:43:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pkpB5-0006DS-Fz; Fri, 07 Apr 2023 12:43:07 -0400 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 1pkpB3-0006Co-Pw for bug-gnu-emacs@gnu.org; Fri, 07 Apr 2023 12:43:05 -0400 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 1pkpB0-0005Qa-Fx for bug-gnu-emacs@gnu.org; Fri, 07 Apr 2023 12:43:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pkpAz-0000Yn-Rl for bug-gnu-emacs@gnu.org; Fri, 07 Apr 2023 12:43:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Apr 2023 16:43: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.16808857252082 (code B ref 62700); Fri, 07 Apr 2023 16:43:01 +0000 Original-Received: (at 62700) by debbugs.gnu.org; 7 Apr 2023 16:42:05 +0000 Original-Received: from localhost ([127.0.0.1]:57144 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pkpA4-0000XV-R0 for submit@debbugs.gnu.org; Fri, 07 Apr 2023 12:42:05 -0400 Original-Received: from relay11.mail.gandi.net ([217.70.178.231]:38875) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pkpA0-0000Wx-HA for 62700@debbugs.gnu.org; Fri, 07 Apr 2023 12:42:04 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 26AC6100003; Fri, 7 Apr 2023 16:41:52 +0000 (UTC) In-Reply-To: (Spencer Baugh's message of "Thu, 06 Apr 2023 15:22:49 -0400") 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:259432 Archived-At: >> I agree that it would be nice to fix this in Emacs 29. >> But the problem is that this would require non-trivial changes. >> We need to apply a small part of the patch mentioned in >> bug#47711, bug#48356, bug#48841, bug#60313 and located at >> https://lists.gnu.org/archive/html/emacs-devel/2021-08/msg00412.html >> that implements the following FIXME item in 'completion-all-completions': > > Any updates on the status of this patch? I see you asked the same thing > a year ago in one of those bugs. A year ago I had a clear understanding how to do this but unfortunately now forgot the details. The idea was to return from completion-all-completions not only '("string" . number) where number is the start of the completion position, but something like '("string" . (number1 number2)) where the second number is the end of the completion position. completion-all-completions is called from minibuffer-completion-help. Then the second number could help to set the right base-suffix in (setq-local completion-base-affixes (list base-prefix base-suffix)) This base-suffix is used later by M- and M-. When here base-suffix is "", then your test case will be fixed. However, non-empty base-suffix is necessary in other cases such as mentioned in bug#48356: ~/emacs/master/li|/calc > I can try to prepare a more minimal version of this patch, just targeted > at adding the ability to return the end of the completion position. > > Do you have any advice on an appropriate API for that? An alist as in > that patch seems reasonable to me, but perhaps there's an even simpler > approach? Changing the API will definitely cause problems with backwards-compatibility. But maybe you could find a simple heuristic that would decide what base-suffix to set in minibuffer-completion-help? Then no API changes will be needed.