changeset 4082:1d4aa358d9a0

(completion-mode): New major mode. (completion-setup-function): New function. Add it to completion-setup-hook.
author Richard M. Stallman <rms@gnu.org>
date Tue, 13 Jul 1993 21:34:05 +0000
parents da352b92ca90
children 465c6787d6dd
files lisp/simple.el
diffstat 1 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Tue Jul 13 21:33:17 1993 +0000
+++ b/lisp/simple.el	Tue Jul 13 21:34:05 1993 +0000
@@ -2194,7 +2194,37 @@
 					   'arg))
 	       (eval-minibuffer (format "Set %s to value: " var)))))))
   (set var val))
+
+;; 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)
 
 ;;;; Keypad support.