Resurrect edebug-set-initial-mode, repurposing it to set the global mode.
lisp/emacs-lisp/edebug.el (edebug-initial-mode-alist): Uncomment, and amend to match current modes and functions. (edebug-set-initial-mode): Uncomment and change from setting a defun's `edebug-initial-mode''s property to setting the variable `edebug-initial-mode'. (top level): Create new binding C-x C-a C-m for `edebug-set-initial-mode'. doc/lispref/edebug.texi (Edebug Execution Modes): document `edebug-set-initial-mode' and its new key binding. (Edebug Options): Mention the new command in the pertinent place. etc/NEWS: Write entry for this change.
This commit is contained in:
parent
0d31eeb796
commit
feddb99afd
3 changed files with 50 additions and 43 deletions
|
@ -285,10 +285,21 @@ When you enter a new Edebug level, Edebug will normally stop at the
|
||||||
first instrumented function it encounters. If you prefer to stop only
|
first instrumented function it encounters. If you prefer to stop only
|
||||||
at a break point, or not at all (for example, when gathering coverage
|
at a break point, or not at all (for example, when gathering coverage
|
||||||
data), change the value of @code{edebug-initial-mode} from its default
|
data), change the value of @code{edebug-initial-mode} from its default
|
||||||
@code{step} to @code{go} or @code{Go-nonstop}, or one of its other
|
@code{step} to @code{go}, or @code{Go-nonstop}, or one of its other
|
||||||
values (@pxref{Edebug Options}). Note that you may reenter the same
|
values (@pxref{Edebug Options}). You can do this readily with
|
||||||
Edebug level several times if, for example, an instrumented function
|
@kbd{C-x C-a C-m} (@code{edebug-set-initial-mode}):
|
||||||
is called several times from one command.
|
|
||||||
|
@deffn Command edebug-set-initial-mode
|
||||||
|
@kindex C-x C-a C-m
|
||||||
|
This command, bound to @kbd{C-x C-a C-m}, sets
|
||||||
|
@code{edebug-initial-mode}. It prompts you for a key to indicate the
|
||||||
|
mode. You should enter one of the eight keys listed above, which sets
|
||||||
|
the corresponding mode.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
|
Note that you may reenter the same Edebug level several times if, for
|
||||||
|
example, an instrumented function is called several times from one
|
||||||
|
command.
|
||||||
|
|
||||||
While executing or tracing, you can interrupt the execution by typing
|
While executing or tracing, you can interrupt the execution by typing
|
||||||
any Edebug command. Edebug stops the program at the next stop point and
|
any Edebug command. Edebug stops the program at the next stop point and
|
||||||
|
@ -1565,7 +1576,8 @@ mode for Edebug when it is first activated. Possible values are
|
||||||
@code{step}, @code{next}, @code{go}, @code{Go-nonstop}, @code{trace},
|
@code{step}, @code{next}, @code{go}, @code{Go-nonstop}, @code{trace},
|
||||||
@code{Trace-fast}, @code{continue}, and @code{Continue-fast}.
|
@code{Trace-fast}, @code{continue}, and @code{Continue-fast}.
|
||||||
|
|
||||||
The default value is @code{step}.
|
The default value is @code{step}. This variable can be set
|
||||||
|
interactively with @kbd{C-x C-a C-m} (@code{edebug-set-initial-mode}).
|
||||||
@xref{Edebug Execution Modes}.
|
@xref{Edebug Execution Modes}.
|
||||||
@end defopt
|
@end defopt
|
||||||
|
|
||||||
|
|
5
etc/NEWS
5
etc/NEWS
|
@ -460,6 +460,11 @@ typing RET.
|
||||||
*** If `quick-calc' is called with a prefix argument, insert the
|
*** If `quick-calc' is called with a prefix argument, insert the
|
||||||
result of the calculation into the current buffer.
|
result of the calculation into the current buffer.
|
||||||
|
|
||||||
|
+++
|
||||||
|
** In Edebug, you can now set the initial mode with C-x C-a C-m. With
|
||||||
|
this you can tell Edebug not to stop at the start of the first
|
||||||
|
instrumented function.
|
||||||
|
|
||||||
** ElDoc
|
** ElDoc
|
||||||
*** New minor mode `global-eldoc-mode'
|
*** New minor mode `global-eldoc-mode'
|
||||||
*** `eldoc-documentation-function' now defaults to `ignore'
|
*** `eldoc-documentation-function' now defaults to `ignore'
|
||||||
|
|
|
@ -3216,57 +3216,45 @@ This is useful for exiting even if `unwind-protect' code may be executed."
|
||||||
(setq edebug-execution-mode 'Go-nonstop)
|
(setq edebug-execution-mode 'Go-nonstop)
|
||||||
(top-level))
|
(top-level))
|
||||||
|
|
||||||
|
|
||||||
;;(defun edebug-exit-out ()
|
;;(defun edebug-exit-out ()
|
||||||
;; "Go until the current function exits."
|
;; "Go until the current function exits."
|
||||||
;; (interactive)
|
;; (interactive)
|
||||||
;; (edebug-set-mode 'exiting "Exit..."))
|
;; (edebug-set-mode 'exiting "Exit..."))
|
||||||
|
|
||||||
|
(defconst edebug-initial-mode-alist
|
||||||
;;; The following initial mode setting definitions are not used yet.
|
'((edebug-step-mode . step)
|
||||||
|
(edebug-next-mode . next)
|
||||||
'(defconst edebug-initial-mode-alist
|
(edebug-trace-mode . trace)
|
||||||
'((edebug-Continue-fast . Continue-fast)
|
(edebug-Trace-fast-mode . Trace-fast)
|
||||||
(edebug-Trace-fast . Trace-fast)
|
(edebug-go-mode . go)
|
||||||
(edebug-continue . continue)
|
(edebug-continue-mode . continue)
|
||||||
(edebug-trace . trace)
|
(edebug-Continue-fast-mode . Continue-fast)
|
||||||
(edebug-go . go)
|
(edebug-Go-nonstop-mode . Go-nonstop))
|
||||||
(edebug-step-through . step)
|
|
||||||
(edebug-Go-nonstop . Go-nonstop)
|
|
||||||
)
|
|
||||||
"Association list between commands and the modes they set.")
|
"Association list between commands and the modes they set.")
|
||||||
|
|
||||||
|
(defvar edebug-mode-map) ; will be defined fully later.
|
||||||
|
|
||||||
'(defun edebug-set-initial-mode ()
|
(defun edebug-set-initial-mode ()
|
||||||
"Ask for the initial mode of the enclosing function.
|
"Set the initial execution mode of Edebug.
|
||||||
The mode is requested via the key that would be used to set the mode in
|
The mode is requested via the key that would be used to set the mode in
|
||||||
edebug-mode."
|
edebug-mode."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((this-function (edebug-which-function))
|
(let* ((old-mode edebug-initial-mode)
|
||||||
(keymap (if (eq edebug-mode-map (current-local-map))
|
|
||||||
edebug-mode-map))
|
|
||||||
(old-mode (or (get this-function 'edebug-initial-mode)
|
|
||||||
edebug-initial-mode))
|
|
||||||
(key (read-key-sequence
|
(key (read-key-sequence
|
||||||
(format
|
(format
|
||||||
"Change initial edebug mode for %s from %s (%s) to (enter key): "
|
"Change initial edebug mode from %s (%c) to (enter key): "
|
||||||
this-function
|
old-mode
|
||||||
old-mode
|
(aref (where-is-internal
|
||||||
(where-is-internal
|
(car (rassq old-mode edebug-initial-mode-alist))
|
||||||
(car (rassq old-mode edebug-initial-mode-alist))
|
edebug-mode-map 'firstonly)
|
||||||
keymap 'firstonly
|
0))))
|
||||||
))))
|
(mode (cdr (assq (lookup-key edebug-mode-map key)
|
||||||
(mode (cdr (assq (key-binding key) edebug-initial-mode-alist)))
|
edebug-initial-mode-alist))))
|
||||||
)
|
(if mode
|
||||||
(if (and mode
|
|
||||||
(or (get this-function 'edebug-initial-mode)
|
|
||||||
(not (eq mode edebug-initial-mode))))
|
|
||||||
(progn
|
(progn
|
||||||
(put this-function 'edebug-initial-mode mode)
|
(setq edebug-initial-mode mode)
|
||||||
(message "Initial mode for %s is now: %s"
|
(message "Edebug's initial mode is now: %s" mode))
|
||||||
this-function mode))
|
(error "Key must map to one of the mode changing commands"))))
|
||||||
(error "Key must map to one of the mode changing commands")
|
|
||||||
)))
|
|
||||||
|
|
||||||
;;; Evaluation of expressions
|
;;; Evaluation of expressions
|
||||||
|
|
||||||
|
@ -3425,7 +3413,9 @@ be installed in `emacs-lisp-mode-map'.")
|
||||||
(define-key emacs-lisp-mode-map "\C-x\C-a\C-s" 'edebug-step-mode)
|
(define-key emacs-lisp-mode-map "\C-x\C-a\C-s" 'edebug-step-mode)
|
||||||
(define-key emacs-lisp-mode-map "\C-x\C-a\C-n" 'edebug-next-mode)
|
(define-key emacs-lisp-mode-map "\C-x\C-a\C-n" 'edebug-next-mode)
|
||||||
(define-key emacs-lisp-mode-map "\C-x\C-a\C-c" 'edebug-go-mode)
|
(define-key emacs-lisp-mode-map "\C-x\C-a\C-c" 'edebug-go-mode)
|
||||||
(define-key emacs-lisp-mode-map "\C-x\C-a\C-l" 'edebug-where))
|
(define-key emacs-lisp-mode-map "\C-x\C-a\C-l" 'edebug-where)
|
||||||
|
;; The following isn't a GUD binding.
|
||||||
|
(define-key emacs-lisp-mode-map "\C-x\C-a\C-m" 'edebug-set-initial-mode))
|
||||||
|
|
||||||
(defvar edebug-mode-map
|
(defvar edebug-mode-map
|
||||||
(let ((map (copy-keymap emacs-lisp-mode-map)))
|
(let ((map (copy-keymap emacs-lisp-mode-map)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue