[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/backtrace-mode 5d7034a 15/16: Move 'backtrace' fro
From: |
Gemini Lasswell |
Subject: |
[Emacs-diffs] scratch/backtrace-mode 5d7034a 15/16: Move 'backtrace' from subr.el to backtrace.el |
Date: |
Fri, 27 Jul 2018 15:26:00 -0400 (EDT) |
branch: scratch/backtrace-mode
commit 5d7034aa0364afeaab2885c3930b440a1f7fdd63
Author: Gemini Lasswell <address@hidden>
Commit: Gemini Lasswell <address@hidden>
Move 'backtrace' from subr.el to backtrace.el
* lisp/subr.el (backtrace, backtrace--print-frame): Remove functions.
* lisp/emacs-lisp/backtrace.el (backtrace-backtrace): Remove function.
(backtrace): New function.
(backtrace-to-string): Make argument optional.
* doc/lispref/debugging.texi (Internals of Debugger): Update
description of 'backtrace' function.
---
doc/lispref/debugging.texi | 19 +++++++++----------
lisp/emacs-lisp/backtrace.el | 12 ++++++++----
lisp/subr.el | 19 -------------------
3 files changed, 17 insertions(+), 33 deletions(-)
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi
index 87429a6..841b16e 100644
--- a/doc/lispref/debugging.texi
+++ b/doc/lispref/debugging.texi
@@ -678,20 +678,19 @@ of @code{debug} (@pxref{Invoking the Debugger}).
@cindex run time stack
@cindex call stack
This function prints a trace of Lisp function calls currently active.
-This is the function used by @code{debug} to fill up the
address@hidden buffer. It is written in C, since it must have access
-to the stack to determine which function calls are active. The return
-value is always @code{nil}.
+The trace is identical to the one that @code{debug} would show in the
address@hidden buffer. The return value is always nil.
In the following example, a Lisp expression calls @code{backtrace}
explicitly. This prints the backtrace to the stream
@code{standard-output}, which, in this case, is the buffer
@samp{backtrace-output}.
-Each line of the backtrace represents one function call. The line shows
-the values of the function's arguments if they are all known; if they
-are still being computed, the line says so. The arguments of special
-forms are elided.
+Each line of the backtrace represents one function call. The line
+shows the function followed by a list of the values of the function's
+arguments if they are all known; if they are still being computed, the
+line consists of a list containing the function and its unevaluated
+arguments. Long lists or deeply nested structures may be elided.
@smallexample
@group
@@ -708,7 +707,7 @@ forms are elided.
@group
----------- Buffer: backtrace-output ------------
backtrace()
- (list ...computing arguments...)
+ (list 'testing (backtrace))
@end group
(progn ...)
eval((progn (1+ var) (list 'testing (backtrace))))
@@ -739,7 +738,7 @@ example would look as follows:
@group
----------- Buffer: backtrace-output ------------
(backtrace)
- (list ...computing arguments...)
+ (list 'testing (backtrace))
@end group
(progn ...)
(eval (progn (1+ var) (list 'testing (backtrace))))
diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el
index 5169c30..d162983 100644
--- a/lisp/emacs-lisp/backtrace.el
+++ b/lisp/emacs-lisp/backtrace.el
@@ -891,14 +891,18 @@ followed by `backtrace-print-frame', once for each stack
frame."
;;; Backtrace printing
-(defun backtrace-backtrace ()
+;;;###autoload
+(defun backtrace ()
"Print a trace of Lisp function calls currently active.
Output stream used is value of `standard-output'."
- (princ (backtrace-to-string (backtrace-get-frames 'backtrace-backtrace))))
+ (princ (backtrace-to-string (backtrace-get-frames 'backtrace)))
+ nil)
-(defun backtrace-to-string(frames)
+(defun backtrace-to-string(&optional frames)
"Format FRAMES, a list of `backtrace-frame' objects, for output.
-Return the result as a string."
+Return the result as a string. If FRAMES is nil, use all
+function calls currently active."
+ (unless frames (setq frames (backtrace-get-frames 'backtrace-to-string)))
(let ((backtrace-fontify nil))
(with-temp-buffer
(backtrace-mode)
diff --git a/lisp/subr.el b/lisp/subr.el
index 6b30371..8ebd1bb 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4687,25 +4687,6 @@ The properties used on SYMBOL are `composefunc',
`sendfunc',
(put symbol 'hookvar (or hookvar 'mail-send-hook)))
-(defun backtrace--print-frame (evald func args flags)
- "Print a trace of a single stack frame to `standard-output'.
-EVALD, FUNC, ARGS, FLAGS are as in `mapbacktrace'."
- (princ (if (plist-get flags :debug-on-exit) "* " " "))
- (cond
- ((and evald (not debugger-stack-frame-as-list))
- (cl-prin1 func)
- (if args (cl-prin1 args) (princ "()")))
- (t
- (cl-prin1 (cons func args))))
- (princ "\n"))
-
-(defun backtrace ()
- "Print a trace of Lisp function calls currently active.
-Output stream used is value of `standard-output'."
- (let ((print-level (or print-level 8))
- (print-escape-control-characters t))
- (mapbacktrace #'backtrace--print-frame 'backtrace)))
-
(defun backtrace-frames (&optional base)
"Collect all frames of current backtrace into a list.
If non-nil, BASE should be a function, and frames before its
- [Emacs-diffs] branch scratch/backtrace-mode created (now 6b4f622), Gemini Lasswell, 2018/07/27
- [Emacs-diffs] scratch/backtrace-mode c7288cc 08/16: Add link in backtraces to position in buffer being evaluated (bug#14081), Gemini Lasswell, 2018/07/27
- [Emacs-diffs] scratch/backtrace-mode 80d1c52 06/16: Add prefix argument to backtrace-toggle-print-circle, Gemini Lasswell, 2018/07/27
- [Emacs-diffs] scratch/backtrace-mode b0e53a0 07/16: Add links in backtraces to functions written in C (bug#25393), Gemini Lasswell, 2018/07/27
- [Emacs-diffs] scratch/backtrace-mode 9f7943a 02/16: Add methods for strings to cl-print, Gemini Lasswell, 2018/07/27
- [Emacs-diffs] scratch/backtrace-mode 63af8c8 10/16: Change keybinding for backtrace-collapse from '=' to '-', Gemini Lasswell, 2018/07/27
- [Emacs-diffs] scratch/backtrace-mode cf2dded 04/16: Always make buttons from function names in backtraces, Gemini Lasswell, 2018/07/27
- [Emacs-diffs] scratch/backtrace-mode 31cc6ce 13/16: Add a menu for backtrace-mode, Gemini Lasswell, 2018/07/27
- [Emacs-diffs] scratch/backtrace-mode 1d4502d 12/16: * lisp/emacs-lisp/debug.el (debugger-mode-map): Use easy-menu-define., Gemini Lasswell, 2018/07/27
- [Emacs-diffs] scratch/backtrace-mode 5d7034a 15/16: Move 'backtrace' from subr.el to backtrace.el,
Gemini Lasswell <=
- [Emacs-diffs] scratch/backtrace-mode 6b4f622 16/16: Give two backtrace-mode commands better names, Gemini Lasswell, 2018/07/27
- [Emacs-diffs] scratch/backtrace-mode 1ff16de 05/16: Lazily print backtrace frame local variables, Gemini Lasswell, 2018/07/27
- [Emacs-diffs] scratch/backtrace-mode 50197e3 14/16: Add new commands to Edebug backtraces, Gemini Lasswell, 2018/07/27
- [Emacs-diffs] scratch/backtrace-mode d78464d 01/16: Support ellipsis expansion in cl-print, Gemini Lasswell, 2018/07/27
- [Emacs-diffs] scratch/backtrace-mode 06fc1ba 11/16: Add new command to expand all "..."s in a backtrace frame, Gemini Lasswell, 2018/07/27
- [Emacs-diffs] scratch/backtrace-mode 997d13a 09/16: Add more tests for backtrace-mode, Gemini Lasswell, 2018/07/27
- [Emacs-diffs] scratch/backtrace-mode 86d82db 03/16: Add backtrace-mode and use it in the debugger, ERT and Edebug, Gemini Lasswell, 2018/07/27