From 792b3d23233b65eebe5ceeacc635175372de5fca Mon Sep 17 00:00:00 2001 From: Robin Templeton Date: Tue, 23 Sep 2014 00:44:45 -0400 Subject: cut debugger frames from backtraces Thanks to Oleg Sivokon for the report. * lisp/emacs-lisp/debug.el (debug-inner-cut): New variable. (debug-1): New function extracted from `debug'. (debug): Call `debug-1' in a new prompt, binding `debug-inner-cut' to the prompt tag. (debugger-setup-buffer): Cut the backtrace with `debug-inner-cut'. --- lisp/emacs-lisp/debug.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index e3d5cdc341..61d8717791 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -125,6 +125,8 @@ where CAUSE can be: - exit: called because of exit of a flagged function. - error: called because of `debug-on-error'.") +(defvar debug-inner-cut) + ;;;###autoload (setq debugger 'debug) ;;;###autoload @@ -137,6 +139,13 @@ You may call with no args, or you may pass nil as the first arg and any other args you like. In that case, the list of args after the first will be printed into the backtrace buffer." (interactive) + (let ((debug-inner-cut (funcall (@ (guile) make-prompt-tag)))) + (funcall (@ (guile) call-with-prompt) + debug-inner-cut + (lambda () (apply #'debug-1 args)) + (lambda (k &rest ignore) nil)))) + +(defun debug-1 (&rest args) (if inhibit-redisplay ;; Don't really try to enter debugger within an eval from redisplay. debugger-value @@ -274,7 +283,7 @@ That buffer should be current already." (print-escape-newlines t) (print-level 8) (print-length 50)) - (backtrace)) + (guile-backtrace debug-inner-cut 0 1)) (goto-char (point-min)) (insert "Debugger entered") ;; lambda is for debug-on-call when a function call is next. -- cgit v1.2.3