From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#48356: 28.0.50; choose-completion discards the suffix after the completion boundary Date: Mon, 08 Apr 2024 19:50:07 -0400 Message-ID: References: <18593691-8b7a-facf-68e1-e9d0c106897b@daniel-mendler.de> <868rtcjqk4.fsf@mail.linkov.net> <949a6c3a-9a59-89dd-bdee-c0ec6ee0baa7@daniel-mendler.de> <86r173odnm.fsf@mail.linkov.net> <868rt42wiz.fsf@mail.linkov.net> <39326c56-094c-4074-95d7-8f92f7f927a5@gutov.dev> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15085"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 48356@debbugs.gnu.org, Daniel Mendler , JD Smith , Juri Linkov To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 09 01:51:26 2024 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 1rtylq-0003i9-Gw for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Apr 2024 01:51:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtylN-00054a-De; Mon, 08 Apr 2024 19:50:57 -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 1rtylL-00054R-OZ for bug-gnu-emacs@gnu.org; Mon, 08 Apr 2024 19:50:55 -0400 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 1rtylK-0004QN-S6 for bug-gnu-emacs@gnu.org; Mon, 08 Apr 2024 19:50:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rtylS-00036E-GJ for bug-gnu-emacs@gnu.org; Mon, 08 Apr 2024 19:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Apr 2024 23:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48356 X-GNU-PR-Package: emacs Original-Received: via spool by 48356-submit@debbugs.gnu.org id=B48356.171262023711752 (code B ref 48356); Mon, 08 Apr 2024 23:51:02 +0000 Original-Received: (at 48356) by debbugs.gnu.org; 8 Apr 2024 23:50:37 +0000 Original-Received: from localhost ([127.0.0.1]:47882 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rtyl1-00033L-Jd for submit@debbugs.gnu.org; Mon, 08 Apr 2024 19:50:36 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:22354) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rtykv-00031W-5c for 48356@debbugs.gnu.org; Mon, 08 Apr 2024 19:50:33 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id F0E64100198; Mon, 8 Apr 2024 19:50:14 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1712620209; bh=z9KuwOR70nXs/6tuxa54MrRILG54CNnZ/xYX2W7A2R8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=gitQHmXb0/KPONT0GQ3B4WtHnwzHJTmDStDX8iZTimFen5eRy5BCJ/DuECF9pss58 UxzuJQTGRll299/gzF0BkmAsk/XdVsXdNwaJ5cAz0l/Ziwqz6Pp3vYq0WDzpmR9g1R h17QtPNlw8KZMuzCAj3snETir5mpXQG3mz9r9y6KVJVaa6WTsoJ4JYR2LerGMS02Jb LZ7wse3E1fficvUFSC5mZN5F7EBmTSUZrtTvFxE4JtaaOH5g6GWZmJe4KDIwAwU25W Tb16AjFxxeN/A9gxhPB368oSM5XwT0lz712C/gAyidw9wCANPg3ynH7PKvxmoHXHxH YKN5UNsHl7e2A== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 71D6D10005D; Mon, 8 Apr 2024 19:50:09 -0400 (EDT) Original-Received: from pastel (unknown [45.72.201.215]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3F00F12080A; Mon, 8 Apr 2024 19:50:09 -0400 (EDT) In-Reply-To: <39326c56-094c-4074-95d7-8f92f7f927a5@gutov.dev> (Dmitry Gutov's message of "Tue, 9 Apr 2024 00:59:32 +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:282958 Archived-At: > ...which translates to "/" because of the double slash -- the filesystem > root directory (*). But that's the same data which would be used by any > other proposed solution, too. More or less, tho the "ideal" solution is to do that in the completion-style code, which has a bit more knowledge about it. > So maybe it should be either be fixed in the > completion table (avoid adding trailing slash when the last boundary is > already followed by slash?), or the insertion code should do some > additional post-processing of the completion string. I think you can fix it in the same ad-hoc way we use elsewhere: compare the first char after the boundary with the last char of the completion and drop one of the two if they're the same. > + (base-suffix (let ((suffix (buffer-substring (point) end))) > + (substring > + suffix > + (cdr (completion-boundaries string > + minibuffer-comp= letion-table > + minibuffer-comp= letion-predicate > + suffix))))) I think you want to be careful to pass (buffer-substring start (point)) rather than `string` to `completion-boundaries`. In theory this approach can "do the wrong thing" with some completion styles, but AFAIK they haven't been written yet. =F0=9F=99=82 Stefan