From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: Question about completion behavior Date: Wed, 9 Mar 2022 12:46:54 +0100 Message-ID: <20220309114654.zq3h3u47btmt7q2u@Ergus> References: <20220309001013.gxyh2uasbuxiz6ww.ref@Ergus> <20220309001013.gxyh2uasbuxiz6ww@Ergus> <20220309014619.bptamkv47xdiyhzp@Ergus> <831qzbg5j2.fsf@gnu.org> <20220309101159.4k3uma2ztvldlqiz@Ergus> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="izodh2wwrb2ab6pe" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24947"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 09 12:53:24 2022 Return-path: Envelope-to: ged-emacs-devel@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 1nRuse-0006PM-N4 for ged-emacs-devel@m.gmane-mx.org; Wed, 09 Mar 2022 12:53:24 +0100 Original-Received: from localhost ([::1]:60656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRusd-0008Ob-OB for ged-emacs-devel@m.gmane-mx.org; Wed, 09 Mar 2022 06:53:23 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49772) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRun7-0001rr-VQ for emacs-devel@gnu.org; Wed, 09 Mar 2022 06:47:42 -0500 Original-Received: from sonic301-2.consmr.mail.bf2.yahoo.com ([74.6.129.41]:40841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRun4-0003qN-V3 for emacs-devel@gnu.org; Wed, 09 Mar 2022 06:47:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1646826457; bh=QY6ETPJiEEnlnky8LarKtHNBYfdzu543bzL3MgLz+rc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=LGdHi77Zbwc7TB62WVa9BcgkblyDv0cq3yyR3pyx/CRaCOVN5DJJlpflvPWKSqjm3DIuEOaooAb46Emw0atLuT53X2xkAJwzd+MenCNeSPURJQ06pHYcx+285a6dCEwseBu8nlEmXldHgoMR2o4Y4HX15hkhnQ9LuLjELLvJJdVSOMccn8TEWTD/7yYLgLrgzTU/dF9YinaLWV/KtFTU83icVNZ89DJLfPJx1abYYJ1c0DrFQAxhj5igFk9c7MhDO0QybmPOMckVz9jkiinDgf/Z9OIXTbQNd29j7ZmcPp9Gq57YlZvGwE5dbNezCCNadq3/GGTeYDEtJHuh2wXCQQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1646826457; bh=gP5aJijdZ4NIn/X/uDs5T5pj2FJbejj73hKD/+aEjYb=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=ge2ZrcL6LBeZA7rbfKXKGp82jP3KpZGmDJ6FXJPKZefCKi8SJl4GGWK73wwqJhRdl/+lZY3BvLC/+0qh4yOuXid1XmzVszLlSC0WtmLFszMs8xTjT5eSbPq9lPzJTl17xfQFPU3AMsfwWAzdSyzW2TYajGFrJlOqnbXI2kGuwDTqqWIqdf0sjd/RJ7EplM5c+2ew22WbYtuhrtXv4Ar4jsE74vg5iaQ3qkn7Hp38ruGq2MjKwG5Db+oqLnaOUuNkXZ1lp9rfXnZwBqivIsctB3ViulX+FnQ86Y55Me3Oa80slLOZrbUbHUhjf45n51tMXTK6Bs5rLsw2kTgydo4fCA== X-YMail-OSG: UVSY.xkVM1mJEUCKyCYWNo4uprOL834L6sqz1FQMHVza6UeYZ59DD2pmre6I1nv kj9PyjKBj1A9n6l_i49KPGWmvn1dE7A7iXeWw3VBkNKMhk8kqVTRGN_auGvj2i0ZdZIe4A3DBith AlMPh7TmmOuDJ5HAOuXXr5D7KIq032X4ASKP4l2SR_D27vUyPuGesSwYqncmPRY2C7dXCnRqaPFy KAJgpG5g_3kmGmR7tkOwLZZiYWQrsxelFHGvHYaiNsSFZtIByzeMz0U_mbwuLsjjoW5r.HiXr9.t zlP26pjNfD7Axv3jwDXbLccLNzsNNu1GUEJParLzbY9W8qvATuhZtatTZbbB1XDlMkIPb5FBvovg PHJPE9uGgGC2ULiokzRdPaDW1G0Ay09Fu9i3Hnn_ksRTDhFVKWW.kbQOV0xmC2ikMwrmTtToW1nF TPd3jNudNICG6C4fEjEx8h5Q8wBEJlCtdNkKyB6hmRX8EaQDvvcWd73v33fRNhtg8P6xtqKgwSSj mtFrhSkFtQ_0hIfI_5inrkxUZeQafHt49M61scjQU6z2sDbwGkNb.bP1RV2wLzYMSbAra.oOxon6 M_pd27PmP550a.ulOBTv3bWOCVWQsvcDt_KwJco.c50z7trPWYAn4yyX6y_LQY5ce.acSuBHLdRg vaUsNdFjauzoVkZa9y2EMpjCjhkMKUEjnDKaAI9YUN0PRyP_ptfYHmcIt5J9eoxQHIczW0qAjJ9Y ORjMEG9_ikFrlQuZGwNSqL7znOnJu0matIu2QOAF.K5c1zDGP3KmHyOhfaWmkGCg1yjByorxu5y. QECGuMIEyucUEGoyvavhyk4CsdYfbdz1TxZiVQEg26 X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.bf2.yahoo.com with HTTP; Wed, 9 Mar 2022 11:47:37 +0000 Original-Received: by kubenode507.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 89934ed3efcbb82c8e14fb57e5e3ee15; Wed, 09 Mar 2022 11:47:33 +0000 (UTC) Content-Disposition: inline In-Reply-To: <20220309101159.4k3uma2ztvldlqiz@Ergus> X-Mailer: WebService/1.1.19878 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.129.41; envelope-from=spacibba@aol.com; helo=sonic301-2.consmr.mail.bf2.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:286948 Archived-At: --izodh2wwrb2ab6pe Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Hi again Eli: Look at the attached patch, it may need some small improve to solve the case 4. but so far it gives a consistent behavior with any value of completion-auto-help (and it is actually simpler than the current code) Alternatively we may add another custom, something like: completions-on-complete-action which may have 3 possible values: 'always to update 'hide for the current behavior nil to do nothing (not hide the completions but keep them visible) WDYT? (personally I prefer the simpler... but I know... it's emacs) Ergus On Wed, Mar 09, 2022 at 11:11:59AM +0100, Ergus wrote: >On Wed, Mar 09, 2022 at 05:37:37AM +0200, Eli Zaretskii wrote: > >Hi Eli: > >Thanks for replying. What do you mean by "at a complete"? > >there are several conditions to handle: > >These are the current more or less the conditions we have now: > >1. no unique (shows or update completions) >2. unique common (complete-common and hides completion) >3. unique candidate (complete and hides completion) >4. unique common but completion is a valid entry (complete-common and hides completion) > >Is the 4 to what you refer? > >For example when we have: > >magit >magit-commit >magit-push >.... > >and we do: magi > >the completion goes up to magit (adds the t) but it is a valid >candidate. > >What I propose is: > >1. no unique (shows or update completions) >2. unique common (complete-common and UPDATE completions) >3. unique candidate (complete and hides completion) >4. unique common but completion is a valid entry (complete-common and hides completion) > >Is this behavior fine?? > >Best, >Ergus > --izodh2wwrb2ab6pe Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="completion.patch" diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index a06986fdb7..fbb72f3d32 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1342,24 +1342,22 @@ completion--do-completion (setq completed t exact t) (completion--cache-all-sorted-completions beg end comps) (minibuffer-force-complete beg end)) - (completed - ;; We could also decide to refresh the completions, - ;; if they're displayed (and assuming there are - ;; completions left). - (minibuffer-hide-completions) - (if exact - ;; If completion did not put point at end of field, - ;; it's a sign that completion is not finished. - (completion--done completion - (if (< comp-pos (length completion)) - 'exact 'unknown)))) ;; Show the completion table, if requested. ((not exact) (if (pcase completion-auto-help ('lazy (eq this-command last-command)) (_ completion-auto-help)) (minibuffer-completion-help beg end) + (minibuffer-hide-completions) (completion--message "Next char not unique"))) + (completed + ;; We could also decide to refresh the completions, + ;; if they're displayed (and assuming there are + ;; completions left). + (minibuffer-hide-completions) + (completion--done completion + (if (< comp-pos (length completion)) + 'exact 'unknown))) ;; If the last exact completion and this one were the same, it ;; means we've already given a "Complete, but not unique" message ;; and the user's hit TAB again, so now we give him help. --izodh2wwrb2ab6pe--