]> git.eshelyaron.com Git - emacs.git/commitdiff
(completion-mode): New major mode.
authorRichard M. Stallman <rms@gnu.org>
Tue, 13 Jul 1993 21:34:05 +0000 (21:34 +0000)
committerRichard M. Stallman <rms@gnu.org>
Tue, 13 Jul 1993 21:34:05 +0000 (21:34 +0000)
(completion-setup-function): New function.
Add it to completion-setup-hook.

lisp/simple.el

index dfca44cffc6968dabe2603e9141e71a679e7456f..be3bf692206f9099aaee17ef3eb01d3615051f11 100644 (file)
@@ -2194,7 +2194,37 @@ it were the arg to `interactive' (which see) to interactively read the value."
                                           'arg))
               (eval-minibuffer (format "Set %s to value: " var)))))))
   (set var val))
+\f
+;; Define the major mode for lists of completions.
+
+(defvar completion-mode-map nil)
+(or completion-mode-map
+    (let ((map (make-sparse-keymap)))
+      (define-key map [mouse-2] 'mouse-choose-completion)
+      (setq completion-mode-map map)))
+
+;; Completion mode is suitable only for specially formatted data.
+(put 'completion-mode 'mode-class 'special)
+
+(defun completion-mode ()
+  "Major mode for buffers showing lists of possible completions.
+Type \\<completion-mode-map>\\[mouse-choose-completion] to select
+a completion with the mouse."
+  (interactive)
+  (kill-all-local-variables)
+  (use-local-map completion-mode-map)
+  (setq mode-name "Completion")
+  (setq major-mode 'completion-mode)
+  (run-hooks 'completion-mode-hook))
+
+(defun completion-setup-function ()
+  (save-excursion
+    (completion-mode)
+    (goto-char (point-min))
+    (insert (substitute-command-keys
+            "Click \\[mouse-choose-completion] on a completion to select it.\n\n"))))
 
+(add-hook 'completion-setup-hook 'completion-setup-function)
 \f
 ;;;; Keypad support.