]> git.eshelyaron.com Git - emacs.git/commitdiff
(edit-and-eval-command): Protect command-history.
authorMarkus Rost <rost@math.uni-bielefeld.de>
Tue, 24 Sep 2002 18:40:59 +0000 (18:40 +0000)
committerMarkus Rost <rost@math.uni-bielefeld.de>
Tue, 24 Sep 2002 18:40:59 +0000 (18:40 +0000)
(repeat-complex-command):  Protect command-history.

lisp/ChangeLog
lisp/simple.el

index 2a18f67df0890cf1bd43efa1d33505a6db23ffa3..b1f58215d584e9be65892b1a213c9e20b4a697e5 100644 (file)
@@ -1,3 +1,8 @@
+2002-09-24  Markus Rost  <rost@math.ohio-state.edu>
+
+       * simple.el (edit-and-eval-command):  Protect command-history.
+       (repeat-complex-command):  Protect command-history.
+
 2002-09-24  Juanma Barranquero  <lektu@terra.es>
 
        * replace.el (occur-find-match): New function.
index d94d497180d236b25413ccf1078e9dbbe4bb4b65..ecf0e95a6204fbde8b9574db5f6c63ae3c4ffcc2 100644 (file)
@@ -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.