diff options
| author | Alan Mackenzie | 2015-09-25 11:31:50 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2015-09-25 11:31:50 +0000 |
| commit | feddb99afd5692ad7baf2e5675a35b88ff6987ae (patch) | |
| tree | 7e546fac43df6d92bb717bc6126e66032442d844 | |
| parent | 0d31eeb796f3388ee4160b7fdff60004ce6847cf (diff) | |
| download | emacs-feddb99afd5692ad7baf2e5675a35b88ff6987ae.tar.gz emacs-feddb99afd5692ad7baf2e5675a35b88ff6987ae.zip | |
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.
| -rw-r--r-- | doc/lispref/edebug.texi | 22 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/edebug.el | 66 |
3 files changed, 50 insertions, 43 deletions
diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi index e086be303fc..96bb03b34c0 100644 --- a/doc/lispref/edebug.texi +++ b/doc/lispref/edebug.texi | |||
| @@ -285,10 +285,21 @@ When you enter a new Edebug level, Edebug will normally stop at the | |||
| 285 | first instrumented function it encounters. If you prefer to stop only | 285 | first instrumented function it encounters. If you prefer to stop only |
| 286 | at a break point, or not at all (for example, when gathering coverage | 286 | at a break point, or not at all (for example, when gathering coverage |
| 287 | data), change the value of @code{edebug-initial-mode} from its default | 287 | data), change the value of @code{edebug-initial-mode} from its default |
| 288 | @code{step} to @code{go} or @code{Go-nonstop}, or one of its other | 288 | @code{step} to @code{go}, or @code{Go-nonstop}, or one of its other |
| 289 | values (@pxref{Edebug Options}). Note that you may reenter the same | 289 | values (@pxref{Edebug Options}). You can do this readily with |
| 290 | Edebug level several times if, for example, an instrumented function | 290 | @kbd{C-x C-a C-m} (@code{edebug-set-initial-mode}): |
| 291 | is called several times from one command. | 291 | |
| 292 | @deffn Command edebug-set-initial-mode | ||
| 293 | @kindex C-x C-a C-m | ||
| 294 | This command, bound to @kbd{C-x C-a C-m}, sets | ||
| 295 | @code{edebug-initial-mode}. It prompts you for a key to indicate the | ||
| 296 | mode. You should enter one of the eight keys listed above, which sets | ||
| 297 | the corresponding mode. | ||
| 298 | @end deffn | ||
| 299 | |||
| 300 | Note that you may reenter the same Edebug level several times if, for | ||
| 301 | example, an instrumented function is called several times from one | ||
| 302 | command. | ||
| 292 | 303 | ||
| 293 | While executing or tracing, you can interrupt the execution by typing | 304 | While executing or tracing, you can interrupt the execution by typing |
| 294 | any Edebug command. Edebug stops the program at the next stop point and | 305 | 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 | |||
| 1565 | @code{step}, @code{next}, @code{go}, @code{Go-nonstop}, @code{trace}, | 1576 | @code{step}, @code{next}, @code{go}, @code{Go-nonstop}, @code{trace}, |
| 1566 | @code{Trace-fast}, @code{continue}, and @code{Continue-fast}. | 1577 | @code{Trace-fast}, @code{continue}, and @code{Continue-fast}. |
| 1567 | 1578 | ||
| 1568 | The default value is @code{step}. | 1579 | The default value is @code{step}. This variable can be set |
| 1580 | interactively with @kbd{C-x C-a C-m} (@code{edebug-set-initial-mode}). | ||
| 1569 | @xref{Edebug Execution Modes}. | 1581 | @xref{Edebug Execution Modes}. |
| 1570 | @end defopt | 1582 | @end defopt |
| 1571 | 1583 | ||
| @@ -460,6 +460,11 @@ typing RET. | |||
| 460 | *** If `quick-calc' is called with a prefix argument, insert the | 460 | *** If `quick-calc' is called with a prefix argument, insert the |
| 461 | result of the calculation into the current buffer. | 461 | result of the calculation into the current buffer. |
| 462 | 462 | ||
| 463 | +++ | ||
| 464 | ** In Edebug, you can now set the initial mode with C-x C-a C-m. With | ||
| 465 | this you can tell Edebug not to stop at the start of the first | ||
| 466 | instrumented function. | ||
| 467 | |||
| 463 | ** ElDoc | 468 | ** ElDoc |
| 464 | *** New minor mode `global-eldoc-mode' | 469 | *** New minor mode `global-eldoc-mode' |
| 465 | *** `eldoc-documentation-function' now defaults to `ignore' | 470 | *** `eldoc-documentation-function' now defaults to `ignore' |
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index e437c587df4..a3e3b567cc4 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el | |||
| @@ -3216,57 +3216,45 @@ This is useful for exiting even if `unwind-protect' code may be executed." | |||
| 3216 | (setq edebug-execution-mode 'Go-nonstop) | 3216 | (setq edebug-execution-mode 'Go-nonstop) |
| 3217 | (top-level)) | 3217 | (top-level)) |
| 3218 | 3218 | ||
| 3219 | |||
| 3220 | ;;(defun edebug-exit-out () | 3219 | ;;(defun edebug-exit-out () |
| 3221 | ;; "Go until the current function exits." | 3220 | ;; "Go until the current function exits." |
| 3222 | ;; (interactive) | 3221 | ;; (interactive) |
| 3223 | ;; (edebug-set-mode 'exiting "Exit...")) | 3222 | ;; (edebug-set-mode 'exiting "Exit...")) |
| 3224 | 3223 | ||
| 3225 | 3224 | (defconst edebug-initial-mode-alist | |
| 3226 | ;;; The following initial mode setting definitions are not used yet. | 3225 | '((edebug-step-mode . step) |
| 3227 | 3226 | (edebug-next-mode . next) | |
| 3228 | '(defconst edebug-initial-mode-alist | 3227 | (edebug-trace-mode . trace) |
| 3229 | '((edebug-Continue-fast . Continue-fast) | 3228 | (edebug-Trace-fast-mode . Trace-fast) |
| 3230 | (edebug-Trace-fast . Trace-fast) | 3229 | (edebug-go-mode . go) |
| 3231 | (edebug-continue . continue) | 3230 | (edebug-continue-mode . continue) |
| 3232 | (edebug-trace . trace) | 3231 | (edebug-Continue-fast-mode . Continue-fast) |
| 3233 | (edebug-go . go) | 3232 | (edebug-Go-nonstop-mode . Go-nonstop)) |
| 3234 | (edebug-step-through . step) | ||
| 3235 | (edebug-Go-nonstop . Go-nonstop) | ||
| 3236 | ) | ||
| 3237 | "Association list between commands and the modes they set.") | 3233 | "Association list between commands and the modes they set.") |
| 3238 | 3234 | ||
| 3235 | (defvar edebug-mode-map) ; will be defined fully later. | ||
| 3239 | 3236 | ||
| 3240 | '(defun edebug-set-initial-mode () | 3237 | (defun edebug-set-initial-mode () |
| 3241 | "Ask for the initial mode of the enclosing function. | 3238 | "Set the initial execution mode of Edebug. |
| 3242 | The mode is requested via the key that would be used to set the mode in | 3239 | The mode is requested via the key that would be used to set the mode in |
| 3243 | edebug-mode." | 3240 | edebug-mode." |
| 3244 | (interactive) | 3241 | (interactive) |
| 3245 | (let* ((this-function (edebug-which-function)) | 3242 | (let* ((old-mode edebug-initial-mode) |
| 3246 | (keymap (if (eq edebug-mode-map (current-local-map)) | ||
| 3247 | edebug-mode-map)) | ||
| 3248 | (old-mode (or (get this-function 'edebug-initial-mode) | ||
| 3249 | edebug-initial-mode)) | ||
| 3250 | (key (read-key-sequence | 3243 | (key (read-key-sequence |
| 3251 | (format | 3244 | (format |
| 3252 | "Change initial edebug mode for %s from %s (%s) to (enter key): " | 3245 | "Change initial edebug mode from %s (%c) to (enter key): " |
| 3253 | this-function | 3246 | old-mode |
| 3254 | old-mode | 3247 | (aref (where-is-internal |
| 3255 | (where-is-internal | 3248 | (car (rassq old-mode edebug-initial-mode-alist)) |
| 3256 | (car (rassq old-mode edebug-initial-mode-alist)) | 3249 | edebug-mode-map 'firstonly) |
| 3257 | keymap 'firstonly | 3250 | 0)))) |
| 3258 | )))) | 3251 | (mode (cdr (assq (lookup-key edebug-mode-map key) |
| 3259 | (mode (cdr (assq (key-binding key) edebug-initial-mode-alist))) | 3252 | edebug-initial-mode-alist)))) |
| 3260 | ) | 3253 | (if mode |
| 3261 | (if (and mode | ||
| 3262 | (or (get this-function 'edebug-initial-mode) | ||
| 3263 | (not (eq mode edebug-initial-mode)))) | ||
| 3264 | (progn | 3254 | (progn |
| 3265 | (put this-function 'edebug-initial-mode mode) | 3255 | (setq edebug-initial-mode mode) |
| 3266 | (message "Initial mode for %s is now: %s" | 3256 | (message "Edebug's initial mode is now: %s" mode)) |
| 3267 | this-function mode)) | 3257 | (error "Key must map to one of the mode changing commands")))) |
| 3268 | (error "Key must map to one of the mode changing commands") | ||
| 3269 | ))) | ||
| 3270 | 3258 | ||
| 3271 | ;;; Evaluation of expressions | 3259 | ;;; Evaluation of expressions |
| 3272 | 3260 | ||
| @@ -3425,7 +3413,9 @@ be installed in `emacs-lisp-mode-map'.") | |||
| 3425 | (define-key emacs-lisp-mode-map "\C-x\C-a\C-s" 'edebug-step-mode) | 3413 | (define-key emacs-lisp-mode-map "\C-x\C-a\C-s" 'edebug-step-mode) |
| 3426 | (define-key emacs-lisp-mode-map "\C-x\C-a\C-n" 'edebug-next-mode) | 3414 | (define-key emacs-lisp-mode-map "\C-x\C-a\C-n" 'edebug-next-mode) |
| 3427 | (define-key emacs-lisp-mode-map "\C-x\C-a\C-c" 'edebug-go-mode) | 3415 | (define-key emacs-lisp-mode-map "\C-x\C-a\C-c" 'edebug-go-mode) |
| 3428 | (define-key emacs-lisp-mode-map "\C-x\C-a\C-l" 'edebug-where)) | 3416 | (define-key emacs-lisp-mode-map "\C-x\C-a\C-l" 'edebug-where) |
| 3417 | ;; The following isn't a GUD binding. | ||
| 3418 | (define-key emacs-lisp-mode-map "\C-x\C-a\C-m" 'edebug-set-initial-mode)) | ||
| 3429 | 3419 | ||
| 3430 | (defvar edebug-mode-map | 3420 | (defvar edebug-mode-map |
| 3431 | (let ((map (copy-keymap emacs-lisp-mode-map))) | 3421 | (let ((map (copy-keymap emacs-lisp-mode-map))) |