changeset 47599:1362c8e5d501

(edit-and-eval-command): Protect command-history. (repeat-complex-command): Protect command-history.
author Markus Rost <rost@math.uni-bielefeld.de>
date Tue, 24 Sep 2002 18:39:48 +0000
parents 0025c3f82558
children 6ff56be7780a
files lisp/simple.el
diffstat 1 files changed, 20 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Tue Sep 24 15:16:39 2002 +0000
+++ b/lisp/simple.el	Tue Sep 24 18:39:48 2002 +0000
@@ -650,14 +650,16 @@
   "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 @@
 		(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.