# HG changeset patch # User Richard M. Stallman # Date 742599245 0 # Node ID 1d4aa358d9a005d8d8b406b00a7d471d24488b0c # Parent da352b92ca90c4d820268de40e1ececda1833386 (completion-mode): New major mode. (completion-setup-function): New function. Add it to completion-setup-hook. diff -r da352b92ca90 -r 1d4aa358d9a0 lisp/simple.el --- 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 \\\\[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.