From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh 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: Thu, 20 Apr 2023 12:52:20 -0400 Message-ID: References: <8635574n10.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="3068"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 62700@debbugs.gnu.org, Spencer Baugh To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 20 18:53:19 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 1ppXX5-0000c4-K6 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 20 Apr 2023 18:53:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppXWp-00067y-RU; Thu, 20 Apr 2023 12:53:03 -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 1ppXWo-00067Y-L6 for bug-gnu-emacs@gnu.org; Thu, 20 Apr 2023 12:53:02 -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 1ppXWo-0004c0-6o for bug-gnu-emacs@gnu.org; Thu, 20 Apr 2023 12:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ppXWn-0005PB-RC for bug-gnu-emacs@gnu.org; Thu, 20 Apr 2023 12:53:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Apr 2023 16:53: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.168200954920740 (code B ref 62700); Thu, 20 Apr 2023 16:53:01 +0000 Original-Received: (at 62700) by debbugs.gnu.org; 20 Apr 2023 16:52:29 +0000 Original-Received: from localhost ([127.0.0.1]:38607 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ppXWH-0005OR-H0 for submit@debbugs.gnu.org; Thu, 20 Apr 2023 12:52:29 -0400 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:41853) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ppXWE-0005OC-Eh for 62700@debbugs.gnu.org; Thu, 20 Apr 2023 12:52:27 -0400 In-Reply-To: <8635574n10.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 10 Apr 2023 21:20:27 +0300") 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:260348 Archived-At: Juri Linkov writes: >>> It just needs more testing for different categories of completion. >> >> Which categories do you have in mind? > > Actually, I can't find categories where it could fail. > So your patch looks safe to push. Can we go ahead and push it to Emacs master, then? I will work on the changing-only-new-code backport for Emacs 29 as Eli requested. >>> Maybe you could find another heuristic for insertion of completion? >>> The code is located in the same function 'minibuffer-completion-help': >>> >>> (if (and (stringp start) (stringp end)) >>> (progn >>> (delete-minibuffer-contents) >>> (insert start choice) >>> ;; Keep point after completion before suffix >>> (save-excursion (insert end))) >>> >>> Currently it keeps point before the suffix. >> >> I will try. Although this is a case where completion-base-position feels >> more suited than completion-base-affixes... > > Can you get the same info about positions by calculating the > lengths of prefix/choice/suffix? Hm I have thought about it but I can't see a simple heuristic. It's not actually clear what behavior we want, anyway. When TAB completes a string fully, it sends point to the end of the buffer. This happens even if completion-cycle-threshold is non-nil, and completion-cycle-threashold feels like a pretty similar feature to minibuffer-{previous,next}-completion. So maybe that's correct for us to do here too? But a different behavior feels like it could also makes sense. For example, if I'm completing from ffap-|-path (| is point), I'm just cycling between ffap-bib-path, ffap-c++-path, ffap-c-path, and it feels like as I cycle through those, point should stay right before "-path", like ffap-bib|-path, ffap-c++|-path, ffap-c|-path. No idea how to achieve this behavior though. Anyway, the behavior with my earlier patch now feels fine to me, I don't think we need any improvements to point's behavior for now.