* 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
This commit is contained in:
parent
4594572710
commit
b41594fd4d
6 changed files with 83 additions and 22 deletions
6
etc/NEWS
6
etc/NEWS
|
@ -119,6 +119,12 @@ non-nil, they output the same results.
|
||||||
** `eval-defun' on an already defined defcustom calls the :set function,
|
** `eval-defun' on an already defined defcustom calls the :set function,
|
||||||
if there is one.
|
if there is one.
|
||||||
|
|
||||||
|
** A zero prefix arg of `eval-last-sexp' (`C-x C-e'),
|
||||||
|
`eval-expression' (`M-:') and `eval-print-last-sexp' (`C-j') inserts
|
||||||
|
a list with no limit on its length and level (by using nil values of
|
||||||
|
`print-length' and `print-level'), and inserts additional formats for
|
||||||
|
integers (octal, hexadecimal, and character).
|
||||||
|
|
||||||
** If the new variable `enable-dir-local-variables' is nil,
|
** If the new variable `enable-dir-local-variables' is nil,
|
||||||
directory local variables are ignored. May be useful for some modes
|
directory local variables are ignored. May be useful for some modes
|
||||||
that want to ignore directory-locals while still respecting file-locals.
|
that want to ignore directory-locals while still respecting file-locals.
|
||||||
|
|
|
@ -1,3 +1,30 @@
|
||||||
|
2013-12-19 Juri Linkov <juri@jurta.org>
|
||||||
|
|
||||||
|
* 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. (Bug#12985)
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
|
* emacs-lisp/edebug.el (edebug-eval-defun): Print the integer
|
||||||
|
values from `eval-expression-print-format' at the end.
|
||||||
|
|
||||||
|
* ielm.el (ielm-eval-input): Print the integer
|
||||||
|
values from `eval-expression-print-format' at the end.
|
||||||
|
|
||||||
2013-12-19 Teodor Zlatanov <tzz@lifelogs.com>
|
2013-12-19 Teodor Zlatanov <tzz@lifelogs.com>
|
||||||
|
|
||||||
* net/eww.el (eww-exit, eww-close, eww-mode-map): Revert change of
|
* net/eww.el (eww-exit, eww-close, eww-mode-map): Revert change of
|
||||||
|
|
|
@ -497,7 +497,10 @@ the minibuffer."
|
||||||
(put (nth 1 form) 'saved-face nil)))))
|
(put (nth 1 form) 'saved-face nil)))))
|
||||||
(setq edebug-result (eval (eval-sexp-add-defvars form) lexical-binding))
|
(setq edebug-result (eval (eval-sexp-add-defvars form) lexical-binding))
|
||||||
(if (not edebugging)
|
(if (not edebugging)
|
||||||
(princ edebug-result)
|
(prog1
|
||||||
|
(princ edebug-result)
|
||||||
|
(let ((str (eval-expression-print-format edebug-result)))
|
||||||
|
(if str (princ str))))
|
||||||
edebug-result)))
|
edebug-result)))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -858,7 +858,7 @@ Semicolons start comments.
|
||||||
\\{lisp-interaction-mode-map}"
|
\\{lisp-interaction-mode-map}"
|
||||||
:abbrev-table nil)
|
:abbrev-table nil)
|
||||||
|
|
||||||
(defun eval-print-last-sexp ()
|
(defun eval-print-last-sexp (&optional eval-last-sexp-arg-internal)
|
||||||
"Evaluate sexp before point; print value into current buffer.
|
"Evaluate sexp before point; print value into current buffer.
|
||||||
|
|
||||||
If `eval-expression-debug-on-error' is non-nil, which is the default,
|
If `eval-expression-debug-on-error' is non-nil, which is the default,
|
||||||
|
@ -866,11 +866,13 @@ this command arranges for all errors to enter the debugger.
|
||||||
|
|
||||||
Note that printing the result is controlled by the variables
|
Note that printing the result is controlled by the variables
|
||||||
`eval-expression-print-length' and `eval-expression-print-level',
|
`eval-expression-print-length' and `eval-expression-print-level',
|
||||||
which see."
|
which see. With a zero prefix arg, print output with no limit
|
||||||
(interactive)
|
on the length and level of lists, and include additional formats
|
||||||
|
for integers (octal, hexadecimal, and character)."
|
||||||
|
(interactive "P")
|
||||||
(let ((standard-output (current-buffer)))
|
(let ((standard-output (current-buffer)))
|
||||||
(terpri)
|
(terpri)
|
||||||
(eval-last-sexp t)
|
(eval-last-sexp (or eval-last-sexp-arg-internal t))
|
||||||
(terpri)))
|
(terpri)))
|
||||||
|
|
||||||
|
|
||||||
|
@ -1013,18 +1015,26 @@ If CHAR is not a character, return nil."
|
||||||
|
|
||||||
(defun eval-last-sexp-1 (eval-last-sexp-arg-internal)
|
(defun eval-last-sexp-1 (eval-last-sexp-arg-internal)
|
||||||
"Evaluate sexp before point; print value in the echo area.
|
"Evaluate sexp before point; print value in the echo area.
|
||||||
With argument, print output into current buffer."
|
With argument, print output into current buffer.
|
||||||
|
With a zero prefix arg, print output with no limit on the length
|
||||||
|
and level of lists, and include additional formats for integers
|
||||||
|
\(octal, hexadecimal, and character)."
|
||||||
(let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t)))
|
(let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t)))
|
||||||
;; Setup the lexical environment if lexical-binding is enabled.
|
;; Setup the lexical environment if lexical-binding is enabled.
|
||||||
(eval-last-sexp-print-value
|
(eval-last-sexp-print-value
|
||||||
(eval (eval-sexp-add-defvars (preceding-sexp)) lexical-binding))))
|
(eval (eval-sexp-add-defvars (preceding-sexp)) lexical-binding)
|
||||||
|
eval-last-sexp-arg-internal)))
|
||||||
|
|
||||||
|
|
||||||
(defun eval-last-sexp-print-value (value)
|
(defun eval-last-sexp-print-value (value &optional eval-last-sexp-arg-internal)
|
||||||
(let ((unabbreviated (let ((print-length nil) (print-level nil))
|
(let ((unabbreviated (let ((print-length nil) (print-level nil))
|
||||||
(prin1-to-string value)))
|
(prin1-to-string value)))
|
||||||
(print-length eval-expression-print-length)
|
(print-length (and (not (zerop (prefix-numeric-value
|
||||||
(print-level eval-expression-print-level)
|
eval-last-sexp-arg-internal)))
|
||||||
|
eval-expression-print-length))
|
||||||
|
(print-level (and (not (zerop (prefix-numeric-value
|
||||||
|
eval-last-sexp-arg-internal)))
|
||||||
|
eval-expression-print-level))
|
||||||
(beg (point))
|
(beg (point))
|
||||||
end)
|
end)
|
||||||
(prog1
|
(prog1
|
||||||
|
@ -1070,6 +1080,9 @@ POS specifies the starting position where EXP was found and defaults to point."
|
||||||
Interactively, with prefix argument, print output into current buffer.
|
Interactively, with prefix argument, print output into current buffer.
|
||||||
Truncates long output according to the value of the variables
|
Truncates long output according to the value of the variables
|
||||||
`eval-expression-print-length' and `eval-expression-print-level'.
|
`eval-expression-print-length' and `eval-expression-print-level'.
|
||||||
|
With a zero prefix arg, print output with no limit on the length
|
||||||
|
and level of lists, and include additional formats for integers
|
||||||
|
\(octal, hexadecimal, and character).
|
||||||
|
|
||||||
If `eval-expression-debug-on-error' is non-nil, which is the default,
|
If `eval-expression-debug-on-error' is non-nil, which is the default,
|
||||||
this command arranges for all errors to enter the debugger."
|
this command arranges for all errors to enter the debugger."
|
||||||
|
@ -1167,6 +1180,8 @@ Return the result of evaluation."
|
||||||
;; will make eval-region return.
|
;; will make eval-region return.
|
||||||
(goto-char end)
|
(goto-char end)
|
||||||
form))))))
|
form))))))
|
||||||
|
(let ((str (eval-expression-print-format (car values))))
|
||||||
|
(if str (princ str)))
|
||||||
;; The result of evaluation has been put onto VALUES. So return it.
|
;; The result of evaluation has been put onto VALUES. So return it.
|
||||||
(car values))
|
(car values))
|
||||||
|
|
||||||
|
|
|
@ -458,7 +458,9 @@ nonempty, then flushes the buffer."
|
||||||
;; Self-referential objects cause loops in the printer, so
|
;; Self-referential objects cause loops in the printer, so
|
||||||
;; trap quits here. May as well do errors, too
|
;; trap quits here. May as well do errors, too
|
||||||
(unless for-effect
|
(unless for-effect
|
||||||
(setq output (concat output (pp-to-string result))))
|
(setq output (concat output (pp-to-string result)
|
||||||
|
(let ((str (eval-expression-print-format result)))
|
||||||
|
(if str (propertize str 'font-lock-face 'shadow))))))
|
||||||
(error (setq error-type "IELM Error")
|
(error (setq error-type "IELM Error")
|
||||||
(setq result "Error during pretty-printing (bug in pp)"))
|
(setq result "Error during pretty-printing (bug in pp)"))
|
||||||
(quit (setq error-type "IELM Error")
|
(quit (setq error-type "IELM Error")
|
||||||
|
|
|
@ -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
|
in addition to the value printed by prin1 in functions which
|
||||||
display the result of expression evaluation."
|
display the result of expression evaluation."
|
||||||
(if (and (integerp value)
|
(if (and (integerp value)
|
||||||
(or (not (memq this-command '(eval-last-sexp eval-print-last-sexp)))
|
(or (eq standard-output t)
|
||||||
(eq this-command last-command)
|
(zerop (prefix-numeric-value current-prefix-arg))))
|
||||||
(if (boundp 'edebug-active) edebug-active)))
|
|
||||||
(let ((char-string
|
(let ((char-string
|
||||||
(if (or (if (boundp 'edebug-active) edebug-active)
|
(if (and (characterp value)
|
||||||
(memq this-command '(eval-last-sexp eval-print-last-sexp)))
|
(char-displayable-p value))
|
||||||
(prin1-char value))))
|
(prin1-char value))))
|
||||||
(if char-string
|
(if char-string
|
||||||
(format " (#o%o, #x%x, %s)" value value char-string)
|
(format " (#o%o, #x%x, %s)" value value char-string)
|
||||||
(format " (#o%o, #x%x)" value value)))))
|
(format " (#o%o, #x%x)" value value)))))
|
||||||
|
@ -1399,8 +1398,11 @@ evaluate it.
|
||||||
Value is also consed on to front of the variable `values'.
|
Value is also consed on to front of the variable `values'.
|
||||||
Optional argument INSERT-VALUE non-nil (interactively,
|
Optional argument INSERT-VALUE non-nil (interactively,
|
||||||
with prefix argument) means insert the result into the current buffer
|
with prefix argument) means insert the result into the current buffer
|
||||||
instead of printing it in the echo area. Truncates long output
|
instead of printing it in the echo area. With a zero prefix arg,
|
||||||
according to the value of the variables `eval-expression-print-length'
|
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'.
|
and `eval-expression-print-level'.
|
||||||
|
|
||||||
If `eval-expression-debug-on-error' is non-nil, which is the default,
|
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)
|
(unless (eq old-value new-value)
|
||||||
(setq debug-on-error new-value))))
|
(setq debug-on-error new-value))))
|
||||||
|
|
||||||
(let ((print-length eval-expression-print-length)
|
(let ((print-length (and (not (zerop (prefix-numeric-value insert-value)))
|
||||||
(print-level eval-expression-print-level)
|
eval-expression-print-length))
|
||||||
|
(print-level (and (not (zerop (prefix-numeric-value insert-value)))
|
||||||
|
eval-expression-print-level))
|
||||||
(deactivate-mark))
|
(deactivate-mark))
|
||||||
(if insert-value
|
(if insert-value
|
||||||
(with-no-warnings
|
(with-no-warnings
|
||||||
(let ((standard-output (current-buffer)))
|
(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
|
(prog1
|
||||||
(prin1 (car values) t)
|
(prin1 (car values) t)
|
||||||
(let ((str (eval-expression-print-format (car values))))
|
(let ((str (eval-expression-print-format (car values))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue