summaryrefslogtreecommitdiff
path: root/lisp/simple.el
diff options
context:
space:
mode:
authorMarkus Rost <rost@math.uni-bielefeld.de>2002-09-24 18:40:59 +0000
committerMarkus Rost <rost@math.uni-bielefeld.de>2002-09-24 18:40:59 +0000
commit9f4b608417309d0480fe17f679d1173cbc534b6f (patch)
tree485b1eea7fe8691be3cb4556b141d8fb127953c3 /lisp/simple.el
parent2f552813381994f6bd1ffa56f7179a6d919a351f (diff)
downloademacs-9f4b608417309d0480fe17f679d1173cbc534b6f.tar.gz
(edit-and-eval-command): Protect command-history.
(repeat-complex-command): Protect command-history.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r--lisp/simple.el36
1 files changed, 20 insertions, 16 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index d94d497180d..ecf0e95a620 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -650,14 +650,16 @@ the echo area."
"Prompting with PROMPT, let user edit COMMAND and eval result.
COMMAND is a Lisp expression. Let user edit that expression in
the minibuffer, then read and evaluate the result."
- (let ((command (read-from-minibuffer prompt
- (prin1-to-string command)
- read-expression-map t
- '(command-history . 1))))
- ;; If command was added to command-history as a string,
- ;; get rid of that. We want only evaluable expressions there.
- (if (stringp (car command-history))
- (setq command-history (cdr command-history)))
+ (let ((command
+ (unwind-protect
+ (read-from-minibuffer prompt
+ (prin1-to-string command)
+ read-expression-map t
+ '(command-history . 1))
+ ;; If command was added to command-history as a string,
+ ;; get rid of that. We want only evaluable expressions there.
+ (if (stringp (car command-history))
+ (setq command-history (cdr command-history))))))
;; If command to be redone does not match front of history,
;; add it to the history.
@@ -683,14 +685,16 @@ to get different commands to edit and resubmit."
(let ((print-level nil)
(minibuffer-history-position arg)
(minibuffer-history-sexp-flag (1+ (minibuffer-depth))))
- (read-from-minibuffer
- "Redo: " (prin1-to-string elt) read-expression-map t
- (cons 'command-history arg))))
-
- ;; If command was added to command-history as a string,
- ;; get rid of that. We want only evaluable expressions there.
- (if (stringp (car command-history))
- (setq command-history (cdr command-history)))
+ (unwind-protect
+ (read-from-minibuffer
+ "Redo: " (prin1-to-string elt) read-expression-map t
+ (cons 'command-history arg))
+
+ ;; If command was added to command-history as a
+ ;; string, get rid of that. We want only
+ ;; evaluable expressions there.
+ (if (stringp (car command-history))
+ (setq command-history (cdr command-history))))))
;; If command to be redone does not match front of history,
;; add it to the history.