Don't bind `s' in the normal backtrace map

* lisp/emacs-lisp/backtrace.el (backtrace-mode-map): Don't bind
the "s" command, because it's meaningless outside modes that have
set the backtrace-goto-source-functions variable (and only edebug
does that) (bug#57674).
* lisp/emacs-lisp/edebug.el (edebug-pop-to-backtrace): Use it.
(edebug-backtrace-mode-map, edebug-backtrace-mode): New mode.
This commit is contained in:
Lars Ingebrigtsen 2022-09-09 19:29:21 +02:00
parent 4cc78bcfd1
commit 04a6fd378f
3 changed files with 11 additions and 2 deletions

View file

@ -209,7 +209,6 @@ frames where the source code location is known.")
"v" #'backtrace-toggle-locals
"#" #'backtrace-toggle-print-circle
":" #'backtrace-toggle-print-gensym
"s" #'backtrace-goto-source
"RET" #'backtrace-help-follow-symbol
"+" #'backtrace-multi-line
"-" #'backtrace-single-line

View file

@ -4179,6 +4179,7 @@ from Edebug instrumentation found in the backtrace."
(backtrace-mode)
(add-hook 'backtrace-goto-source-functions
#'edebug--backtrace-goto-source nil t))
(edebug-backtrace-mode)
(setq edebug-instrumented-backtrace-frames
(backtrace-get-frames 'edebug-debugger
:constructor #'edebug--make-frame)
@ -4255,6 +4256,14 @@ Save DEF-NAME, BEFORE-INDEX and AFTER-INDEX in FRAME."
(setf (edebug--frame-before-index frame) before-index)
(setf (edebug--frame-after-index frame) after-index))
(defvar-keymap edebug-backtrace-mode-map
"s" #'backtrace-goto-source)
(define-minor-mode edebug-backtrace-mode
"Minor mode for showing backtraces from edebug."
:lighter nil
:interactive nil)
(defun edebug--backtrace-goto-source ()
(let* ((index (backtrace-get-index))
(frame (nth index backtrace-frames)))

View file

@ -428,7 +428,8 @@ test and possibly others should be updated."
(verify-keybinding "-" 'negative-argument)
(verify-keybinding "=" 'edebug-temp-display-freq-count)
(should (eq (lookup-key backtrace-mode-map "n") 'backtrace-forward-frame))
(should (eq (lookup-key backtrace-mode-map "s") 'backtrace-goto-source))))
(should (eq (lookup-key edebug-backtrace-mode-map "s")
'backtrace-goto-source))))
(ert-deftest edebug-tests-stop-point-at-start-of-first-instrumented-function ()
"Edebug stops at the beginning of an instrumented function."