From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74616: 30.0.92; tmm always displays the *Completions* buffer Date: Sun, 15 Dec 2024 11:02:29 +0100 Message-ID: <87bjxdfemi.fsf@daniel-mendler.de> References: <878qt1w7c6.fsf@daniel-mendler.de> <86wmgl9mfz.fsf@gnu.org> <86ldwrirf1.fsf@gnu.org> <87wmgbftih.fsf@daniel-mendler.de> <87jzca2bg5.fsf@daniel-mendler.de> <87wmg8llw1.fsf@mail.linkov.net> <877c88k51i.fsf@daniel-mendler.de> <868qsod3h3.fsf@gnu.org> <87o71kfvgu.fsf@daniel-mendler.de> <86zfl3btx0.fsf@gnu.org> <87ikrqb58x.fsf@daniel-mendler.de> <86ldwiv9mn.fsf@gnu.org> <87pllusd3j.fsf@daniel-mendler.de> <87o71d2xxb.fsf@mail.linkov.net> Reply-To: Daniel Mendler 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="32228"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , 74616@debbugs.gnu.org, monnier@iro.umontreal.ca To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 15 11:05:28 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 1tMlV9-0008Dw-Q6 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 15 Dec 2024 11:05:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tMlUq-0000um-E3; Sun, 15 Dec 2024 05:05:09 -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 1tMlUm-0000sa-3L for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2024 05:05:04 -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 1tMlUl-0006nN-Q2 for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2024 05:05:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=auXBX8holSQtvSUwwvHXjC3xZDXe+RQ+BNVlVc1PZOA=; b=KRuTKJbQ3zWtgbqRoW/id7T5rEZEkRAiSYzeciEeIPi0zBxikNSS/y1H1tIEmiKrmWrReaDnQeoN5oW+JSoh64qje2RgceqWD4M3kmurBZiVS443f05WuohASFTMKoJqV7//SBh+amBpxvbR240ST+JYYSdgVxCeneBM788Qv6GVQLcKsBdslQ9nWGbtZeDfE+E8VryQtwxFLzw8QBxQN5PtfTgfEashBOfCc+dxS0bhGg9iN1vcDDWdWPvmmPpVxDSM4gbG3Yo6KH5Mhy3qifDgVAjL9ta0Jwgik7aq8VT5GfiPXvPhBAw0mzpqStliu4l7AkDBYrAxJUrwE9Mf3w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tMlUj-0004Rg-Uj for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2024 05:05:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Dec 2024 10:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74616 X-GNU-PR-Package: emacs Original-Received: via spool by 74616-submit@debbugs.gnu.org id=B74616.173425709117058 (code B ref 74616); Sun, 15 Dec 2024 10:05:01 +0000 Original-Received: (at 74616) by debbugs.gnu.org; 15 Dec 2024 10:04:50 +0000 Original-Received: from localhost ([127.0.0.1]:49610 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tMlUY-0004R4-Ff for submit@debbugs.gnu.org; Sun, 15 Dec 2024 05:04:50 -0500 Original-Received: from server.qxqx.de ([49.12.34.165]:39097 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tMlUW-0004Qr-Be for 74616@debbugs.gnu.org; Sun, 15 Dec 2024 05:04:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=auXBX8holSQtvSUwwvHXjC3xZDXe+RQ+BNVlVc1PZOA=; b=c3rd9GvIOWaq1II4NJEPZI8Ns8 /TBULOWYjPNXrWKDdG9skSvOp/Rj4NbVQLl0lsEJpG7HbURojsF70fx3dUVin92gw3yw2cunUR537 33zEWIxEl17Ru8MSeIJdbCcRvzKafi+tRX5niKAHhfIs9AeqxsfUWqEjGtSBfKaNRKFg=; In-Reply-To: <87o71d2xxb.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 15 Dec 2024 09:44:00 +0200") 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:297091 Archived-At: --=-=-= Content-Type: text/plain Juri Linkov writes: >> Thanks for finding this. The problem was that `initial-input' was passed >> directly to `completion-metadata'. I replaced `initial-input' with `(or >> initial-input "")'. See the updated patch attached to this mail. > > It seems this change caused another regression: 'ffap' on a file name > fails with the error: Oh, I see. The INITIAL-INPUT argument can be a cons pair too. See the patch attached to this mail which fixes the problem. Daniel --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-completion-eager-display-Handle-INITIAL-INPUT-cons.patch >From 234fbf9b2e05c73b6197f4db9e88c694e54a95a2 Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Sun, 15 Dec 2024 10:57:59 +0100 Subject: [PATCH] completion-eager-display: Handle INITIAL-INPUT cons The INITIAL-ARGUMENT passed to `completing-read' can either be nil, or a string or a pair (STRING . POSITION). Handle each of these three cases. * lisp/minibuffer.el (completing-read-default): Handle cons pair INITIAL-ARGUMENT. --- lisp/minibuffer.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index dfc62c25f38..9a8545c56a6 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -4857,8 +4857,12 @@ completing-read-default ;; `completion-eager-display' is t or if eager display ;; has been requested by the completion table. (when completion-eager-display - (let* ((md (completion-metadata (or initial-input "") - collection predicate)) + (let* ((md (completion-metadata + (pcase initial-input + (`(,str . ,pos) (substring str 0 pos)) + ((pred stringp) initial-input) + (_ "")) + collection predicate)) (fun (completion-metadata-get md 'eager-display))) (when (or fun (eq completion-eager-display t)) (funcall (if (functionp fun) -- 2.45.2 --=-=-=--