emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bugs in edit-and-eval-command


From: Luc Teirlinck
Subject: bugs in edit-and-eval-command
Date: Thu, 29 Jan 2004 20:56:22 -0600 (CST)

After emacs -q, M-x ielm and:

*** Welcome to IELM ***  Type (describe-mode) for help.
ELISP> (edit-and-eval-command "Input: " '(cons 1 1))
(1 . 1)

ELISP> (edit-and-eval-command "Input: " '(cons 2 2))
(2 . 2)

ELISP> (edit-and-eval-command "Input: " '(cons 3 3))

We have (cons 3 3) in the minibuffer.

Doing M-p yields the error message:

previous-history-element: Wrong type argument: char-or-string-p, (cons 1 1)

There are two things wrong here:
We should _not_ get an error message and the previous history element
should be (cons 2 2), _not_ (cons 1 1).

The following patch solves both problems.  I could install if desired.


===File ~/simple-diff=======================================
*** simple.el.~1.626.~  Thu Jan 22 15:50:21 2004
--- simple.el   Thu Jan 29 20:07:49 2004
***************
*** 678,692 ****
  COMMAND is a Lisp expression.  Let user edit that expression in
  the minibuffer, then read and evaluate the result."
    (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.
--- 678,694 ----
  COMMAND is a Lisp expression.  Let user edit that expression in
  the minibuffer, then read and evaluate the result."
    (let ((command
!        (let ((print-level nil)
!              (minibuffer-history-sexp-flag (1+ (minibuffer-depth))))
!          (unwind-protect
!              (read-from-minibuffer prompt
!                                    (prin1-to-string command)
!                                    read-expression-map t
!                                    'command-history)
!            ;; 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.
============================================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]