]> code.delx.au - gnu-emacs/commitdiff
Use <up> and <down> keys to move point in the multi-line minibuffer.
authorJuri Linkov <juri@linkov.net>
Tue, 18 Nov 2014 21:33:42 +0000 (23:33 +0200)
committerJuri Linkov <juri@linkov.net>
Tue, 18 Nov 2014 21:33:42 +0000 (23:33 +0200)
* 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

etc/NEWS
lisp/ChangeLog
lisp/bindings.el
lisp/simple.el

index 86e21c4b8fab4541f287c9c2c9d196d4e7e3b1cb..41b9324227013b3b463f9fde3c53beef0dec9970 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -133,6 +133,14 @@ Unicode standards.
 \f
 * 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.
index adf82739b2e52e05b005818e197be0a78bf8f2e1..6a6ff73b365fb54bc70d3ed261ce73ac29dc210f 100644 (file)
@@ -1,3 +1,13 @@
+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.
index 110774082e0b446ffb19b7d63bd8592fb5c17897..789fdf00616182640fa7b5baf6ce351318227752 100644 (file)
@@ -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)
index 031970ebb72edc121c2d0dbafe6dff0b97639053..fda7040ccb8a3bcb8dd138c0a0142e25f868564c 100644 (file)
@@ -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