diff options
| author | Stefan Monnier | 2013-03-28 12:33:06 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-03-28 12:33:06 -0400 |
| commit | 17c781d1e6703ec32e459dc09547d8d1c7a3a534 (patch) | |
| tree | 7832ffb569dabd43ef72ed6c1d890cf451de7409 | |
| parent | 717b8bcd964f55cb509711149ad112deca36c2a7 (diff) | |
| download | emacs-17c781d1e6703ec32e459dc09547d8d1c7a3a534.tar.gz emacs-17c781d1e6703ec32e459dc09547d8d1c7a3a534.zip | |
* lisp/emacs-lisp/edebug.el (edebug-mode): Make it a minor mode.
(edebug--recursive-edit): Use it.
(edebug-kill-buffer): Don't let-bind kill-buffer-hook.
(edebug-temp-display-freq-count): Don't let-bind buffer-read-only.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/emacs-lisp/edebug.el | 51 |
2 files changed, 34 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6ba1ace546a..a3ef9b2ae6d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2013-03-28 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * emacs-lisp/edebug.el (edebug-mode): Make it a minor mode. | ||
| 4 | (edebug--recursive-edit): Use it. | ||
| 5 | (edebug-kill-buffer): Don't let-bind kill-buffer-hook. | ||
| 6 | (edebug-temp-display-freq-count): Don't let-bind buffer-read-only. | ||
| 7 | |||
| 1 | 2013-03-28 Leo Liu <sdl.web@gmail.com> | 8 | 2013-03-28 Leo Liu <sdl.web@gmail.com> |
| 2 | 9 | ||
| 3 | * vc/vc-bzr.el (vc-bzr-revert): Don't backup. (Bug#14066) | 10 | * vc/vc-bzr.el (vc-bzr-revert): Don't backup. (Bug#14066) |
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 5a6fd4a0a22..4ecd244ebf2 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el | |||
| @@ -54,6 +54,7 @@ | |||
| 54 | 54 | ||
| 55 | (require 'macroexp) | 55 | (require 'macroexp) |
| 56 | (eval-when-compile (require 'cl-lib)) | 56 | (eval-when-compile (require 'cl-lib)) |
| 57 | (eval-when-compile (require 'pcase)) | ||
| 57 | 58 | ||
| 58 | ;;; Options | 59 | ;;; Options |
| 59 | 60 | ||
| @@ -2072,11 +2073,6 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 2072 | 2073 | ||
| 2073 | (defvar edebug-active nil) ;; Non-nil when edebug is active | 2074 | (defvar edebug-active nil) ;; Non-nil when edebug is active |
| 2074 | 2075 | ||
| 2075 | ;;; add minor-mode-alist entry | ||
| 2076 | (or (assq 'edebug-active minor-mode-alist) | ||
| 2077 | (setq minor-mode-alist (cons (list 'edebug-active " *Debugging*") | ||
| 2078 | minor-mode-alist))) | ||
| 2079 | |||
| 2080 | (defvar edebug-stack nil) | 2076 | (defvar edebug-stack nil) |
| 2081 | ;; Stack of active functions evaluated via edebug. | 2077 | ;; Stack of active functions evaluated via edebug. |
| 2082 | ;; Should be nil at the top level. | 2078 | ;; Should be nil at the top level. |
| @@ -2715,8 +2711,7 @@ MSG is printed after `::::} '." | |||
| 2715 | ;; Start up a recursive edit inside of edebug. | 2711 | ;; Start up a recursive edit inside of edebug. |
| 2716 | ;; The current buffer is the edebug-buffer, which is put into edebug-mode. | 2712 | ;; The current buffer is the edebug-buffer, which is put into edebug-mode. |
| 2717 | ;; Assume that none of the variables below are buffer-local. | 2713 | ;; Assume that none of the variables below are buffer-local. |
| 2718 | (let ((edebug-buffer-read-only buffer-read-only) | 2714 | (let (;; match-data must be done in the outside buffer |
| 2719 | ;; match-data must be done in the outside buffer | ||
| 2720 | (edebug-outside-match-data | 2715 | (edebug-outside-match-data |
| 2721 | (with-current-buffer edebug-outside-buffer ; in case match buffer different | 2716 | (with-current-buffer edebug-outside-buffer ; in case match buffer different |
| 2722 | (match-data))) | 2717 | (match-data))) |
| @@ -2730,8 +2725,6 @@ MSG is printed after `::::} '." | |||
| 2730 | ;; during a recursive-edit | 2725 | ;; during a recursive-edit |
| 2731 | edebug-inside-windows | 2726 | edebug-inside-windows |
| 2732 | 2727 | ||
| 2733 | (edebug-outside-map (current-local-map)) | ||
| 2734 | |||
| 2735 | ;; Save the outside value of executing macro. (here??) | 2728 | ;; Save the outside value of executing macro. (here??) |
| 2736 | (edebug-outside-executing-macro executing-kbd-macro) | 2729 | (edebug-outside-executing-macro executing-kbd-macro) |
| 2737 | (edebug-outside-pre-command-hook | 2730 | (edebug-outside-pre-command-hook |
| @@ -2804,10 +2797,9 @@ MSG is printed after `::::} '." | |||
| 2804 | (not (memq arg-mode '(after error)))) | 2797 | (not (memq arg-mode '(after error)))) |
| 2805 | (message "Break")) | 2798 | (message "Break")) |
| 2806 | 2799 | ||
| 2807 | (setq buffer-read-only t) | ||
| 2808 | (setq signal-hook-function nil) | 2800 | (setq signal-hook-function nil) |
| 2809 | 2801 | ||
| 2810 | (edebug-mode) | 2802 | (edebug-mode 1) |
| 2811 | (unwind-protect | 2803 | (unwind-protect |
| 2812 | (recursive-edit) ; <<<<<<<<<< Recursive edit | 2804 | (recursive-edit) ; <<<<<<<<<< Recursive edit |
| 2813 | 2805 | ||
| @@ -2828,10 +2820,7 @@ MSG is printed after `::::} '." | |||
| 2828 | (set-buffer edebug-buffer) | 2820 | (set-buffer edebug-buffer) |
| 2829 | (if (memq edebug-execution-mode '(go Go-nonstop)) | 2821 | (if (memq edebug-execution-mode '(go Go-nonstop)) |
| 2830 | (edebug-overlay-arrow)) | 2822 | (edebug-overlay-arrow)) |
| 2831 | (setq buffer-read-only edebug-buffer-read-only) | 2823 | (edebug-mode -1)) |
| 2832 | (use-local-map edebug-outside-map) | ||
| 2833 | (remove-hook 'kill-buffer-hook 'edebug-kill-buffer t) | ||
| 2834 | ) | ||
| 2835 | ;; gotta have a buffer to let its buffer local variables be set | 2824 | ;; gotta have a buffer to let its buffer local variables be set |
| 2836 | (get-buffer-create " bogus edebug buffer")) | 2825 | (get-buffer-create " bogus edebug buffer")) |
| 2837 | ));; inner let | 2826 | ));; inner let |
| @@ -3773,7 +3762,9 @@ be installed in `emacs-lisp-mode-map'.") | |||
| 3773 | (interactive) | 3762 | (interactive) |
| 3774 | (describe-function 'edebug-mode)) | 3763 | (describe-function 'edebug-mode)) |
| 3775 | 3764 | ||
| 3776 | (defun edebug-mode () | 3765 | (defvar edebug--mode-saved-vars nil) |
| 3766 | |||
| 3767 | (define-minor-mode edebug-mode | ||
| 3777 | "Mode for Emacs Lisp buffers while in Edebug. | 3768 | "Mode for Emacs Lisp buffers while in Edebug. |
| 3778 | 3769 | ||
| 3779 | In addition to all Emacs Lisp commands (except those that modify the | 3770 | In addition to all Emacs Lisp commands (except those that modify the |
| @@ -3807,20 +3798,32 @@ Options: | |||
| 3807 | `edebug-on-signal' | 3798 | `edebug-on-signal' |
| 3808 | `edebug-unwrap-results' | 3799 | `edebug-unwrap-results' |
| 3809 | `edebug-global-break-condition'" | 3800 | `edebug-global-break-condition'" |
| 3801 | :lighter " *Debugging*" | ||
| 3802 | :keymap edebug-mode-map | ||
| 3810 | ;; If the user kills the buffer in which edebug is currently active, | 3803 | ;; If the user kills the buffer in which edebug is currently active, |
| 3811 | ;; exit to top level, because the edebug command loop can't usefully | 3804 | ;; exit to top level, because the edebug command loop can't usefully |
| 3812 | ;; continue running in such a case. | 3805 | ;; continue running in such a case. |
| 3813 | ;; | 3806 | ;; |
| 3814 | ;; Append `edebug-kill-buffer' to the hook to avoid interfering with | 3807 | (if (not edebug-mode) |
| 3815 | ;; other entries that are ungarded against deleted buffer. | 3808 | (progn |
| 3816 | (add-hook 'kill-buffer-hook 'edebug-kill-buffer t t) | 3809 | (while edebug--mode-saved-vars |
| 3817 | (use-local-map edebug-mode-map)) | 3810 | (let ((setting (pop edebug--mode-saved-vars))) |
| 3811 | (if (consp setting) | ||
| 3812 | (set (car setting) (cdr setting)) | ||
| 3813 | (kill-local-variable setting)))) | ||
| 3814 | (remove-hook 'kill-buffer-hook 'edebug-kill-buffer t)) | ||
| 3815 | (pcase-dolist (`(,var . ,val) '((buffer-read-only . t))) | ||
| 3816 | (push | ||
| 3817 | (if (local-variable-p var) var (cons var (symbol-value var))) | ||
| 3818 | edebug--mode-saved-vars) | ||
| 3819 | (set (make-local-variable var) val)) | ||
| 3820 | ;; Append `edebug-kill-buffer' to the hook to avoid interfering with | ||
| 3821 | ;; other entries that are ungarded against deleted buffer. | ||
| 3822 | (add-hook 'kill-buffer-hook 'edebug-kill-buffer t t))) | ||
| 3818 | 3823 | ||
| 3819 | (defun edebug-kill-buffer () | 3824 | (defun edebug-kill-buffer () |
| 3820 | "Used on `kill-buffer-hook' when Edebug is operating in a buffer of Lisp code." | 3825 | "Used on `kill-buffer-hook' when Edebug is operating in a buffer of Lisp code." |
| 3821 | (let (kill-buffer-hook) | 3826 | (run-with-timer 0 nil #'top-level)) |
| 3822 | (kill-buffer (current-buffer))) | ||
| 3823 | (top-level)) | ||
| 3824 | 3827 | ||
| 3825 | ;;; edebug eval list mode | 3828 | ;;; edebug eval list mode |
| 3826 | 3829 | ||
| @@ -4143,7 +4146,7 @@ reinstrument it." | |||
| 4143 | It is removed when you hit any char." | 4146 | It is removed when you hit any char." |
| 4144 | ;; This seems not to work with Emacs 18.59. It undoes too far. | 4147 | ;; This seems not to work with Emacs 18.59. It undoes too far. |
| 4145 | (interactive) | 4148 | (interactive) |
| 4146 | (let ((buffer-read-only nil)) | 4149 | (let ((inhibit-read-only t)) |
| 4147 | (undo-boundary) | 4150 | (undo-boundary) |
| 4148 | (edebug-display-freq-count) | 4151 | (edebug-display-freq-count) |
| 4149 | (setq unread-command-events | 4152 | (setq unread-command-events |