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: Sat, 08 Apr 2023 21:30:39 +0300 Organization: LINKOV.NET Message-ID: <864jpqdwrs.fsf@mail.linkov.net> References: <864jpsrgaz.fsf@mail.linkov.net> <86h6tr4pi8.fsf@mail.linkov.net> <87sfdbmmmh.fsf@catern.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34395"; 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, Spencer Baugh To: sbaugh@catern.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 08 21:04:25 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 1plDrM-0008k6-La for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 08 Apr 2023 21:04:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1plDr2-0000E7-Cd; Sat, 08 Apr 2023 15:04:04 -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 1plDr0-000064-KY for bug-gnu-emacs@gnu.org; Sat, 08 Apr 2023 15:04: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 1plDr0-0001Hz-C6 for bug-gnu-emacs@gnu.org; Sat, 08 Apr 2023 15:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1plDqz-0007Kp-QJ for bug-gnu-emacs@gnu.org; Sat, 08 Apr 2023 15:04: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: Sat, 08 Apr 2023 19:04: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.168098060228129 (code B ref 62700); Sat, 08 Apr 2023 19:04:01 +0000 Original-Received: (at 62700) by debbugs.gnu.org; 8 Apr 2023 19:03:22 +0000 Original-Received: from localhost ([127.0.0.1]:59538 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plDqL-0007Jd-O1 for submit@debbugs.gnu.org; Sat, 08 Apr 2023 15:03:22 -0400 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:50979) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plDqJ-0007JK-1r for 62700@debbugs.gnu.org; Sat, 08 Apr 2023 15:03:19 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 772F61BF207; Sat, 8 Apr 2023 19:03:10 +0000 (UTC) In-Reply-To: <87sfdbmmmh.fsf@catern.com> (sbaugh@catern.com's message of "Fri, 07 Apr 2023 21:02:47 +0000 (UTC)") 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:259491 Archived-At: > Here's one heuristic which works decently well: > > The reasoning here is that if completion returns the full string which > should be in the minibuffer, then we should replace the minibuffer with > that string, so base-suffix should be "". But if we're completing only > part of the string, base-suffix should be something else. AFAIK only > file completion falls into the latter category, and it always completes > just one component of a path, so I set base-suffix to not include the > component of the path that point is in, so that completion replaces it > entirely. > > I think this is basically a satisfactory heuristic, although I'm sure > I'm missing some categories of completion besides file completion which > complete only part of the string. Thanks, this looks like a satisfactory heuristic indeed. It just needs more testing for different categories of completion. > Regardless of whether this is a satisfactory heuristic, it's revealed to > me an unexpected behavior of a solution to this bug using base-suffix, > which may or may not be fine: Point is moved to the end of the > completion inserted. > > So e.g. if point is at | and I'm completing |-path, then when I choose > the completion load-path, point will be at load-path| rather than > load|-path. This isn't a huge issue but it might be a little annoying? > I don't know if there's any way to fix this. 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.