aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Fox1993-10-05 01:19:12 +0000
committerBrian Fox1993-10-05 01:19:12 +0000
commiteab22e273c4520efbf75836d6d533f083e7890f1 (patch)
tree9c8de97b47e216eb5fe593a3492379f6c28f3826
parent1052acbf95d1767a2dcc9571768f5e8e79a79b51 (diff)
downloademacs-eab22e273c4520efbf75836d6d533f083e7890f1.tar.gz
emacs-eab22e273c4520efbf75836d6d533f083e7890f1.zip
(edit-and-eval-command): Let `read-from-minibuffer' manipulate the
history list, don't manipulate it directly. (repeat-complex-command): Same thing.
-rw-r--r--lisp/simple.el42
1 files changed, 24 insertions, 18 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 581134f80e1..9139298a398 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -394,10 +394,13 @@ COMMAND is a Lisp expression. Let user edit that expression in
394the minibuffer, then read and evaluate the result." 394the minibuffer, then read and evaluate the result."
395 (let ((command (read-from-minibuffer prompt 395 (let ((command (read-from-minibuffer prompt
396 (prin1-to-string command) 396 (prin1-to-string command)
397 read-expression-map t))) 397 read-expression-map t
398 ;; Add edited command to command history, unless redundant. 398 '(command-history . 1))))
399 (or (equal command (car command-history)) 399;;; Don't add the command to the history; read-from-minibuffer has
400 (setq command-history (cons command command-history))) 400;;; already done that.
401;;; ;; Add edited command to command history, unless redundant.
402;;; (or (equal command (car command-history))
403;;; (setq command-history (cons command command-history)))
401 (eval command))) 404 (eval command)))
402 405
403(defun repeat-complex-command (arg) 406(defun repeat-complex-command (arg)
@@ -416,20 +419,23 @@ to get different commands to edit and resubmit."
416 newcmd) 419 newcmd)
417 (if elt 420 (if elt
418 (progn 421 (progn
419 (setq newcmd (read-from-minibuffer "Redo: " 422 (setq newcmd
420 (prin1-to-string elt) 423 (read-from-minibuffer
421 read-expression-map 424 "Redo: " (prin1-to-string elt) read-expression-map t
422 t 425 (cons 'command-history arg)))
423 (cons 'command-history 426
424 arg))) 427;;; read-from-minibuffer handles the adding of what is read to the history
425 ;; If command was added to command-history as a string, 428;;; variable.
426 ;; get rid of that. We want only evallable expressions there. 429;;;
427 (if (stringp (car command-history)) 430;;; ;; If command was added to command-history as a string,
428 (setq command-history (cdr command-history))) 431;;; ;; get rid of that. We want only evallable expressions there.
429 ;; If command to be redone does not match front of history, 432;;; (if (stringp (car command-history))
430 ;; add it to the history. 433;;; (setq command-history (cdr command-history)))
431 (or (equal newcmd (car command-history)) 434;;;
432 (setq command-history (cons newcmd command-history))) 435;;; ;; If command to be redone does not match front of history,
436;;; ;; add it to the history.
437;;; (or (equal newcmd (car command-history))
438;;; (setq command-history (cons newcmd command-history)))
433 (eval newcmd)) 439 (eval newcmd))
434 (ding)))) 440 (ding))))
435 441