Commit 99ea24de authored by Karl Heuer's avatar Karl Heuer
Browse files

(previous-matching-history-element): No need to bind

minibuffer-history-sexp-flag any more.
(next-matching-history-element): Likewise.
(repeat-complex-command): Bind
minibuffer-history-sexp-flag to the minibuffer depth.
(next-history-element): Compare minibuffer-history-sexp-flag
against the current minibuffer depth to verify its validity.
(previous-matching-history-element): Likewise.
(minibuffer-history-sexp-flag): Update doc string.
parent 39f9c424
...@@ -563,7 +563,7 @@ to get different commands to edit and resubmit." ...@@ -563,7 +563,7 @@ to get different commands to edit and resubmit."
(setq newcmd (setq newcmd
(let ((print-level nil) (let ((print-level nil)
(minibuffer-history-position arg) (minibuffer-history-position arg)
(minibuffer-history-sexp-flag t)) (minibuffer-history-sexp-flag (1+ (minibuffer-depth))))
(read-from-minibuffer (read-from-minibuffer
"Redo: " (prin1-to-string elt) read-expression-map t "Redo: " (prin1-to-string elt) read-expression-map t
(cons 'command-history arg)))) (cons 'command-history arg))))
...@@ -587,7 +587,9 @@ except when an alternate history list is specified.") ...@@ -587,7 +587,9 @@ except when an alternate history list is specified.")
(defvar minibuffer-history-sexp-flag nil (defvar minibuffer-history-sexp-flag nil
"Non-nil when doing history operations on `command-history'. "Non-nil when doing history operations on `command-history'.
More generally, indicates that the history list being acted on More generally, indicates that the history list being acted on
contains expressions rather than strings.") contains expressions rather than strings.
It is only valid if its value equals the current minibuffer depth,
to handle recursive uses of the minibuffer.")
(setq minibuffer-history-variable 'minibuffer-history) (setq minibuffer-history-variable 'minibuffer-history)
(setq minibuffer-history-position nil) (setq minibuffer-history-position nil)
(defvar minibuffer-history-search-history nil) (defvar minibuffer-history-search-history nil)
...@@ -639,7 +641,6 @@ With prefix argument N, search for Nth previous match. ...@@ -639,7 +641,6 @@ With prefix argument N, search for Nth previous match.
If N is negative, find the next or Nth next match." If N is negative, find the next or Nth next match."
(interactive (interactive
(let* ((enable-recursive-minibuffers t) (let* ((enable-recursive-minibuffers t)
(minibuffer-history-sexp-flag nil)
(regexp (read-from-minibuffer "Previous element matching (regexp): " (regexp (read-from-minibuffer "Previous element matching (regexp): "
nil nil
minibuffer-local-map minibuffer-local-map
...@@ -666,7 +667,8 @@ If N is negative, find the next or Nth next match." ...@@ -666,7 +667,8 @@ If N is negative, find the next or Nth next match."
"No later matching history item" "No later matching history item"
"No earlier matching history item"))) "No earlier matching history item")))
(if (string-match regexp (if (string-match regexp
(if minibuffer-history-sexp-flag (if (eq minibuffer-history-sexp-flag
(minibuffer-depth))
(let ((print-level nil)) (let ((print-level nil))
(prin1-to-string (nth (1- pos) history))) (prin1-to-string (nth (1- pos) history)))
(nth (1- pos) history))) (nth (1- pos) history)))
...@@ -674,7 +676,7 @@ If N is negative, find the next or Nth next match." ...@@ -674,7 +676,7 @@ If N is negative, find the next or Nth next match."
(setq minibuffer-history-position pos) (setq minibuffer-history-position pos)
(erase-buffer) (erase-buffer)
(let ((elt (nth (1- pos) history))) (let ((elt (nth (1- pos) history)))
(insert (if minibuffer-history-sexp-flag (insert (if (eq minibuffer-history-sexp-flag (minibuffer-depth))
(let ((print-level nil)) (let ((print-level nil))
(prin1-to-string elt)) (prin1-to-string elt))
elt))) elt)))
...@@ -690,7 +692,6 @@ With prefix argument N, search for Nth next match. ...@@ -690,7 +692,6 @@ With prefix argument N, search for Nth next match.
If N is negative, find the previous or Nth previous match." If N is negative, find the previous or Nth previous match."
(interactive (interactive
(let* ((enable-recursive-minibuffers t) (let* ((enable-recursive-minibuffers t)
(minibuffer-history-sexp-flag nil)
(regexp (read-from-minibuffer "Next element matching (regexp): " (regexp (read-from-minibuffer "Next element matching (regexp): "
nil nil
minibuffer-local-map minibuffer-local-map
...@@ -728,7 +729,7 @@ If N is negative, find the previous or Nth previous match." ...@@ -728,7 +729,7 @@ If N is negative, find the previous or Nth previous match."
(t (setq elt (nth (1- minibuffer-history-position) (t (setq elt (nth (1- minibuffer-history-position)
(symbol-value minibuffer-history-variable))))) (symbol-value minibuffer-history-variable)))))
(insert (insert
(if minibuffer-history-sexp-flag (if (eq minibuffer-history-sexp-flag (minibuffer-depth))
(let ((print-level nil)) (let ((print-level nil))
(prin1-to-string elt)) (prin1-to-string elt))
elt)) elt))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment