comparison lisp/simple.el @ 53767:6cac586a9c3d

(edit-and-eval-command): Bind print-level and minibuffer-history-sexp-flag around call to read-from-minibuffer. Correct initial position in command-history.
author Luc Teirlinck <teirllm@auburn.edu>
date Sat, 31 Jan 2004 15:05:25 +0000
parents 347987843452
children be1da5092aa4
comparison
equal deleted inserted replaced
53766:ec7e8552309c 53767:6cac586a9c3d
676 (defun edit-and-eval-command (prompt command) 676 (defun edit-and-eval-command (prompt command)
677 "Prompting with PROMPT, let user edit COMMAND and eval result. 677 "Prompting with PROMPT, let user edit COMMAND and eval result.
678 COMMAND is a Lisp expression. Let user edit that expression in 678 COMMAND is a Lisp expression. Let user edit that expression in
679 the minibuffer, then read and evaluate the result." 679 the minibuffer, then read and evaluate the result."
680 (let ((command 680 (let ((command
681 (unwind-protect 681 (let ((print-level nil)
682 (read-from-minibuffer prompt 682 (minibuffer-history-sexp-flag (1+ (minibuffer-depth))))
683 (prin1-to-string command) 683 (unwind-protect
684 read-expression-map t 684 (read-from-minibuffer prompt
685 '(command-history . 1)) 685 (prin1-to-string command)
686 ;; If command was added to command-history as a string, 686 read-expression-map t
687 ;; get rid of that. We want only evaluable expressions there. 687 'command-history)
688 (if (stringp (car command-history)) 688 ;; If command was added to command-history as a string,
689 (setq command-history (cdr command-history)))))) 689 ;; get rid of that. We want only evaluable expressions there.
690 (if (stringp (car command-history))
691 (setq command-history (cdr command-history)))))))
690 692
691 ;; If command to be redone does not match front of history, 693 ;; If command to be redone does not match front of history,
692 ;; add it to the history. 694 ;; add it to the history.
693 (or (equal command (car command-history)) 695 (or (equal command (car command-history))
694 (setq command-history (cons command command-history))) 696 (setq command-history (cons command command-history)))