GNU bug report logs - #33595
26; Have `try-completion' or `completion--done' run abnormal hook if sole completion

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Mon, 3 Dec 2018 04:08:02 UTC

Severity: wishlist

Done: Drew Adams <drew.adams <at> oracle.com>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 33595 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 33595 <at> debbugs.gnu.org
Subject: Re: bug#33595: [PATCH] RE: bug#33595: 26;
 Have `try-completion' or `completion--done' run abnormal hook if sole
 completion
Date: Sat, 29 Dec 2018 10:08:25 +0200
> Date: Fri, 28 Dec 2018 10:56:08 -0800 (PST)
> From: Drew Adams <drew.adams <at> oracle.com>
> 
> ping.
> 
> Would someone please consider committing this patch?  Thx.

Stefan, any comments?  If okay, I'd like to push this to master.

> diff -u minibuffer.el minibuffer-2018-12-03a-patched.el
> --- minibuffer.el	2018-12-03 09:23:45.858608200 -0800
> +++ minibuffer-2018-12-03a-patched.el	2018-12-03 09:27:17.862397300 -0800
> @@ -753,6 +753,10 @@
>  the second failed attempt to complete."
>    :type '(choice (const nil) (const t) (const lazy)))
>  
> +(defvar completion-sole-match-functions ()
> +  "Functions to be run when completion results in only one match.
> +Each function must accept that completion as its first arg.")
> +
>  (defconst completion-styles-alist
>    '((emacs21
>       completion-emacs21-try-completion completion-emacs21-all-completions
> @@ -1769,6 +1773,8 @@
>    (let* ((exit-fun (plist-get completion-extra-properties :exit-function))
>           (pre-msg (and exit-fun (current-message))))
>      (cl-assert (memq finished '(exact sole finished unknown)))
> +    (when (eq finished 'finished)
> +      (run-hook-with-args 'completion-sole-match-functions string))
>      (when exit-fun
>        (when (eq finished 'unknown)
>          (setq finished
> 
> 
> 
> 




This bug report was last modified 6 years and 137 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.