comparison lisp/emacs-lisp/pp.el @ 73417:5eddbe565062

(pp-eval-expression): Use `X' to read value. Non-interactive arg is the value, not the expression.
author Richard M. Stallman <rms@gnu.org>
date Wed, 18 Oct 2006 11:02:31 +0000
parents 067115a6e738
children d65affbd0f76 7eeafaaa9eab
comparison
equal deleted inserted replaced
73416:d443f2b23be1 73417:5eddbe565062
95 can handle, whenever this is possible. 95 can handle, whenever this is possible.
96 Output stream is STREAM, or value of `standard-output' (which see)." 96 Output stream is STREAM, or value of `standard-output' (which see)."
97 (princ (pp-to-string object) (or stream standard-output))) 97 (princ (pp-to-string object) (or stream standard-output)))
98 98
99 ;;;###autoload 99 ;;;###autoload
100 (defun pp-eval-expression (expression) 100 (defun pp-eval-expression (expval)
101 "Evaluate EXPRESSION and pretty-print value into a new display buffer. 101 "Evaluate an expression, then pretty-print value EXPVAL into a new buffer.
102 If the pretty-printed value fits on one line, the message line is used 102 If pretty-printed EXPVAL fits on one line, display it in the echo
103 instead. The value is also consed onto the front of the list 103 area instead. Also add EXPVAL to the front of the list
104 in the variable `values'." 104 in the variable `values'.
105 (interactive "xPp-eval: ") 105
106 (setq values (cons (eval expression) values)) 106 Non-interactively, the argument is the value, EXPVAL, not the expression
107 to evaluate."
108 (interactive "XPp-eval: ")
109 (setq values (cons expval values))
107 (let* ((old-show-function temp-buffer-show-function) 110 (let* ((old-show-function temp-buffer-show-function)
108 ;; Use this function to display the buffer. 111 ;; Use this function to display the buffer.
109 ;; This function either decides not to display it at all 112 ;; This function either decides not to display it at all
110 ;; or displays it in the usual way. 113 ;; or displays it in the usual way.
111 (temp-buffer-show-function 114 (temp-buffer-show-function