bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33595: [PATCH] RE: bug#33595: 26; Have `try-completion' or `completi


From: Drew Adams
Subject: bug#33595: [PATCH] RE: bug#33595: 26; Have `try-completion' or `completion--done' run abnormal hook if sole completion
Date: Fri, 28 Dec 2018 10:56:08 -0800 (PST)

ping.

Would someone please consider committing this patch?  Thx.

------------------

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]