diff options
author | Juri Linkov <juri@jurta.org> | 2013-12-19 23:02:46 +0200 |
---|---|---|
committer | Juri Linkov <juri@jurta.org> | 2013-12-19 23:02:46 +0200 |
commit | b41594fd4d77194a6781ee5a84e01142ad1b72e7 (patch) | |
tree | 84cb4eb66d7dea9cee8708a53a3d2160dd80b4d8 /lisp/simple.el | |
parent | 459457271091c8bb0b6734fe9bd709e86a8c66c1 (diff) | |
download | emacs-b41594fd4d77194a6781ee5a84e01142ad1b72e7.tar.gz |
* lisp/simple.el (eval-expression-print-format): Don't check for
command names and the last command. Always display additional
formats of the integer result in the echo area, and insert them
to the current buffer only with a zero prefix arg.
Display character when char-displayable-p is non-nil.
(eval-expression): With a zero prefix arg, set `print-length' and
`print-level' to nil, and insert the integer values from
`eval-expression-print-format' at the end. Doc fix.
* lisp/emacs-lisp/lisp-mode.el (eval-print-last-sexp): Add arg
`eval-last-sexp-arg-internal'. Doc fix.
(eval-last-sexp-1): Pass arg `eval-last-sexp-arg-internal' to
`eval-last-sexp-print-value'. Doc fix.
(eval-last-sexp-print-value): Add arg `eval-last-sexp-arg-internal'.
Set `print-length' and `print-level' to nil when arg is zero.
(eval-last-sexp): Doc fix.
(eval-defun-2): Print the integer values from
`eval-expression-print-format' at the end.
* lisp/emacs-lisp/edebug.el (edebug-eval-defun): Print the integer
values from `eval-expression-print-format' at the end.
* lisp/ielm.el (ielm-eval-input): Print the integer
values from `eval-expression-print-format' at the end.
Fixes: debbugs:12985
Diffstat (limited to 'lisp/simple.el')
-rw-r--r-- | lisp/simple.el | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 61068efce59..5101bfb26f8 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1365,13 +1365,12 @@ Return a formatted string which is displayed in the echo area in addition to the value printed by prin1 in functions which display the result of expression evaluation." (if (and (integerp value) - (or (not (memq this-command '(eval-last-sexp eval-print-last-sexp))) - (eq this-command last-command) - (if (boundp 'edebug-active) edebug-active))) + (or (eq standard-output t) + (zerop (prefix-numeric-value current-prefix-arg)))) (let ((char-string - (if (or (if (boundp 'edebug-active) edebug-active) - (memq this-command '(eval-last-sexp eval-print-last-sexp))) - (prin1-char value)))) + (if (and (characterp value) + (char-displayable-p value)) + (prin1-char value)))) (if char-string (format " (#o%o, #x%x, %s)" value value char-string) (format " (#o%o, #x%x)" value value))))) @@ -1399,8 +1398,11 @@ evaluate it. Value is also consed on to front of the variable `values'. Optional argument INSERT-VALUE non-nil (interactively, with prefix argument) means insert the result into the current buffer -instead of printing it in the echo area. Truncates long output -according to the value of the variables `eval-expression-print-length' +instead of printing it in the echo area. With a zero prefix arg, +insert the result with no limit on the length and level of lists, +and include additional formats for integers (octal, hexadecimal, +and character). Truncates long output according to the value +of the variables `eval-expression-print-length' and `eval-expression-print-level'. If `eval-expression-debug-on-error' is non-nil, which is the default, @@ -1422,13 +1424,19 @@ this command arranges for all errors to enter the debugger." (unless (eq old-value new-value) (setq debug-on-error new-value)))) - (let ((print-length eval-expression-print-length) - (print-level eval-expression-print-level) + (let ((print-length (and (not (zerop (prefix-numeric-value insert-value))) + eval-expression-print-length)) + (print-level (and (not (zerop (prefix-numeric-value insert-value))) + eval-expression-print-level)) (deactivate-mark)) (if insert-value (with-no-warnings (let ((standard-output (current-buffer))) - (prin1 (car values)))) + (prog1 + (prin1 (car values)) + (when (zerop (prefix-numeric-value insert-value)) + (let ((str (eval-expression-print-format (car values)))) + (if str (princ str))))))) (prog1 (prin1 (car values) t) (let ((str (eval-expression-print-format (car values)))) |