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 /lisp | |
| 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.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/emacs-lisp/edebug.el | 66 |
1 files changed, 28 insertions, 38 deletions
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))) |