aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKim F. Storm2002-06-01 00:00:29 +0000
committerKim F. Storm2002-06-01 00:00:29 +0000
commitba36181bdff1ce1bbf3029024a9a6c795c51e40b (patch)
tree2f8bc7fc614f6253769374ef4fd50c1fe977e2c2 /lisp
parent89a2b3d123bb847ddac6dd4d1b3bfc7cc4e278ef (diff)
downloademacs-ba36181bdff1ce1bbf3029024a9a6c795c51e40b.tar.gz
emacs-ba36181bdff1ce1bbf3029024a9a6c795c51e40b.zip
(choose-completion-string-functions): New special hook.
(choose-completion-string1): Renamed from choose-completion-string. (choose-completion-string): Run choose-completion-string-functions until success, and only call choose-completion-string1 if it fails.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/simple.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 305dc3e9817..5115fbef72f 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3777,6 +3777,13 @@ With prefix argument N, move N items (negative N means move backward)."
3777 (forward-char 1)) 3777 (forward-char 1))
3778 (delete-char len))) 3778 (delete-char len)))
3779 3779
3780(defvar choose-completion-string-functions nil
3781 "List of functions which may override the standard `choose-completion-string'.
3782Each function in the list is called in turn with arguments CHOICE BUFFER BASE-SIZE
3783like choose-completion-string. If a function in the list returns non-nil, that
3784function is supposed to have inserted the completion in the minibuffer.
3785If all functions in the list return nil, use the default completion selection.")
3786
3780;; Switch to BUFFER and insert the completion choice CHOICE. 3787;; Switch to BUFFER and insert the completion choice CHOICE.
3781;; BASE-SIZE, if non-nil, says how many characters of BUFFER's text 3788;; BASE-SIZE, if non-nil, says how many characters of BUFFER's text
3782;; to keep. If it is nil, use choose-completion-delete-max-match instead. 3789;; to keep. If it is nil, use choose-completion-delete-max-match instead.
@@ -3785,6 +3792,11 @@ With prefix argument N, move N items (negative N means move backward)."
3785;; unless it is reading a file name and CHOICE is a directory, 3792;; unless it is reading a file name and CHOICE is a directory,
3786;; or completion-no-auto-exit is non-nil. 3793;; or completion-no-auto-exit is non-nil.
3787(defun choose-completion-string (choice &optional buffer base-size) 3794(defun choose-completion-string (choice &optional buffer base-size)
3795 (unless (run-hook-with-args-until-success
3796 'choose-completion-string-functions choice buffer base-size)
3797 (choose-completion-string1 choice buffer base-size)))
3798
3799(defun choose-completion-string1 (choice &optional buffer base-size)
3788 (let ((buffer (or buffer completion-reference-buffer)) 3800 (let ((buffer (or buffer completion-reference-buffer))
3789 (mini-p (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" (buffer-name buffer)))) 3801 (mini-p (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" (buffer-name buffer))))
3790 ;; If BUFFER is a minibuffer, barf unless it's the currently 3802 ;; If BUFFER is a minibuffer, barf unless it's the currently