# HG changeset patch # User Richard M. Stallman # Date 736714472 0 # Node ID 9ebd08f578f0d2676a73b391168e0aef12a6fcee # Parent ac4af95b962f43f4043b9ea604abfd4748f5399a (previous-matching-history-element): If minibuf is empty, use the last regexp specified a the default. (next-matching-history-element): Likewise. diff -r ac4af95b962f -r 9ebd08f578f0 lisp/simple.el --- a/lisp/simple.el Thu May 06 18:51:49 1993 +0000 +++ b/lisp/simple.el Thu May 06 18:54:32 1993 +0000 @@ -478,13 +478,18 @@ With prefix argument N, search for Nth previous match. If N is negative, find the next or Nth next match." (interactive - (let ((enable-recursive-minibuffers t) - (minibuffer-history-sexp-flag nil)) - (list (read-from-minibuffer "Previous element matching (regexp): " - nil - minibuffer-local-map - nil - 'minibuffer-history-search-history) + (let* ((enable-recursive-minibuffers t) + (minibuffer-history-sexp-flag nil) + (regexp (read-from-minibuffer "Previous element matching (regexp): " + nil + minibuffer-local-map + nil + 'minibuffer-history-search-history))) + ;; Use the last regexp specified, by default, if input is empty. + (list (if (string= regexp "") + (setcar minibuffer-history-search-history + (nth 1 minibuffer-history-search-history)) + regexp) (prefix-numeric-value current-prefix-arg)))) (let ((history (symbol-value minibuffer-history-variable)) prevpos @@ -518,13 +523,18 @@ With prefix argument N, search for Nth next match. If N is negative, find the previous or Nth previous match." (interactive - (let ((enable-recursive-minibuffers t) - (minibuffer-history-sexp-flag nil)) - (list (read-from-minibuffer "Next element matching (regexp): " - nil - minibuffer-local-map - nil - 'minibuffer-history-search-history) + (let* ((enable-recursive-minibuffers t) + (minibuffer-history-sexp-flag nil) + (regexp (read-from-minibuffer "Next element matching (regexp): " + nil + minibuffer-local-map + nil + 'minibuffer-history-search-history))) + ;; Use the last regexp specified, by default, if input is empty. + (list (if (string= regexp "") + (setcar minibuffer-history-search-history + (nth 1 minibuffer-history-search-history)) + regexp) (prefix-numeric-value current-prefix-arg)))) (previous-matching-history-element regexp (- n)))