aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2014-11-18 23:33:42 +0200
committerJuri Linkov2014-11-18 23:33:42 +0200
commit5c0fbcfc8aa6ee13fbd4ea1516f25c804bebcf8c (patch)
tree9671af81c39d9c4197fa5369e9b62b29acf01ab6
parentcb4f666ade76181223c197fe38fc600ea4d7ab01 (diff)
downloademacs-5c0fbcfc8aa6ee13fbd4ea1516f25c804bebcf8c.tar.gz
emacs-5c0fbcfc8aa6ee13fbd4ea1516f25c804bebcf8c.zip
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
-rw-r--r--etc/NEWS8
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/bindings.el4
-rw-r--r--lisp/simple.el30
4 files changed, 50 insertions, 2 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 86e21c4b8fa..41b93242270 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -133,6 +133,14 @@ Unicode standards.
133 133
134* Changes in Specialized Modes and Packages in Emacs 25.1 134* Changes in Specialized Modes and Packages in Emacs 25.1
135 135
136** Minibuffer
137
138*** You can use <up> and <down> keys to move point in the multi-line
139minibuffer just as in an ordinary buffer. Only when point moves over
140the bottom/top of the minibuffer it goes to the next/previous history
141element. The new commands bound to <up> and <down> in the minibuffer:
142`next-line-or-history-element' and `previous-line-or-history-element'.
143
136** Search and Replace 144** Search and Replace
137 145
138*** Query-replace history is enhanced. 146*** Query-replace history is enhanced.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index adf82739b2e..6a6ff73b365 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12014-11-18 Juri Linkov <juri@linkov.net>
2
3 * bindings.el (minibuffer-local-map): Rebind [down] from
4 next-history-element to next-line-or-history-element, and [up]
5 from previous-history-element to previous-line-or-history-element.
6
7 * simple.el (next-line-or-history-element)
8 (previous-line-or-history-element): New commands.
9 http://lists.gnu.org/archive/html/emacs-devel/2014-11/msg00822.html
10
12014-11-18 Leo Liu <sdl.web@gmail.com> 112014-11-18 Leo Liu <sdl.web@gmail.com>
2 12
3 * emacs-lisp/nadvice.el (define-advice): New macro. 13 * emacs-lisp/nadvice.el (define-advice): New macro.
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 110774082e0..789fdf00616 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -839,11 +839,11 @@ if `inhibit-field-text-motion' is non-nil."
839(let ((map minibuffer-local-map)) 839(let ((map minibuffer-local-map))
840 (define-key map "\en" 'next-history-element) 840 (define-key map "\en" 'next-history-element)
841 (define-key map [next] 'next-history-element) 841 (define-key map [next] 'next-history-element)
842 (define-key map [down] 'next-history-element) 842 (define-key map [down] 'next-line-or-history-element)
843 (define-key map [XF86Forward] 'next-history-element) 843 (define-key map [XF86Forward] 'next-history-element)
844 (define-key map "\ep" 'previous-history-element) 844 (define-key map "\ep" 'previous-history-element)
845 (define-key map [prior] 'previous-history-element) 845 (define-key map [prior] 'previous-history-element)
846 (define-key map [up] 'previous-history-element) 846 (define-key map [up] 'previous-line-or-history-element)
847 (define-key map [XF86Back] 'previous-history-element) 847 (define-key map [XF86Back] 'previous-history-element)
848 (define-key map "\es" 'next-matching-history-element) 848 (define-key map "\es" 'next-matching-history-element)
849 (define-key map "\er" 'previous-matching-history-element) 849 (define-key map "\er" 'previous-matching-history-element)
diff --git a/lisp/simple.el b/lisp/simple.el
index 031970ebb72..fda7040ccb8 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1984,6 +1984,36 @@ With argument N, it uses the Nth previous element."
1984 (or (zerop n) 1984 (or (zerop n)
1985 (goto-history-element (+ minibuffer-history-position n)))) 1985 (goto-history-element (+ minibuffer-history-position n))))
1986 1986
1987(defun next-line-or-history-element (&optional arg)
1988 "Move cursor vertically down ARG lines, or to the next history element.
1989When point moves over the bottom line of multi-line minibuffer, puts ARGth
1990next element of the minibuffer history in the minibuffer."
1991 (interactive "^p")
1992 (or arg (setq arg 1))
1993 (let ((old-point (point)))
1994 (condition-case nil
1995 (next-line arg)
1996 (end-of-buffer
1997 ;; Restore old position since `line-move-visual' moves point to
1998 ;; the end of the line when it fails to go to the next line.
1999 (goto-char old-point)
2000 (next-history-element arg)))))
2001
2002(defun previous-line-or-history-element (&optional arg)
2003 "Move cursor vertically up ARG lines, or to the previous history element.
2004When point moves over the top line of multi-line minibuffer, puts ARGth
2005previous element of the minibuffer history in the minibuffer."
2006 (interactive "^p")
2007 (or arg (setq arg 1))
2008 (let ((old-point (point)))
2009 (condition-case nil
2010 (previous-line arg)
2011 (beginning-of-buffer
2012 ;; Restore old position since `line-move-visual' moves point to
2013 ;; the beginning of the line when it fails to go to the previous line.
2014 (goto-char old-point)
2015 (previous-history-element arg)))))
2016
1987(defun next-complete-history-element (n) 2017(defun next-complete-history-element (n)
1988 "Get next history element which completes the minibuffer before the point. 2018 "Get next history element which completes the minibuffer before the point.
1989The contents of the minibuffer after the point are deleted, and replaced 2019The contents of the minibuffer after the point are deleted, and replaced