Commit 5c0fbcfc authored by Juri Linkov's avatar Juri Linkov

Use <up> and <down> keys to move point in the multi-line minibuffer.

* lisp/bindings.el (minibuffer-local-map): Rebind [down] from
next-history-element to next-line-or-history-element, and [up]
from previous-history-element to previous-line-or-history-element.

* lisp/simple.el (next-line-or-history-element)
(previous-line-or-history-element): New commands.

http://lists.gnu.org/archive/html/emacs-devel/2014-11/msg00822.html
parent cb4f666a
......@@ -133,6 +133,14 @@ Unicode standards.
* Changes in Specialized Modes and Packages in Emacs 25.1
** Minibuffer
*** You can use <up> and <down> keys to move point in the multi-line
minibuffer just as in an ordinary buffer. Only when point moves over
the bottom/top of the minibuffer it goes to the next/previous history
element. The new commands bound to <up> and <down> in the minibuffer:
`next-line-or-history-element' and `previous-line-or-history-element'.
** Search and Replace
*** Query-replace history is enhanced.
......
2014-11-18 Juri Linkov <juri@linkov.net>
* bindings.el (minibuffer-local-map): Rebind [down] from
next-history-element to next-line-or-history-element, and [up]
from previous-history-element to previous-line-or-history-element.
* simple.el (next-line-or-history-element)
(previous-line-or-history-element): New commands.
http://lists.gnu.org/archive/html/emacs-devel/2014-11/msg00822.html
2014-11-18 Leo Liu <sdl.web@gmail.com>
* emacs-lisp/nadvice.el (define-advice): New macro.
......
......@@ -839,11 +839,11 @@ if `inhibit-field-text-motion' is non-nil."
(let ((map minibuffer-local-map))
(define-key map "\en" 'next-history-element)
(define-key map [next] 'next-history-element)
(define-key map [down] 'next-history-element)
(define-key map [down] 'next-line-or-history-element)
(define-key map [XF86Forward] 'next-history-element)
(define-key map "\ep" 'previous-history-element)
(define-key map [prior] 'previous-history-element)
(define-key map [up] 'previous-history-element)
(define-key map [up] 'previous-line-or-history-element)
(define-key map [XF86Back] 'previous-history-element)
(define-key map "\es" 'next-matching-history-element)
(define-key map "\er" 'previous-matching-history-element)
......
......@@ -1984,6 +1984,36 @@ With argument N, it uses the Nth previous element."
(or (zerop n)
(goto-history-element (+ minibuffer-history-position n))))
(defun next-line-or-history-element (&optional arg)
"Move cursor vertically down ARG lines, or to the next history element.
When point moves over the bottom line of multi-line minibuffer, puts ARGth
next element of the minibuffer history in the minibuffer."
(interactive "^p")
(or arg (setq arg 1))
(let ((old-point (point)))
(condition-case nil
(next-line arg)
(end-of-buffer
;; Restore old position since `line-move-visual' moves point to
;; the end of the line when it fails to go to the next line.
(goto-char old-point)
(next-history-element arg)))))
(defun previous-line-or-history-element (&optional arg)
"Move cursor vertically up ARG lines, or to the previous history element.
When point moves over the top line of multi-line minibuffer, puts ARGth
previous element of the minibuffer history in the minibuffer."
(interactive "^p")
(or arg (setq arg 1))
(let ((old-point (point)))
(condition-case nil
(previous-line arg)
(beginning-of-buffer
;; Restore old position since `line-move-visual' moves point to
;; the beginning of the line when it fails to go to the previous line.
(goto-char old-point)
(previous-history-element arg)))))
(defun next-complete-history-element (n)
"Get next history element which completes the minibuffer before the point.
The contents of the minibuffer after the point are deleted, and replaced
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment