1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Bind up/down in ecomplete

* lisp/ecomplete.el (ecomplete-display-matches): Allow using
up/down in addition to M-p/M-n.
This commit is contained in:
Lars Ingebrigtsen 2018-01-18 12:16:23 +01:00
parent e462308f03
commit 70a4f9ee21

View file

@ -168,13 +168,15 @@ matches."
nil)
(setq highlight (ecomplete-highlight-match-line matches line))
(let ((local-map (make-sparse-keymap))
(prev-func (lambda () (setq line (max (1- line) 0))))
(next-func (lambda () (setq line (min (1+ line) max-lines))))
selected)
(define-key local-map (kbd "RET")
(lambda () (setq selected (nth line (split-string matches "\n")))))
(define-key local-map (kbd "M-n")
(lambda () (setq line (min (1+ line) max-lines))))
(define-key local-map (kbd "M-p")
(lambda () (setq line (max (1- line) 0))))
(define-key local-map (kbd "M-n") next-func)
(define-key local-map (kbd "<down>") next-func)
(define-key local-map (kbd "M-p") prev-func)
(define-key local-map (kbd "<up>") prev-func)
(let ((overriding-local-map local-map))
(while (and (null selected)
(setq command (read-key-sequence highlight))