summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorLe Wang <l26wang@gmail.com>2013-12-18 11:02:39 +0800
committerChong Yidong <cyd@gnu.org>2013-12-18 11:02:39 +0800
commite82134b1e4efb363e21b1f9103af7ee5ec885ce4 (patch)
tree1b59f01232e7f4c223172f162b85757471dd6341 /lisp
parent33f5d4c15aa65576ff7f2ee62553280f9f92343c (diff)
downloademacs-e82134b1e4efb363e21b1f9103af7ee5ec885ce4.tar.gz
* comint.el (comint-previous-matching-input-from-input): Retain point.
Fixes: debbugs:13404
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/comint.el12
2 files changed, 12 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3a86fff5e50..126f10ae79b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-18 Le Wang <l26wang@gmail.com>
+
+ * comint.el (comint-previous-matching-input-from-input): Retain
+ point (Bug#13404).
+
2013-12-18 Chong Yidong <cyd@gnu.org>
* simple.el (append-next-kill): Doc fix (Bug#15995, Bug#16016).
diff --git a/lisp/comint.el b/lisp/comint.el
index e7dff585b68..5cdec45650d 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1210,8 +1210,9 @@ If N is negative, find the previous or Nth previous match."
With prefix argument N, search for Nth previous match.
If N is negative, search forwards for the -Nth following match."
(interactive "p")
- (if (not (memq last-command '(comint-previous-matching-input-from-input
- comint-next-matching-input-from-input)))
+ (let ((opoint (point)))
+ (unless (memq last-command '(comint-previous-matching-input-from-input
+ comint-next-matching-input-from-input))
;; Starting a new search
(setq comint-matching-input-from-input-string
(buffer-substring
@@ -1219,9 +1220,10 @@ If N is negative, search forwards for the -Nth following match."
(process-mark (get-buffer-process (current-buffer))))
(point))
comint-input-ring-index nil))
- (comint-previous-matching-input
- (concat "^" (regexp-quote comint-matching-input-from-input-string))
- n))
+ (comint-previous-matching-input
+ (concat "^" (regexp-quote comint-matching-input-from-input-string))
+ n)
+ (goto-char opoint)))
(defun comint-next-matching-input-from-input (n)
"Search forwards through input history for match for current input.