Make edebug-eval-last-sexp interactively take a zero prefix

* lisp/emacs-lisp/edebug.el (edebug-eval-last-sexp): Make the zero
prefix work analogously to in eval-last-sexp (bug#28895).
(edebug-eval-print-last-sexp): Ditto.
This commit is contained in:
Lars Ingebrigtsen 2019-10-22 13:12:03 +02:00
parent 4a9d8bdca3
commit 7f5d92e643
3 changed files with 43 additions and 16 deletions

View file

@ -705,7 +705,9 @@ Evaluate expression @var{exp} in the context of Edebug itself
@item C-x C-e
Evaluate the expression before point, in the context outside of Edebug
(@code{edebug-eval-last-sexp}).
(@code{edebug-eval-last-sexp}). If given a zero prefix (for instance
@kbd{C-u 0 C-x C-e}), don't shorten long items (like strings and
lists).
@end table
@cindex lexical binding (Edebug)
@ -735,8 +737,10 @@ Manual}) as well as these special commands:
@table @kbd
@item C-j
Evaluate the expression before point, in the outside context, and insert
the value in the buffer (@code{edebug-eval-print-last-sexp}).
Evaluate the expression before point, in the outside context, and
insert the value in the buffer (@code{edebug-eval-print-last-sexp}).
If given a zero prefix (for instance @kbd{C-u 0 C-j}), don't shorten
long items (like strings and lists).
@item C-x C-e
Evaluate the expression before point, in the context outside of Edebug

View file

@ -1473,19 +1473,23 @@ the Elisp manual for documentation of the new mode and its commands.
** Edebug
+++
*** New faces 'edebug-enabled-breakpoint' and 'edebug-disabled-breakpoint'
*** 'edebug-eval-last-sexp' and 'edebug-eval-print-last-sexp' interactively
now take a zero prefix analogously to the non-Edebug counterparts.
+++
*** New faces 'edebug-enabled-breakpoint' and 'edebug-disabled-breakpoint'.
When setting breakpoints in Edebug, an overlay with these faces are
placed over the point in question, depending on whether they are
enabled or not.
+++
*** New command 'edebug-toggle-disable-breakpoint'
*** New command 'edebug-toggle-disable-breakpoint'.
This command allows you to disable a breakpoint temporarily. This is
mainly useful with breakpoints that are conditional and would take
some time to recreate.
+++
*** New command 'edebug-unset-breakpoints'
*** New command 'edebug-unset-breakpoints'.
To clear all breakpoints in the current form, the 'U' command in
'edebug-mode', or 'M-x edebug-unset-breakpoints' can be used.

View file

@ -3749,26 +3749,45 @@ Print result in minibuffer."
(concat (edebug-safe-prin1-to-string (car values))
(eval-expression-print-format (car values))))))
(defun edebug-eval-last-sexp ()
(defun edebug-eval-last-sexp (&optional no-truncate)
"Evaluate sexp before point in the outside environment.
Print value in minibuffer."
(interactive)
(edebug-eval-expression (edebug-last-sexp)))
Print value in minibuffer.
(defun edebug-eval-print-last-sexp ()
If NO-TRUNCATE is non-nil (or interactively with a prefix
argument of zero), show the full length of the expression, not
limited by `edebug-print-length' or `edebug-print-level'."
(interactive
(list (and current-prefix-arg
(zerop (prefix-numeric-value current-prefix-arg)))))
(if no-truncate
(let ((edebug-print-length nil)
(edebug-print-level nil))
(edebug-eval-expression (edebug-last-sexp)))
(edebug-eval-expression (edebug-last-sexp))))
(defun edebug-eval-print-last-sexp (&optional no-truncate)
"Evaluate sexp before point in outside environment; insert value.
This prints the value into current buffer."
(interactive)
This prints the value into current buffer.
If NO-TRUNCATE is non-nil (or interactively with a prefix
argument of zero), show the full length of the expression, not
limited by `edebug-print-length' or `edebug-print-level'."
(interactive
(list (and current-prefix-arg
(zerop (prefix-numeric-value current-prefix-arg)))))
(let* ((form (edebug-last-sexp))
(result-string
(edebug-outside-excursion
(edebug-safe-prin1-to-string (edebug-safe-eval form))))
(if no-truncate
(let ((edebug-print-length nil)
(edebug-print-level nil))
(edebug-safe-prin1-to-string (edebug-safe-eval form)))
(edebug-safe-prin1-to-string (edebug-safe-eval form)))))
(standard-output (current-buffer)))
(princ "\n")
;; princ the string to get rid of quotes.
(princ result-string)
(princ "\n")
))
(princ "\n")))
;;; Edebug Minor Mode