diff options
| author | Gemini Lasswell | 2018-07-18 08:30:45 -0700 |
|---|---|---|
| committer | Gemini Lasswell | 2018-08-03 08:54:08 -0700 |
| commit | 83af893fc0e7cc87c0fb0626fb48ef96e00b3f8b (patch) | |
| tree | a20e2e5731a619f1268519deb2392d39f5bcfe87 /lisp | |
| parent | ca98377280005344fb07c816997b9bc2a737056a (diff) | |
| download | emacs-83af893fc0e7cc87c0fb0626fb48ef96e00b3f8b.tar.gz emacs-83af893fc0e7cc87c0fb0626fb48ef96e00b3f8b.zip | |
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.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/emacs-lisp/backtrace.el | 12 | ||||
| -rw-r--r-- | lisp/subr.el | 19 |
2 files changed, 8 insertions, 23 deletions
diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el index 5169c305035..d162983c017 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." | |||
| 891 | 891 | ||
| 892 | ;;; Backtrace printing | 892 | ;;; Backtrace printing |
| 893 | 893 | ||
| 894 | (defun backtrace-backtrace () | 894 | ;;;###autoload |
| 895 | (defun backtrace () | ||
| 895 | "Print a trace of Lisp function calls currently active. | 896 | "Print a trace of Lisp function calls currently active. |
| 896 | Output stream used is value of `standard-output'." | 897 | Output stream used is value of `standard-output'." |
| 897 | (princ (backtrace-to-string (backtrace-get-frames 'backtrace-backtrace)))) | 898 | (princ (backtrace-to-string (backtrace-get-frames 'backtrace))) |
| 899 | nil) | ||
| 898 | 900 | ||
| 899 | (defun backtrace-to-string(frames) | 901 | (defun backtrace-to-string(&optional frames) |
| 900 | "Format FRAMES, a list of `backtrace-frame' objects, for output. | 902 | "Format FRAMES, a list of `backtrace-frame' objects, for output. |
| 901 | Return the result as a string." | 903 | Return the result as a string. If FRAMES is nil, use all |
| 904 | function calls currently active." | ||
| 905 | (unless frames (setq frames (backtrace-get-frames 'backtrace-to-string))) | ||
| 902 | (let ((backtrace-fontify nil)) | 906 | (let ((backtrace-fontify nil)) |
| 903 | (with-temp-buffer | 907 | (with-temp-buffer |
| 904 | (backtrace-mode) | 908 | (backtrace-mode) |
diff --git a/lisp/subr.el b/lisp/subr.el index f8c19efc379..fbb3e49a35c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -4687,25 +4687,6 @@ The properties used on SYMBOL are `composefunc', `sendfunc', | |||
| 4687 | (put symbol 'hookvar (or hookvar 'mail-send-hook))) | 4687 | (put symbol 'hookvar (or hookvar 'mail-send-hook))) |
| 4688 | 4688 | ||
| 4689 | 4689 | ||
| 4690 | (defun backtrace--print-frame (evald func args flags) | ||
| 4691 | "Print a trace of a single stack frame to `standard-output'. | ||
| 4692 | EVALD, FUNC, ARGS, FLAGS are as in `mapbacktrace'." | ||
| 4693 | (princ (if (plist-get flags :debug-on-exit) "* " " ")) | ||
| 4694 | (cond | ||
| 4695 | ((and evald (not debugger-stack-frame-as-list)) | ||
| 4696 | (cl-prin1 func) | ||
| 4697 | (if args (cl-prin1 args) (princ "()"))) | ||
| 4698 | (t | ||
| 4699 | (cl-prin1 (cons func args)))) | ||
| 4700 | (princ "\n")) | ||
| 4701 | |||
| 4702 | (defun backtrace () | ||
| 4703 | "Print a trace of Lisp function calls currently active. | ||
| 4704 | Output stream used is value of `standard-output'." | ||
| 4705 | (let ((print-level (or print-level 8)) | ||
| 4706 | (print-escape-control-characters t)) | ||
| 4707 | (mapbacktrace #'backtrace--print-frame 'backtrace))) | ||
| 4708 | |||
| 4709 | (defun backtrace-frames (&optional base) | 4690 | (defun backtrace-frames (&optional base) |
| 4710 | "Collect all frames of current backtrace into a list. | 4691 | "Collect all frames of current backtrace into a list. |
| 4711 | If non-nil, BASE should be a function, and frames before its | 4692 | If non-nil, BASE should be a function, and frames before its |