From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#33595: 26; Have `try-completion' or `completion--done' run abnormal hook if sole completion Date: Wed, 02 Jan 2019 22:15:23 -0500 Message-ID: References: <13f934bf-e79c-47cb-88a5-7ee58cdc9242@default> <4f16869e-5f88-47bc-a118-5ea37cfb6d9a@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1546485253 16927 195.159.176.226 (3 Jan 2019 03:14:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 3 Jan 2019 03:14:13 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 33595@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 03 04:14:09 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1getST-0004GB-2k for geb-bug-gnu-emacs@m.gmane.org; Thu, 03 Jan 2019 04:14:09 +0100 Original-Received: from localhost ([127.0.0.1]:48788 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1getUZ-0004fY-Ci for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Jan 2019 22:16:19 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:58366) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1getUO-0004fM-FO for bug-gnu-emacs@gnu.org; Wed, 02 Jan 2019 22:16:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1getUI-0006RS-O0 for bug-gnu-emacs@gnu.org; Wed, 02 Jan 2019 22:16:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48443) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1getUI-0006Qg-Bw for bug-gnu-emacs@gnu.org; Wed, 02 Jan 2019 22:16:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1getUI-0003cN-3c for bug-gnu-emacs@gnu.org; Wed, 02 Jan 2019 22:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Jan 2019 03:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33595 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 33595-submit@debbugs.gnu.org id=B33595.154648532913865 (code B ref 33595); Thu, 03 Jan 2019 03:16:02 +0000 Original-Received: (at 33595) by debbugs.gnu.org; 3 Jan 2019 03:15:29 +0000 Original-Received: from localhost ([127.0.0.1]:45125 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1getTk-0003bY-SK for submit@debbugs.gnu.org; Wed, 02 Jan 2019 22:15:29 -0500 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:42905) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1getTh-0003bP-Ss for 33595@debbugs.gnu.org; Wed, 02 Jan 2019 22:15:26 -0500 Original-Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id x033FOh3011452; Wed, 2 Jan 2019 22:15:24 -0500 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id DACDBAE35F; Wed, 2 Jan 2019 22:15:23 -0500 (EST) In-Reply-To: <4f16869e-5f88-47bc-a118-5ea37cfb6d9a@default> (Drew Adams's message of "Wed, 2 Jan 2019 08:20:51 -0800 (PST)") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6452=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6452> : inlines <6990> : streams <1808969> : uri <2773957> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:154102 Archived-At: >> So in your example, your hook function is very tightly linked to the >> completion table. I still don't understand this example well enough to >> understand if/how it's linked to the UI (e.g. what should happen if the >> user happens to use, say, ido-ubiquitous to complete his function names). > > Ido? Idon't. I don't know either. Try it, to see. ;-) More generally, the code you wrote shouldn't presume exactly which completion UI is used, so the API should let you provide some "show extra info" function, and then separately some UI may opt to use this function for example when completing a sole match. >> It's not as simple as it seems: if the user goes to some other buffer in >> the middle of the completion, your completion-sole-match-functions will >> not wreak havoc in unrelated completions. ^^^ now > I don't know what you mean. Maybe give a specific > example (e.g. recipe, using the patch)? Or not. The hook function is active as long as the minibuffer is active, so if the user uses recursive minibuffers, the hook function will apply not just to the originally planned completion but also to other completions that take place in recursive minibuffers. It's basically the same problem as the usual problem of passing extra parameters via dynamic scoping, where the dynamic let-binding doesn't apply only to the first call, but to all nested calls that may occur. Anyway, thanks, I think I see how to introduce that feature (and I suspect it's actually already covered by the company-compatibility extra properties). Stefan