[Top][All Lists]

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


From: Knut Olav Bøhmer
Subject: comint-sole-completion-hook
Date: Fri, 14 Nov 2008 13:16:26 +0100


I would like to do stuff, when i get sole-completion, in comint-mode,
or comint derivatives.
Could we have a hook for sole-completions?

how about comint-sole-completion-hook?

Or, it could be one hook that takes one of the symbols '(sole shortest
partial listed), and the stub that is to be completed.
look at comint-dynamic-simple-complete, for more info about those symbols.

here is an example to show what I mean.

Diff finished.  Fri Nov 14 13:10:59 2008
--- /usr/share/emacs/23.0.60/lisp/comint.el.gz
+++ /tmp/buffer-content-9338VKc
@@ -2876,6 +2876,7 @@
       ((eq completion t)            ; Means already completed "file".
        (insert filesuffix)
        (unless minibuffer-p
+         (run-hook-with-args 'comint-sole-completion-hook filename)
          (message "Sole completion")))
       ((string-equal completion "") ; Means completion on "directory/".
@@ -2945,7 +2946,9 @@
       ((= 1 (length completions))    ; Gotcha!
        (let ((completion (car completions)))
          (if (string-equal completion stub)
-         (message "Sole completion")
+         (progn
+           (message "Sole completion")
+           (run-hook-with-args 'comint-sole-completion-hook stub))
            (insert (substring completion (length stub)))
            (message "Completed"))
          (insert suffix)

Diff finished.  Fri Nov 14 13:10:59 2008

Knut Olav Bøhmer

reply via email to

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