From: Lars Ingebrigtsen Date: Tue, 22 Oct 2019 11:12:03 +0000 (+0200) Subject: Make edebug-eval-last-sexp interactively take a zero prefix X-Git-Tag: emacs-27.0.90~919 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7f5d92e64326173b9d2d14567739390320403ec8;p=emacs.git 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. --- diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi index 43665ea9ecd..bd287ebe1af 100644 --- a/doc/lispref/edebug.texi +++ b/doc/lispref/edebug.texi @@ -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 diff --git a/etc/NEWS b/etc/NEWS index d44c853cef9..c13d879f1a7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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. diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 7a40ca36b8f..237d93922ff 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -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