summaryrefslogtreecommitdiff
path: root/lisp/comint.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/comint.el')
-rw-r--r--lisp/comint.el6
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index 6fb89e28181..70d6f85ff68 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1022,9 +1022,11 @@ See also `comint-read-input-ring'."
(last-command last-command)
(regexp (read-from-minibuffer prompt nil nil nil
'minibuffer-history-search-history)))
+ ;; If the user didn't enter anything, nothing is added to m-h-s-h.
+ ;; Use the previous search regexp, if there is one.
(list (if (string-equal regexp "")
- (setcar minibuffer-history-search-history
- (nth 1 minibuffer-history-search-history))
+ (or (car minibuffer-history-search-history)
+ regexp)
regexp)
(prefix-numeric-value current-prefix-arg))))