diff options
| -rw-r--r-- | doc/lispref/debugging.texi | 31 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/cus-start.el | 1 | ||||
| -rw-r--r-- | lisp/emacs-lisp/debug.el | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/edebug.el | 4 | ||||
| -rw-r--r-- | src/eval.c | 12 |
6 files changed, 53 insertions, 4 deletions
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi index 2f83b4040fa..710ab92fda5 100644 --- a/doc/lispref/debugging.texi +++ b/doc/lispref/debugging.texi | |||
| @@ -623,6 +623,37 @@ forms are elided. | |||
| 623 | @end smallexample | 623 | @end smallexample |
| 624 | @end deffn | 624 | @end deffn |
| 625 | 625 | ||
| 626 | @defvar debugger-stack-frame-as-list | ||
| 627 | If this variable is non-@code{nil}, every stack frame of the backtrace | ||
| 628 | is displayed as a list. This aims at improving the backtrace | ||
| 629 | readability at the cost of special forms no longer being visually | ||
| 630 | different from regular function calls. | ||
| 631 | |||
| 632 | With @code{debugger-stack-frame-as-list} non-@code{nil}, the above | ||
| 633 | example would look as follows: | ||
| 634 | |||
| 635 | @smallexample | ||
| 636 | @group | ||
| 637 | ----------- Buffer: backtrace-output ------------ | ||
| 638 | (backtrace) | ||
| 639 | (list ...computing arguments...) | ||
| 640 | @end group | ||
| 641 | (progn ...) | ||
| 642 | (eval (progn (1+ var) (list (quote testing) (backtrace)))) | ||
| 643 | (setq ...) | ||
| 644 | (save-excursion ...) | ||
| 645 | (let ...) | ||
| 646 | (with-output-to-temp-buffer ...) | ||
| 647 | (eval (with-output-to-temp-buffer ...)) | ||
| 648 | (eval-last-sexp-1 nil) | ||
| 649 | @group | ||
| 650 | (eval-last-sexp nil) | ||
| 651 | (call-interactively eval-last-sexp) | ||
| 652 | ----------- Buffer: backtrace-output ------------ | ||
| 653 | @end group | ||
| 654 | @end smallexample | ||
| 655 | @end defvar | ||
| 656 | |||
| 626 | @defvar debug-on-next-call | 657 | @defvar debug-on-next-call |
| 627 | @cindex @code{eval}, and debugging | 658 | @cindex @code{eval}, and debugging |
| 628 | @cindex @code{apply}, and debugging | 659 | @cindex @code{apply}, and debugging |
| @@ -205,6 +205,11 @@ questions, with a handy way to display help texts. | |||
| 205 | +++ | 205 | +++ |
| 206 | ** 'switch-to-buffer-preserve-window-point' now defaults to t. | 206 | ** 'switch-to-buffer-preserve-window-point' now defaults to t. |
| 207 | 207 | ||
| 208 | +++ | ||
| 209 | ** The new variable 'debugger-stack-frame-as-list' allows displaying | ||
| 210 | all call stack frames in a Lisp backtrace buffer as lists. Both | ||
| 211 | debug.el and edebug.el have been updated to heed to this variable. | ||
| 212 | |||
| 208 | 213 | ||
| 209 | * Editing Changes in Emacs 25.3 | 214 | * Editing Changes in Emacs 25.3 |
| 210 | 215 | ||
diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 2b79bbbfda1..d9ad0a5971e 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el | |||
| @@ -246,6 +246,7 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of | |||
| 246 | (debug-ignored-errors debug (repeat (choice symbol regexp))) | 246 | (debug-ignored-errors debug (repeat (choice symbol regexp))) |
| 247 | (debug-on-quit debug boolean) | 247 | (debug-on-quit debug boolean) |
| 248 | (debug-on-signal debug boolean) | 248 | (debug-on-signal debug boolean) |
| 249 | (debugger-stack-frame-as-list debugger boolean) | ||
| 249 | ;; fileio.c | 250 | ;; fileio.c |
| 250 | (delete-by-moving-to-trash auto-save boolean "23.1") | 251 | (delete-by-moving-to-trash auto-save boolean "23.1") |
| 251 | (auto-save-visited-file-name auto-save boolean) | 252 | (auto-save-visited-file-name auto-save boolean) |
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index 22a3f3935f2..7d273809fcd 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el | |||
| @@ -279,7 +279,9 @@ That buffer should be current already." | |||
| 279 | (goto-char (point-min)) | 279 | (goto-char (point-min)) |
| 280 | (delete-region (point) | 280 | (delete-region (point) |
| 281 | (progn | 281 | (progn |
| 282 | (search-forward "\n debug(") | 282 | (search-forward (if debugger-stack-frame-as-list |
| 283 | "\n (debug " | ||
| 284 | "\n debug(")) | ||
| 283 | (forward-line (if (eq (car args) 'debug) | 285 | (forward-line (if (eq (car args) 'debug) |
| 284 | ;; Remove debug--implement-debug-on-entry | 286 | ;; Remove debug--implement-debug-on-entry |
| 285 | ;; and the advice's `apply' frame. | 287 | ;; and the advice's `apply' frame. |
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 1a00c45447c..6918539e229 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el | |||
| @@ -3798,7 +3798,9 @@ Otherwise call `debug' normally." | |||
| 3798 | (forward-line 1) | 3798 | (forward-line 1) |
| 3799 | (delete-region last-ok-point (point))) | 3799 | (delete-region last-ok-point (point))) |
| 3800 | 3800 | ||
| 3801 | ((looking-at "^ edebug") | 3801 | ((looking-at (if debugger-stack-frame-as-list |
| 3802 | "^ (edebug" | ||
| 3803 | "^ edebug")) | ||
| 3802 | (forward-line 1) | 3804 | (forward-line 1) |
| 3803 | (delete-region last-ok-point (point)) | 3805 | (delete-region last-ok-point (point)) |
| 3804 | ))) | 3806 | ))) |
diff --git a/src/eval.c b/src/eval.c index e08a25a31a0..407561082d1 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -3421,13 +3421,17 @@ Output stream used is value of `standard-output'. */) | |||
| 3421 | else | 3421 | else |
| 3422 | { | 3422 | { |
| 3423 | tem = backtrace_function (pdl); | 3423 | tem = backtrace_function (pdl); |
| 3424 | if (debugger_stack_frame_as_list) | ||
| 3425 | write_string ("("); | ||
| 3424 | Fprin1 (tem, Qnil); /* This can QUIT. */ | 3426 | Fprin1 (tem, Qnil); /* This can QUIT. */ |
| 3425 | write_string ("("); | 3427 | if (!debugger_stack_frame_as_list) |
| 3428 | write_string ("("); | ||
| 3426 | { | 3429 | { |
| 3427 | ptrdiff_t i; | 3430 | ptrdiff_t i; |
| 3428 | for (i = 0; i < backtrace_nargs (pdl); i++) | 3431 | for (i = 0; i < backtrace_nargs (pdl); i++) |
| 3429 | { | 3432 | { |
| 3430 | if (i) write_string (" "); | 3433 | if (i || debugger_stack_frame_as_list) |
| 3434 | write_string(" "); | ||
| 3431 | Fprin1 (backtrace_args (pdl)[i], Qnil); | 3435 | Fprin1 (backtrace_args (pdl)[i], Qnil); |
| 3432 | } | 3436 | } |
| 3433 | } | 3437 | } |
| @@ -3850,6 +3854,10 @@ This is nil when the debugger is called under circumstances where it | |||
| 3850 | might not be safe to continue. */); | 3854 | might not be safe to continue. */); |
| 3851 | debugger_may_continue = 1; | 3855 | debugger_may_continue = 1; |
| 3852 | 3856 | ||
| 3857 | DEFVAR_BOOL ("debugger-stack-frame-as-list", debugger_stack_frame_as_list, | ||
| 3858 | doc: /* Non-nil means display call stack frames as lists. */); | ||
| 3859 | debugger_stack_frame_as_list = 0; | ||
| 3860 | |||
| 3853 | DEFVAR_LISP ("debugger", Vdebugger, | 3861 | DEFVAR_LISP ("debugger", Vdebugger, |
| 3854 | doc: /* Function to call to invoke debugger. | 3862 | doc: /* Function to call to invoke debugger. |
| 3855 | If due to frame exit, args are `exit' and the value being returned; | 3863 | If due to frame exit, args are `exit' and the value being returned; |