emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 7f5d92e: Make edebug-eval-last-sexp interactively t


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 7f5d92e: Make edebug-eval-last-sexp interactively take a zero prefix
Date: Tue, 22 Oct 2019 07:12:13 -0400 (EDT)

branch: master
commit 7f5d92e64326173b9d2d14567739390320403ec8
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    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.
---
 doc/lispref/edebug.texi   | 10 +++++++---
 etc/NEWS                  | 10 +++++++---
 lisp/emacs-lisp/edebug.el | 39 +++++++++++++++++++++++++++++----------
 3 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi
index 43665ea..bd287eb 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 d44c853..c13d879 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 7a40ca3..237d939 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
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]