comparison lisp/emacs-lisp/edebug.el @ 33758:8c1e62157545

(edebug-version) (edebug-maintainer-address): Deleted. (edebug-submit-bug-report): Just alias to report-emacs-bug. (edebug-read-function): Account for other `'#' read forms. (edebug-mode-menus): Make some items toggles. (edebug-outside-unread-command-event, unread-command-event): Remove these to avoid warnings.
author Dave Love <fx@gnu.org>
date Wed, 22 Nov 2000 16:24:34 +0000
parents bfee926318b1
children bf1bc2158b55
comparison
equal deleted inserted replaced
33757:96338d0a2758 33758:8c1e62157545
1 ;;; edebug.el --- a source-level debugger for Emacs Lisp 1 ;;; edebug.el --- a source-level debugger for Emacs Lisp
2 2
3 ;; Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 97, 1999 3 ;; Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 97, 1999, 2000
4 ;; Free Software Foundation, Inc. 4 ;; Free Software Foundation, Inc.
5 5
6 ;; Author: Daniel LaLiberte <liberte@holonexus.org> 6 ;; Author: Daniel LaLiberte <liberte@holonexus.org>
7 ;; Maintainer: FSF 7 ;; Maintainer: FSF
8 ;; Keywords: lisp, tools, maint 8 ;; Keywords: lisp, tools, maint
52 ;; Waltham, MA 02254 52 ;; Waltham, MA 02254
53 ;; liberte@holonexus.org 53 ;; liberte@holonexus.org
54 54
55 ;;; Code: 55 ;;; Code:
56 56
57 (defconst edebug-version
58 (concat "In Emacs version " emacs-version))
59
60 ;;; Bug reporting 57 ;;; Bug reporting
61 58
62 (defconst edebug-maintainer-address "bug-gnu-emacs@gnu.org") 59 (defalias 'edebug-submit-bug-report 'report-emacs-bug)
63
64 (defun edebug-submit-bug-report ()
65 "Submit, via mail, a bug report on edebug."
66 (interactive)
67 (require 'reporter)
68 (and (y-or-n-p "Do you really want to submit a report on edebug? ")
69 (reporter-submit-bug-report
70 edebug-maintainer-address
71 (concat "edebug.el " edebug-version)
72 (list 'edebug-setup-hook
73 'edebug-all-defs
74 'edebug-all-forms
75 'edebug-eval-macro-args
76 'edebug-save-windows
77 'edebug-save-displayed-buffer-points
78 'edebug-initial-mode
79 'edebug-trace
80 'edebug-test-coverage
81 'edebug-continue-kbd-macro
82 'edebug-print-length
83 'edebug-print-level
84 'edebug-print-circle
85 ))))
86 60
87 ;;; Options 61 ;;; Options
88 62
89 (defgroup edebug nil 63 (defgroup edebug nil
90 "A source-level debugger for Emacs Lisp" 64 "A source-level debugger for Emacs Lisp"
927 (edebug-storing-offsets opoint symbol))))) 901 (edebug-storing-offsets opoint symbol)))))
928 902
929 (defun edebug-read-function (stream) 903 (defun edebug-read-function (stream)
930 ;; Turn #'thing into (function thing) 904 ;; Turn #'thing into (function thing)
931 (forward-char 1) 905 (forward-char 1)
932 (if (/= ?\' (following-char)) (edebug-syntax-error "Bad char")) 906 (cond ((eq ?\' (following-char))
933 (forward-char 1) 907 (forward-char 1)
934 (list 908 (list
935 (edebug-storing-offsets (point) 909 (edebug-storing-offsets (point)
936 (if (featurep 'cl) 'function* 'function)) 910 (if (featurep 'cl) 'function* 'function))
937 (edebug-read-storing-offsets stream))) 911 (edebug-read-storing-offsets stream)))
912 ((memq (char-after)
913 ;; Other # read forms than these probably shouldn't be
914 ;; in source.
915 '(?: ?B ?O ?X ?b ?o ?x))
916 (edebug-original-read stream))
917 (t (edebug-syntax-error "Bad char after #"))))
938 918
939 (defun edebug-read-list (stream) 919 (defun edebug-read-list (stream)
940 (forward-char 1) ; skip \( 920 (forward-char 1) ; skip \(
941 (prog1 921 (prog1
942 (let ((elements)) 922 (let ((elements))
2783 ;; in versions where the variable is *not* built-in. 2763 ;; in versions where the variable is *not* built-in.
2784 2764
2785 ;; Emacs 18 2765 ;; Emacs 18
2786 (defvar edebug-outside-unread-command-char) 2766 (defvar edebug-outside-unread-command-char)
2787 2767
2788 ;; Lucid Emacs
2789 (defvar edebug-outside-unread-command-event) ;; like unread-command-events
2790 (defvar unread-command-event nil)
2791
2792 ;; Emacs 19. 2768 ;; Emacs 19.
2793 (defvar edebug-outside-last-command-event) 2769 (defvar edebug-outside-last-command-event)
2794 (defvar edebug-outside-unread-command-events) 2770 (defvar edebug-outside-unread-command-events)
2795 (defvar edebug-outside-last-input-event) 2771 (defvar edebug-outside-last-input-event)
2796 (defvar edebug-outside-last-event-frame) 2772 (defvar edebug-outside-last-event-frame)
2802 (defvar edebug-unread-command-char-warning) 2778 (defvar edebug-unread-command-char-warning)
2803 (defvar edebug-unread-command-event-warning) 2779 (defvar edebug-unread-command-event-warning)
2804 (eval-when-compile 2780 (eval-when-compile
2805 (setq edebug-unread-command-char-warning 2781 (setq edebug-unread-command-char-warning
2806 (get 'unread-command-char 'byte-obsolete-variable)) 2782 (get 'unread-command-char 'byte-obsolete-variable))
2807 (put 'unread-command-char 'byte-obsolete-variable nil) 2783 (put 'unread-command-char 'byte-obsolete-variable nil))
2808 (setq edebug-unread-command-event-warning
2809 (get 'unread-command-event 'byte-obsolete-variable))
2810 (put 'unread-command-event 'byte-obsolete-variable nil))
2811 2784
2812 (defun edebug-recursive-edit () 2785 (defun edebug-recursive-edit ()
2813 ;; Start up a recursive edit inside of edebug. 2786 ;; Start up a recursive edit inside of edebug.
2814 ;; The current buffer is the edebug-buffer, which is put into edebug-mode. 2787 ;; The current buffer is the edebug-buffer, which is put into edebug-mode.
2815 ;; Assume that none of the variables below are buffer-local. 2788 ;; Assume that none of the variables below are buffer-local.
2843 (edebug-outside-unread-command-char unread-command-char) 2816 (edebug-outside-unread-command-char unread-command-char)
2844 (edebug-outside-current-prefix-arg current-prefix-arg) 2817 (edebug-outside-current-prefix-arg current-prefix-arg)
2845 2818
2846 (edebug-outside-last-input-event last-input-event) 2819 (edebug-outside-last-input-event last-input-event)
2847 (edebug-outside-last-command-event last-command-event) 2820 (edebug-outside-last-command-event last-command-event)
2848 (edebug-outside-unread-command-event unread-command-event)
2849 (edebug-outside-unread-command-events unread-command-events) 2821 (edebug-outside-unread-command-events unread-command-events)
2850 (edebug-outside-last-event-frame last-event-frame) 2822 (edebug-outside-last-event-frame last-event-frame)
2851 (edebug-outside-last-nonmenu-event last-nonmenu-event) 2823 (edebug-outside-last-nonmenu-event last-nonmenu-event)
2852 (edebug-outside-track-mouse track-mouse) 2824 (edebug-outside-track-mouse track-mouse)
2853 ) 2825 )
2866 (current-prefix-arg nil) 2838 (current-prefix-arg nil)
2867 2839
2868 ;; More for Emacs 19 2840 ;; More for Emacs 19
2869 (last-input-event nil) 2841 (last-input-event nil)
2870 (last-command-event nil) 2842 (last-command-event nil)
2871 (unread-command-event nil);; lemacs
2872 (unread-command-events nil) 2843 (unread-command-events nil)
2873 (last-event-frame nil) 2844 (last-event-frame nil)
2874 (last-nonmenu-event nil) 2845 (last-nonmenu-event nil)
2875 (track-mouse nil) 2846 (track-mouse nil)
2876 2847
2929 last-command-char edebug-outside-last-command-char 2900 last-command-char edebug-outside-last-command-char
2930 last-command-event edebug-outside-last-command-event 2901 last-command-event edebug-outside-last-command-event
2931 last-command edebug-outside-last-command 2902 last-command edebug-outside-last-command
2932 this-command edebug-outside-this-command 2903 this-command edebug-outside-this-command
2933 unread-command-char edebug-outside-unread-command-char 2904 unread-command-char edebug-outside-unread-command-char
2934 unread-command-event edebug-outside-unread-command-event
2935 unread-command-events edebug-outside-unread-command-events 2905 unread-command-events edebug-outside-unread-command-events
2936 current-prefix-arg edebug-outside-current-prefix-arg 2906 current-prefix-arg edebug-outside-current-prefix-arg
2937 last-input-char edebug-outside-last-input-char 2907 last-input-char edebug-outside-last-input-char
2938 last-input-event edebug-outside-last-input-event 2908 last-input-event edebug-outside-last-input-event
2939 last-event-frame edebug-outside-last-event-frame 2909 last-event-frame edebug-outside-last-event-frame
3480 which must be written in Lisp, not predefined. 3450 which must be written in Lisp, not predefined.
3481 Use `cancel-debug-on-entry' to cancel the effect of this command. 3451 Use `cancel-debug-on-entry' to cancel the effect of this command.
3482 Redefining FUNCTION also does that. 3452 Redefining FUNCTION also does that.
3483 3453
3484 This version is from Edebug. If the function is instrumented for 3454 This version is from Edebug. If the function is instrumented for
3485 Edebug, it calls `edebug-on-entry'" 3455 Edebug, it calls `edebug-on-entry'."
3486 (interactive "aDebug on entry (to function): ") 3456 (interactive "aDebug on entry (to function): ")
3487 (let ((func-data (get function 'edebug))) 3457 (let ((func-data (get function 'edebug)))
3488 (if (or (null func-data) (markerp func-data)) 3458 (if (or (null func-data) (markerp func-data))
3489 (edebug-original-debug-on-entry function) 3459 (edebug-original-debug-on-entry function)
3490 (edebug-on-entry function)))) 3460 (edebug-on-entry function))))
3574 (last-command-char edebug-outside-last-command-char) 3544 (last-command-char edebug-outside-last-command-char)
3575 (last-command-event edebug-outside-last-command-event) 3545 (last-command-event edebug-outside-last-command-event)
3576 (last-command edebug-outside-last-command) 3546 (last-command edebug-outside-last-command)
3577 (this-command edebug-outside-this-command) 3547 (this-command edebug-outside-this-command)
3578 (unread-command-char edebug-outside-unread-command-char) 3548 (unread-command-char edebug-outside-unread-command-char)
3579 (unread-command-event edebug-outside-unread-command-event)
3580 (unread-command-events edebug-outside-unread-command-events) 3549 (unread-command-events edebug-outside-unread-command-events)
3581 (current-prefix-arg edebug-outside-current-prefix-arg) 3550 (current-prefix-arg edebug-outside-current-prefix-arg)
3582 (last-input-char edebug-outside-last-input-char) 3551 (last-input-char edebug-outside-last-input-char)
3583 (last-input-event edebug-outside-last-input-event) 3552 (last-input-event edebug-outside-last-input-event)
3584 (last-event-frame edebug-outside-last-event-frame) 3553 (last-event-frame edebug-outside-last-event-frame)
3616 edebug-outside-last-command-char last-command-char 3585 edebug-outside-last-command-char last-command-char
3617 edebug-outside-last-command-event last-command-event 3586 edebug-outside-last-command-event last-command-event
3618 edebug-outside-last-command last-command 3587 edebug-outside-last-command last-command
3619 edebug-outside-this-command this-command 3588 edebug-outside-this-command this-command
3620 edebug-outside-unread-command-char unread-command-char 3589 edebug-outside-unread-command-char unread-command-char
3621 edebug-outside-unread-command-event unread-command-event
3622 edebug-outside-unread-command-events unread-command-events 3590 edebug-outside-unread-command-events unread-command-events
3623 edebug-outside-current-prefix-arg current-prefix-arg 3591 edebug-outside-current-prefix-arg current-prefix-arg
3624 edebug-outside-last-input-char last-input-char 3592 edebug-outside-last-input-char last-input-char
3625 edebug-outside-last-input-event last-input-event 3593 edebug-outside-last-input-event last-input-event
3626 edebug-outside-last-event-frame last-event-frame 3594 edebug-outside-last-event-frame last-event-frame
4325 ["Expression" edebug-eval-expression t] 4293 ["Expression" edebug-eval-expression t]
4326 ["Last Sexp" edebug-eval-last-sexp t] 4294 ["Last Sexp" edebug-eval-last-sexp t]
4327 ["Visit Eval List" edebug-visit-eval-list t]) 4295 ["Visit Eval List" edebug-visit-eval-list t])
4328 4296
4329 ("Options" 4297 ("Options"
4330 ["Edebug All Defs" edebug-all-defs t] 4298 ["Edebug All Defs" edebug-all-defs
4331 ["Edebug All Forms" edebug-all-forms t] 4299 :style toggle :selected edebug-all-defs]
4300 ["Edebug All Forms" edebug-all-forms
4301 :style toggle :selected edebug-all-forms]
4332 "----" 4302 "----"
4333 ["Toggle Tracing" (edebug-toggle 'edebug-trace) t] 4303 ["Tracing" (edebug-toggle 'edebug-trace)
4334 ["Toggle Coverage Testing" (edebug-toggle 'edebug-test-coverage) t] 4304 :style toggle :selected edebug-trace]
4335 ["Toggle Window Saving" edebug-toggle-save-windows t] 4305 ["Test Coverage" (edebug-toggle 'edebug-test-coverage)
4336 ["Toggle Point Saving" 4306 :style toggle :selected edebug-test-coverage]
4337 (edebug-toggle 'edebug-save-displayed-buffer-points) t] 4307 ["Save Windows" edebug-toggle-save-windows
4308 :style toggle :selected edebug-save-windows]
4309 ["Save Point"
4310 (edebug-toggle 'edebug-save-displayed-buffer-points)
4311 :style toggle :selected edebug-save-displayed-buffer-points]
4338 )) 4312 ))
4339 "Lemacs style menus for Edebug.") 4313 "Menus for Edebug.")
4340 4314
4341 4315
4342 ;;; Emacs version specific code 4316 ;;; Emacs version specific code
4343 4317
4344 ;;; The default for all above is Emacs 18, because it is easier to compile 4318 ;;; The default for all above is Emacs 18, because it is easier to compile
4451 ;; Reenable byte compiler warnings about unread-command-char and -event. 4425 ;; Reenable byte compiler warnings about unread-command-char and -event.
4452 ;; Disabled before edebug-recursive-edit. 4426 ;; Disabled before edebug-recursive-edit.
4453 (eval-when-compile 4427 (eval-when-compile
4454 (if edebug-unread-command-char-warning 4428 (if edebug-unread-command-char-warning
4455 (put 'unread-command-char 'byte-obsolete-variable 4429 (put 'unread-command-char 'byte-obsolete-variable
4456 edebug-unread-command-char-warning)) 4430 edebug-unread-command-char-warning)))
4457 (if edebug-unread-command-event-warning
4458 (put 'unread-command-event 'byte-obsolete-variable
4459 edebug-unread-command-event-warning)))
4460 4431
4461 (eval-when-compile 4432 (eval-when-compile
4462 ;; The body of eval-when-compile seems to get evaluated with eval-defun. 4433 ;; The body of eval-when-compile seems to get evaluated with eval-defun.
4463 ;; We only want to evaluate when actually byte compiling. 4434 ;; We only want to evaluate when actually byte compiling.
4464 ;; But it is OK to evaluate as long as byte-compiler has been loaded. 4435 ;; But it is OK to evaluate as long as byte-compiler has been loaded.