aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/simple.el30
1 files changed, 30 insertions, 0 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index dfca44cffc6..be3bf692206 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2194,7 +2194,37 @@ it were the arg to `interactive' (which see) to interactively read the value."
2194 'arg)) 2194 'arg))
2195 (eval-minibuffer (format "Set %s to value: " var))))))) 2195 (eval-minibuffer (format "Set %s to value: " var)))))))
2196 (set var val)) 2196 (set var val))
2197
2198;; Define the major mode for lists of completions.
2199
2200(defvar completion-mode-map nil)
2201(or completion-mode-map
2202 (let ((map (make-sparse-keymap)))
2203 (define-key map [mouse-2] 'mouse-choose-completion)
2204 (setq completion-mode-map map)))
2205
2206;; Completion mode is suitable only for specially formatted data.
2207(put 'completion-mode 'mode-class 'special)
2208
2209(defun completion-mode ()
2210 "Major mode for buffers showing lists of possible completions.
2211Type \\<completion-mode-map>\\[mouse-choose-completion] to select
2212a completion with the mouse."
2213 (interactive)
2214 (kill-all-local-variables)
2215 (use-local-map completion-mode-map)
2216 (setq mode-name "Completion")
2217 (setq major-mode 'completion-mode)
2218 (run-hooks 'completion-mode-hook))
2219
2220(defun completion-setup-function ()
2221 (save-excursion
2222 (completion-mode)
2223 (goto-char (point-min))
2224 (insert (substitute-command-keys
2225 "Click \\[mouse-choose-completion] on a completion to select it.\n\n"))))
2197 2226
2227(add-hook 'completion-setup-hook 'completion-setup-function)
2198 2228
2199;;;; Keypad support. 2229;;;; Keypad support.
2200 2230