[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 01/01: Use <up> and <down> keys to move point in th
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] master 01/01: Use <up> and <down> keys to move point in the multi-line minibuffer. |
Date: |
Tue, 18 Nov 2014 21:33:48 +0000 |
branch: master
commit 5c0fbcfc8aa6ee13fbd4ea1516f25c804bebcf8c
Author: Juri Linkov <address@hidden>
Date: Tue Nov 18 23:33:42 2014 +0200
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
---
etc/NEWS | 8 ++++++++
lisp/ChangeLog | 10 ++++++++++
lisp/bindings.el | 4 ++--
lisp/simple.el | 30 ++++++++++++++++++++++++++++++
4 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 86e21c4..41b9324 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index adf8273..6a6ff73 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
+2014-11-18 Juri Linkov <address@hidden>
+
+ * 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 <address@hidden>
* emacs-lisp/nadvice.el (define-advice): New macro.
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 1107740..789fdf0 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -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)
diff --git a/lisp/simple.el b/lisp/simple.el
index 031970e..fda7040 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 01/01: Use <up> and <down> keys to move point in the multi-line minibuffer.,
Juri Linkov <=