Add backtrace-mode and use it in the debugger, ERT and Edebug
* doc/lispref/debugging.texi (Using Debugger): Remove explanation of backtrace buffer. Refer to new node. (Backtraces): New node. (Debugger Commands): Refer to new node. Remove 'v'. * doc/lispref/edebug.texi (Edebug Misc): Refer to new node. * doc/misc/ert.texi (Running Tests Interactively): Refer to new node. * lisp/emacs-lisp-backtrace.el: New file. * test/lisp/emacs-lisp/backtrace-tests.el: New file. * lisp/emacs-lisp/debug.el: (debugger-buffer-state): New cl-defstruct. (debugger--restore-buffer-state): New function. (debug): Use a debugger-buffer-state object to save and restore buffer state. Fix bug#15749 by leaving an unused buffer in debugger-mode, empty, instead of in fundamental-mode, and then when reusing a buffer, not calling debugger-mode if the buffer is already in debugger-mode. (debugger-insert-backtrace): Remove. (debugger-setup-buffer): Use backtrace-mode. (debugger--insert-header): New function. (debugger-continue, debugger-return-value): Change check for flags to use backtrace-frames. (debugger-frame-number): Determine backtrace frame number from backtrace-frames. (debugger--locals-visible-p, debugger--insert-locals) (debugger--show-locals, debugger--hide-locals) (debugger-toggle-locals): Remove. (debugger-mode-map): Make a child of backtrace-mode-map. Move navigation commands to backtrace-mode-map. Bind 'q' to debugger-quit instead of top-level. Make Help Follow menu item call backtrace-help-follow-symbol. (debugger-mode): Derive from backtrace-mode. (debug-help-follow): Remove. Move body of this function to 'backtrace-help-follow-symbol' in backtrace.el. (debugger-quit): New function. * lisp/emacs-lisp/edebug.el (edebug-unwrap-results): Remove warning in docstring about circular results. (edebug-unwrap): Use pcase. (edebug-unwrap1): New function to unwrap circular objects. (edebug-unwrap*): Use it. (edebug--frame): New cl-defstruct. (edebug-backtrace): Call the buffer *Edebug Backtrace* and use backtrace-mode. Get the frames from edebug--backtrace-frames. (edebug--backtrace-frames, edebug--unwrap-and-add-info) (edebug--symbol-not-prefixed-p): New functions. * lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-for-backtraces) (lisp-el-font-lock-keywords-for-backtraces-1) (lisp-el-font-lock-keywords-for-backtraces-2): New constants. * lisp/emacs-lisp/ert.el (ert--print-backtrace): Remove. (ert--run-test-debugger): Use backtrace-get-frames. (ert-run-tests-batch): Use backtrace-to-string. (ert-results-pop-to-backtrace-for-test-at-point): Use backtrace-mode. (ert--insert-backtrace-header): New function. * tests/lisp/emacs-lisp/ert-tests.el (ert-test--which-file): Use backtrace-frame slot accessor.
This commit is contained in:
parent
8a7620955b
commit
e09120d686
11 changed files with 1260 additions and 350 deletions
|
@ -517,6 +517,16 @@ This will generate compile-time constants from BINDINGS."
|
|||
(defvar lisp-cl-font-lock-keywords lisp-cl-font-lock-keywords-1
|
||||
"Default expressions to highlight in Lisp modes.")
|
||||
|
||||
;; Support backtrace mode.
|
||||
(defconst lisp-el-font-lock-keywords-for-backtraces lisp-el-font-lock-keywords
|
||||
"Default highlighting from Emacs Lisp mod used in Backtrace mode.")
|
||||
(defconst lisp-el-font-lock-keywords-for-backtraces-1 lisp-el-font-lock-keywords-1
|
||||
"Subdued highlighting from Emacs Lisp mode used in Backtrace mode.")
|
||||
(defconst lisp-el-font-lock-keywords-for-backtraces-2
|
||||
(remove (assoc 'lisp--match-hidden-arg lisp-el-font-lock-keywords-2)
|
||||
lisp-el-font-lock-keywords-2)
|
||||
"Gaudy highlighting from Emacs Lisp mode used in Backtrace mode.")
|
||||
|
||||
(defun lisp-string-in-doc-position-p (listbeg startpos)
|
||||
"Return true if a doc string may occur at STARTPOS inside a list.
|
||||
LISTBEG is the position of the start of the innermost list
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue