Mercurial > emacs
changeset 10284:832491972c95
(switch-to-completions): New command, with bindings in minibuf completion maps.
(next-completion, previous-completion): New commands.
(completion-list-mode-map): Put them on left, right arrows.
(completion-list-mode-map): Don't bind return, just C-m.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 29 Dec 1994 18:53:25 +0000 |
parents | 1d1c5ea9eb86 |
children | abacb10bd5e6 |
files | lisp/simple.el |
diffstat | 1 files changed, 47 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/simple.el Thu Dec 29 04:17:00 1994 +0000 +++ b/lisp/simple.el Thu Dec 29 18:53:25 1994 +0000 @@ -2583,8 +2583,9 @@ (define-key map [mouse-2] 'mouse-choose-completion) (define-key map [down-mouse-2] nil) (define-key map "\C-m" 'choose-completion) - (define-key map [return] 'choose-completion) (define-key map "\e\e\e" 'delete-completion-window) + (define-key map [left] 'previous-completion) + (define-key map [right] 'next-completion) (setq completion-list-mode-map map))) ;; Completion mode is suitable only for specially formatted data. @@ -2607,6 +2608,34 @@ (if (get-buffer-window buf) (select-window (get-buffer-window buf))))) +(defun previous-completion (n) + "Move to the previous item in the completion list." + (interactive "p") + (next-completion (- n))) + +(defun next-completion (n) + "Move to the next item in the completion list. +WIth prefix argument N, move N items (negative N means move backward)." + (interactive "p") + (while (and (> n 0) (not (eobp))) + (let ((prop (get-text-property (point) 'mouse-face))) + ;; If in a completion, move to the end of it. + (if prop + (goto-char (next-single-property-change (point) 'mouse-face))) + ;; Move to start of next one. + (goto-char (next-single-property-change (point) 'mouse-face))) + (setq n (1- n))) + (while (and (< n 0) (not (bobp))) + (let ((prop (get-text-property (1- (point)) 'mouse-face))) + ;; If in a completion, move to the start of it. + (if prop + (goto-char (previous-single-property-change (point) 'mouse-face))) + ;; Move to end of the previous completion. + (goto-char (previous-single-property-change (point) 'mouse-face)) + ;; Move to the start of that one. + (goto-char (previous-single-property-change (point) 'mouse-face))) + (setq n (1+ n)))) + (defun choose-completion () "Choose the completion that point is in or next to." (interactive) @@ -2715,6 +2744,23 @@ (goto-char end)))))) (add-hook 'completion-setup-hook 'completion-setup-function) + +(define-key minibuffer-local-completion-map [prior] + 'switch-to-completions) +(define-key minibuffer-local-must-match-map [prior] + 'switch-to-completions) +(define-key minibuffer-local-completion-map "\M-v" + 'switch-to-completions) +(define-key minibuffer-local-must-match-map "\M-v" + 'switch-to-completions) + +(defun switch-to-completions () + "Select the completion list window." + (interactive) + (select-window (get-buffer-window "*Completions*")) + (goto-char (point-min)) + (search-forward "\n\n") + (forward-line 1)) ;;;; Keypad support.