Mercurial > emacs
comparison lisp/emacs-lisp/edebug.el @ 95287:6150694d72ec
(edebug-setup-hook, edebug-all-defs, edebug-all-forms, edebug-eval-macro-args,
edebug-save-windows, edebug-save-displayed-buffer-points, edebug-initial-mode,
edebug-trace, edebug-test-coverage, edebug-continue-kbd-macro,
edebug-print-length, edebug-print-level, edebug-print-circle,
edebug-unwrap-results, edebug-on-error, edebug-on-quit,
edebug-global-break-condition, edebug-sit-for-seconds):
Remove spurious * from defcustom docstrings.
(edebug-unwrap*, edebug-signal, edebug-eval-display):
Improve argument/docstring consistency.
(edebug-test-coverage, edebug-gensym, edebug-read, edebug-top-level-nonstop,
edebug-eval-result-list, edebug-eval-redisplay, edebug-trace):
Fix typos in docstring.
(edebug-eval-defun, edebug-eval-top-level-form, edebug,
edebug-display-freq-count): Reflow docstrings.
(edebug-restore-status): Doc fix.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Sat, 24 May 2008 22:56:41 +0000 |
parents | 90a2847062be |
children | a9dc0e7c3f2b |
comparison
equal
deleted
inserted
replaced
95286:3680efd5ada2 | 95287:6150694d72ec |
---|---|
62 "A source-level debugger for Emacs Lisp." | 62 "A source-level debugger for Emacs Lisp." |
63 :group 'lisp) | 63 :group 'lisp) |
64 | 64 |
65 | 65 |
66 (defcustom edebug-setup-hook nil | 66 (defcustom edebug-setup-hook nil |
67 "*Functions to call before edebug is used. | 67 "Functions to call before edebug is used. |
68 Each time it is set to a new value, Edebug will call those functions | 68 Each time it is set to a new value, Edebug will call those functions |
69 once and then `edebug-setup-hook' is reset to nil. You could use this | 69 once and then `edebug-setup-hook' is reset to nil. You could use this |
70 to load up Edebug specifications associated with a package you are | 70 to load up Edebug specifications associated with a package you are |
71 using but only when you also use Edebug." | 71 using but only when you also use Edebug." |
72 :type 'hook | 72 :type 'hook |
76 ;; because the byte compiler binds them; as a result, if edebug | 76 ;; because the byte compiler binds them; as a result, if edebug |
77 ;; is first loaded for a require in a compilation, they will be left unbound. | 77 ;; is first loaded for a require in a compilation, they will be left unbound. |
78 | 78 |
79 ;;;###autoload | 79 ;;;###autoload |
80 (defcustom edebug-all-defs nil | 80 (defcustom edebug-all-defs nil |
81 "*If non-nil, evaluating defining forms instruments for Edebug. | 81 "If non-nil, evaluating defining forms instruments for Edebug. |
82 This applies to `eval-defun', `eval-region', `eval-buffer', and | 82 This applies to `eval-defun', `eval-region', `eval-buffer', and |
83 `eval-current-buffer'. `eval-region' is also called by | 83 `eval-current-buffer'. `eval-region' is also called by |
84 `eval-last-sexp', and `eval-print-last-sexp'. | 84 `eval-last-sexp', and `eval-print-last-sexp'. |
85 | 85 |
86 You can use the command `edebug-all-defs' to toggle the value of this | 86 You can use the command `edebug-all-defs' to toggle the value of this |
94 ;; because the byte compiler binds them; as a result, if edebug | 94 ;; because the byte compiler binds them; as a result, if edebug |
95 ;; is first loaded for a require in a compilation, they will be left unbound. | 95 ;; is first loaded for a require in a compilation, they will be left unbound. |
96 | 96 |
97 ;;;###autoload | 97 ;;;###autoload |
98 (defcustom edebug-all-forms nil | 98 (defcustom edebug-all-forms nil |
99 "*Non-nil evaluation of all forms will instrument for Edebug. | 99 "Non-nil evaluation of all forms will instrument for Edebug. |
100 This doesn't apply to loading or evaluations in the minibuffer. | 100 This doesn't apply to loading or evaluations in the minibuffer. |
101 Use the command `edebug-all-forms' to toggle the value of this option." | 101 Use the command `edebug-all-forms' to toggle the value of this option." |
102 :type 'boolean | 102 :type 'boolean |
103 :group 'edebug) | 103 :group 'edebug) |
104 | 104 |
105 (defcustom edebug-eval-macro-args nil | 105 (defcustom edebug-eval-macro-args nil |
106 "*Non-nil means all macro call arguments may be evaluated. | 106 "Non-nil means all macro call arguments may be evaluated. |
107 If this variable is nil, the default, Edebug will *not* wrap | 107 If this variable is nil, the default, Edebug will *not* wrap |
108 macro call arguments as if they will be evaluated. | 108 macro call arguments as if they will be evaluated. |
109 For each macro, a `edebug-form-spec' overrides this option. | 109 For each macro, a `edebug-form-spec' overrides this option. |
110 So to specify exceptions for macros that have some arguments evaluated | 110 So to specify exceptions for macros that have some arguments evaluated |
111 and some not, you should specify an `edebug-form-spec'." | 111 and some not, you should specify an `edebug-form-spec'." |
112 :type 'boolean | 112 :type 'boolean |
113 :group 'edebug) | 113 :group 'edebug) |
114 | 114 |
115 (defcustom edebug-save-windows t | 115 (defcustom edebug-save-windows t |
116 "*If non-nil, Edebug saves and restores the window configuration. | 116 "If non-nil, Edebug saves and restores the window configuration. |
117 That takes some time, so if your program does not care what happens to | 117 That takes some time, so if your program does not care what happens to |
118 the window configurations, it is better to set this variable to nil. | 118 the window configurations, it is better to set this variable to nil. |
119 | 119 |
120 If the value is a list, only the listed windows are saved and | 120 If the value is a list, only the listed windows are saved and |
121 restored. | 121 restored. |
123 `edebug-toggle-save-windows' may be used to change this variable." | 123 `edebug-toggle-save-windows' may be used to change this variable." |
124 :type '(choice boolean (repeat string)) | 124 :type '(choice boolean (repeat string)) |
125 :group 'edebug) | 125 :group 'edebug) |
126 | 126 |
127 (defcustom edebug-save-displayed-buffer-points nil | 127 (defcustom edebug-save-displayed-buffer-points nil |
128 "*If non-nil, save and restore point in all displayed buffers. | 128 "If non-nil, save and restore point in all displayed buffers. |
129 | 129 |
130 Saving and restoring point in other buffers is necessary if you are | 130 Saving and restoring point in other buffers is necessary if you are |
131 debugging code that changes the point of a buffer which is displayed | 131 debugging code that changes the point of a buffer which is displayed |
132 in a non-selected window. If Edebug or the user then selects the | 132 in a non-selected window. If Edebug or the user then selects the |
133 window, the buffer's point will be changed to the window's point. | 133 window, the buffer's point will be changed to the window's point. |
137 it." | 137 it." |
138 :type 'boolean | 138 :type 'boolean |
139 :group 'edebug) | 139 :group 'edebug) |
140 | 140 |
141 (defcustom edebug-initial-mode 'step | 141 (defcustom edebug-initial-mode 'step |
142 "*Initial execution mode for Edebug, if non-nil. | 142 "Initial execution mode for Edebug, if non-nil. |
143 If this variable is non-nil, it specifies the initial execution mode | 143 If this variable is non-nil, it specifies the initial execution mode |
144 for Edebug when it is first activated. Possible values are step, next, | 144 for Edebug when it is first activated. Possible values are step, next, |
145 go, Go-nonstop, trace, Trace-fast, continue, and Continue-fast." | 145 go, Go-nonstop, trace, Trace-fast, continue, and Continue-fast." |
146 :type '(choice (const step) (const next) (const go) | 146 :type '(choice (const step) (const next) (const go) |
147 (const Go-nonstop) (const trace) | 147 (const Go-nonstop) (const trace) |
148 (const Trace-fast) (const continue) | 148 (const Trace-fast) (const continue) |
149 (const Continue-fast)) | 149 (const Continue-fast)) |
150 :group 'edebug) | 150 :group 'edebug) |
151 | 151 |
152 (defcustom edebug-trace nil | 152 (defcustom edebug-trace nil |
153 "*Non-nil means display a trace of function entry and exit. | 153 "Non-nil means display a trace of function entry and exit. |
154 Tracing output is displayed in a buffer named `*edebug-trace*', one | 154 Tracing output is displayed in a buffer named `*edebug-trace*', one |
155 function entry or exit per line, indented by the recursion level. | 155 function entry or exit per line, indented by the recursion level. |
156 | 156 |
157 You can customize by replacing functions `edebug-print-trace-before' | 157 You can customize by replacing functions `edebug-print-trace-before' |
158 and `edebug-print-trace-after'." | 158 and `edebug-print-trace-after'." |
159 :type 'boolean | 159 :type 'boolean |
160 :group 'edebug) | 160 :group 'edebug) |
161 | 161 |
162 (defcustom edebug-test-coverage nil | 162 (defcustom edebug-test-coverage nil |
163 "*If non-nil, Edebug tests coverage of all expressions debugged. | 163 "If non-nil, Edebug tests coverage of all expressions debugged. |
164 This is done by comparing the result of each expression | 164 This is done by comparing the result of each expression with the |
165 with the previous result. Coverage is considered OK if two different | 165 previous result. Coverage is considered OK if two different |
166 results are found. | 166 results are found. |
167 | 167 |
168 Use `edebug-display-freq-count' to display the frequency count and | 168 Use `edebug-display-freq-count' to display the frequency count and |
169 coverage information for a definition." | 169 coverage information for a definition." |
170 :type 'boolean | 170 :type 'boolean |
171 :group 'edebug) | 171 :group 'edebug) |
172 | 172 |
173 (defcustom edebug-continue-kbd-macro nil | 173 (defcustom edebug-continue-kbd-macro nil |
174 "*If non-nil, continue defining or executing any keyboard macro. | 174 "If non-nil, continue defining or executing any keyboard macro. |
175 Use this with caution since it is not debugged." | 175 Use this with caution since it is not debugged." |
176 :type 'boolean | 176 :type 'boolean |
177 :group 'edebug) | 177 :group 'edebug) |
178 | 178 |
179 | 179 |
180 (defcustom edebug-print-length 50 | 180 (defcustom edebug-print-length 50 |
181 "*Default value of `print-length' for printing results in Edebug." | 181 "Default value of `print-length' for printing results in Edebug." |
182 :type 'integer | 182 :type 'integer |
183 :group 'edebug) | 183 :group 'edebug) |
184 (defcustom edebug-print-level 50 | 184 (defcustom edebug-print-level 50 |
185 "*Default value of `print-level' for printing results in Edebug." | 185 "Default value of `print-level' for printing results in Edebug." |
186 :type 'integer | 186 :type 'integer |
187 :group 'edebug) | 187 :group 'edebug) |
188 (defcustom edebug-print-circle t | 188 (defcustom edebug-print-circle t |
189 "*Default value of `print-circle' for printing results in Edebug." | 189 "Default value of `print-circle' for printing results in Edebug." |
190 :type 'boolean | 190 :type 'boolean |
191 :group 'edebug) | 191 :group 'edebug) |
192 | 192 |
193 (defcustom edebug-unwrap-results nil | 193 (defcustom edebug-unwrap-results nil |
194 "*Non-nil if Edebug should unwrap results of expressions. | 194 "Non-nil if Edebug should unwrap results of expressions. |
195 This is useful when debugging macros where the results of expressions | 195 This is useful when debugging macros where the results of expressions |
196 are instrumented expressions. But don't do this when results might be | 196 are instrumented expressions. But don't do this when results might be |
197 circular or an infinite loop will result." | 197 circular or an infinite loop will result." |
198 :type 'boolean | 198 :type 'boolean |
199 :group 'edebug) | 199 :group 'edebug) |
200 | 200 |
201 (defcustom edebug-on-error t | 201 (defcustom edebug-on-error t |
202 "*Value bound to `debug-on-error' while Edebug is active. | 202 "Value bound to `debug-on-error' while Edebug is active. |
203 | 203 |
204 If `debug-on-error' is non-nil, that value is still used. | 204 If `debug-on-error' is non-nil, that value is still used. |
205 | 205 |
206 If the value is a list of signal names, Edebug will stop when any of | 206 If the value is a list of signal names, Edebug will stop when any of |
207 these errors are signaled from Lisp code whether or not the signal is | 207 these errors are signaled from Lisp code whether or not the signal is |
214 (symbol :format "%v")) | 214 (symbol :format "%v")) |
215 (const :tag "always" t)) | 215 (const :tag "always" t)) |
216 :group 'edebug) | 216 :group 'edebug) |
217 | 217 |
218 (defcustom edebug-on-quit t | 218 (defcustom edebug-on-quit t |
219 "*Value bound to `debug-on-quit' while Edebug is active." | 219 "Value bound to `debug-on-quit' while Edebug is active." |
220 :type 'boolean | 220 :type 'boolean |
221 :group 'edebug) | 221 :group 'edebug) |
222 | 222 |
223 (defcustom edebug-global-break-condition nil | 223 (defcustom edebug-global-break-condition nil |
224 "*If non-nil, an expression to test for at every stop point. | 224 "If non-nil, an expression to test for at every stop point. |
225 If the result is non-nil, then break. Errors are ignored." | 225 If the result is non-nil, then break. Errors are ignored." |
226 :type 'sexp | 226 :type 'sexp |
227 :group 'edebug) | 227 :group 'edebug) |
228 | 228 |
229 (defcustom edebug-sit-for-seconds 1 | 229 (defcustom edebug-sit-for-seconds 1 |
230 "*Number of seconds to pause when execution mode is `trace'." | 230 "Number of seconds to pause when execution mode is `trace'." |
231 :type 'number | 231 :type 'number |
232 :group 'edebug) | 232 :group 'edebug) |
233 | 233 |
234 ;;; Form spec utilities. | 234 ;;; Form spec utilities. |
235 | 235 |
269 (defvar edebug-gensym-index 0 | 269 (defvar edebug-gensym-index 0 |
270 "Integer used by `edebug-gensym' to produce new names.") | 270 "Integer used by `edebug-gensym' to produce new names.") |
271 | 271 |
272 (defun edebug-gensym (&optional prefix) | 272 (defun edebug-gensym (&optional prefix) |
273 "Generate a fresh uninterned symbol. | 273 "Generate a fresh uninterned symbol. |
274 There is an optional argument, PREFIX. PREFIX is the | 274 There is an optional argument, PREFIX. PREFIX is the string |
275 string that begins the new name. Most people take just the default, | 275 that begins the new name. Most people take just the default, |
276 except when debugging needs suggest otherwise." | 276 except when debugging needs suggest otherwise." |
277 (if (null prefix) | 277 (if (null prefix) |
278 (setq prefix "G")) | 278 (setq prefix "G")) |
279 (let ((newsymbol nil) | 279 (let ((newsymbol nil) |
280 (newname "")) | 280 (newname "")) |
468 a function (call it with no arguments for each character, | 468 a function (call it with no arguments for each character, |
469 call it with a char as argument to push a char back) | 469 call it with a char as argument to push a char back) |
470 a string (takes text from string, starting at the beginning) | 470 a string (takes text from string, starting at the beginning) |
471 t (read text line using minibuffer and use it). | 471 t (read text line using minibuffer and use it). |
472 | 472 |
473 This version, from Edebug, maybe instruments the expression. But the | 473 This version, from Edebug, maybe instruments the expression. But the |
474 STREAM must be the current buffer to do so. Whether it instruments is | 474 STREAM must be the current buffer to do so. Whether it instruments is |
475 also dependent on the values of `edebug-all-defs' and | 475 also dependent on the values of `edebug-all-defs' and |
476 `edebug-all-forms'." | 476 `edebug-all-forms'." |
477 (or stream (setq stream standard-input)) | 477 (or stream (setq stream standard-input)) |
478 (if (eq stream (current-buffer)) | 478 (if (eq stream (current-buffer)) |
497 | 497 |
498 Setting `edebug-all-defs' to a non-nil value reverses the meaning of | 498 Setting `edebug-all-defs' to a non-nil value reverses the meaning of |
499 the prefix argument. Code is then instrumented when this function is | 499 the prefix argument. Code is then instrumented when this function is |
500 invoked without a prefix argument | 500 invoked without a prefix argument |
501 | 501 |
502 If acting on a `defun' for FUNCTION, and the function was | 502 If acting on a `defun' for FUNCTION, and the function was instrumented, |
503 instrumented, `Edebug: FUNCTION' is printed in the minibuffer. If not | 503 `Edebug: FUNCTION' is printed in the minibuffer. If not instrumented, |
504 instrumented, just FUNCTION is printed. | 504 just FUNCTION is printed. |
505 | 505 |
506 If not acting on a `defun', the result of evaluation is displayed in | 506 If not acting on a `defun', the result of evaluation is displayed in |
507 the minibuffer." | 507 the minibuffer." |
508 (interactive "P") | 508 (interactive "P") |
509 (let* ((edebugging (not (eq (not edebug-it) (not edebug-all-defs)))) | 509 (let* ((edebugging (not (eq (not edebug-it) (not edebug-all-defs)))) |
548 "Evaluate the top level form point is in, stepping through with Edebug. | 548 "Evaluate the top level form point is in, stepping through with Edebug. |
549 This is like `eval-defun' except that it steps the code for Edebug | 549 This is like `eval-defun' except that it steps the code for Edebug |
550 before evaluating it. It displays the value in the echo area | 550 before evaluating it. It displays the value in the echo area |
551 using `eval-expression' (which see). | 551 using `eval-expression' (which see). |
552 | 552 |
553 If you do this on a function definition | 553 If you do this on a function definition such as a defun or defmacro, |
554 such as a defun or defmacro, it defines the function and instruments | 554 it defines the function and instruments its definition for Edebug, |
555 its definition for Edebug, so it will do Edebug stepping when called | 555 so it will do Edebug stepping when called later. It displays |
556 later. It displays `Edebug: FUNCTION' in the echo area to indicate | 556 `Edebug: FUNCTION' in the echo area to indicate that FUNCTION is now |
557 that FUNCTION is now instrumented for Edebug. | 557 instrumented for Edebug. |
558 | 558 |
559 If the current defun is actually a call to `defvar' or `defcustom', | 559 If the current defun is actually a call to `defvar' or `defcustom', |
560 evaluating it this way resets the variable using its initial value | 560 evaluating it this way resets the variable using its initial value |
561 expression even if the variable already has some other value. | 561 expression even if the variable already has some other value. |
562 \(Normally `defvar' and `defcustom' do not alter the value if there | 562 \(Normally `defvar' and `defcustom' do not alter the value if there |
1274 (t sexp);; otherwise it is not wrapped, so just return it. | 1274 (t sexp);; otherwise it is not wrapped, so just return it. |
1275 ) | 1275 ) |
1276 sexp)) | 1276 sexp)) |
1277 | 1277 |
1278 (defun edebug-unwrap* (sexp) | 1278 (defun edebug-unwrap* (sexp) |
1279 "Return the sexp recursively unwrapped." | 1279 "Return the SEXP recursively unwrapped." |
1280 (let ((new-sexp (edebug-unwrap sexp))) | 1280 (let ((new-sexp (edebug-unwrap sexp))) |
1281 (while (not (eq sexp new-sexp)) | 1281 (while (not (eq sexp new-sexp)) |
1282 (setq sexp new-sexp | 1282 (setq sexp new-sexp |
1283 new-sexp (edebug-unwrap sexp))) | 1283 new-sexp (edebug-unwrap sexp))) |
1284 (if (consp new-sexp) | 1284 (if (consp new-sexp) |
2227 See `condition-case'. | 2227 See `condition-case'. |
2228 | 2228 |
2229 This is the Edebug replacement for the standard `signal'. It should | 2229 This is the Edebug replacement for the standard `signal'. It should |
2230 only be active while Edebug is. It checks `debug-on-error' to see | 2230 only be active while Edebug is. It checks `debug-on-error' to see |
2231 whether it should call the debugger. When execution is resumed, the | 2231 whether it should call the debugger. When execution is resumed, the |
2232 error is signaled again." | 2232 error is signaled again. |
2233 \n(fn SIGNAL-NAME DATA)" | |
2233 (if (and (listp debug-on-error) (memq edebug-signal-name debug-on-error)) | 2234 (if (and (listp debug-on-error) (memq edebug-signal-name debug-on-error)) |
2234 (edebug 'error (cons edebug-signal-name edebug-signal-data))) | 2235 (edebug 'error (cons edebug-signal-name edebug-signal-data))) |
2235 ;; If we reach here without another non-local exit, then send signal again. | 2236 ;; If we reach here without another non-local exit, then send signal again. |
2236 ;; i.e. the signal is not continuable, yet. | 2237 ;; i.e. the signal is not continuable, yet. |
2237 ;; Avoid infinite recursion. | 2238 ;; Avoid infinite recursion. |
2338 (cons (variable-binding-locus var) | 2339 (cons (variable-binding-locus var) |
2339 (symbol-value var))) | 2340 (symbol-value var))) |
2340 | 2341 |
2341 (defun edebug-restore-status (var status) | 2342 (defun edebug-restore-status (var status) |
2342 "Reset VAR based on STATUS. | 2343 "Reset VAR based on STATUS. |
2343 STATUS should be a list you got from `edebug-var-status'." | 2344 STATUS should be a list returned by `edebug-var-status'." |
2344 (let ((locus (car status)) | 2345 (let ((locus (car status)) |
2345 (value (cdr status))) | 2346 (value (cdr status))) |
2346 (cond ((bufferp locus) | 2347 (cond ((bufferp locus) |
2347 (if (buffer-live-p locus) | 2348 (if (buffer-live-p locus) |
2348 (with-current-buffer locus | 2349 (with-current-buffer locus |
3498 (edebug-on-entry function)))) | 3499 (edebug-on-entry function)))) |
3499 | 3500 |
3500 | 3501 |
3501 (defun edebug-top-level-nonstop () | 3502 (defun edebug-top-level-nonstop () |
3502 "Set mode to Go-nonstop, and exit to top-level. | 3503 "Set mode to Go-nonstop, and exit to top-level. |
3503 This is useful for exiting even if unwind-protect code may be executed." | 3504 This is useful for exiting even if `unwind-protect' code may be executed." |
3504 (interactive) | 3505 (interactive) |
3505 (setq edebug-execution-mode 'Go-nonstop) | 3506 (setq edebug-execution-mode 'Go-nonstop) |
3506 (top-level)) | 3507 (top-level)) |
3507 | 3508 |
3508 | 3509 |
3933 ;;; edebug eval list mode | 3934 ;;; edebug eval list mode |
3934 | 3935 |
3935 ;; A list of expressions and their evaluations is displayed in *edebug*. | 3936 ;; A list of expressions and their evaluations is displayed in *edebug*. |
3936 | 3937 |
3937 (defun edebug-eval-result-list () | 3938 (defun edebug-eval-result-list () |
3938 "Return a list of evaluations of edebug-eval-list" | 3939 "Return a list of evaluations of `edebug-eval-list'." |
3939 ;; Assumes in outside environment. | 3940 ;; Assumes in outside environment. |
3940 ;; Don't do any edebug things now. | 3941 ;; Don't do any edebug things now. |
3941 (let ((edebug-execution-mode 'Go-nonstop) | 3942 (let ((edebug-execution-mode 'Go-nonstop) |
3942 (edebug-trace nil)) | 3943 (edebug-trace nil)) |
3943 (mapcar 'edebug-safe-eval edebug-eval-list))) | 3944 (mapcar 'edebug-safe-eval edebug-eval-list))) |
3967 | 3968 |
3968 ;; Should generalize this to be callable outside of edebug | 3969 ;; Should generalize this to be callable outside of edebug |
3969 ;; with calls in user functions, e.g. (edebug-eval-display) | 3970 ;; with calls in user functions, e.g. (edebug-eval-display) |
3970 | 3971 |
3971 (defun edebug-eval-display (edebug-eval-result-list) | 3972 (defun edebug-eval-display (edebug-eval-result-list) |
3972 "Display expressions and evaluations in EVAL-LIST. | 3973 "Display expressions and evaluations in EDEBUG-EVAL-RESULT-LIST. |
3973 It modifies the context by popping up the eval display." | 3974 It modifies the context by popping up the eval display." |
3974 (if edebug-eval-result-list | 3975 (if edebug-eval-result-list |
3975 (progn | 3976 (progn |
3976 (edebug-create-eval-buffer) | 3977 (edebug-create-eval-buffer) |
3977 (edebug-eval-display-list edebug-eval-result-list) | 3978 (edebug-eval-display-list edebug-eval-result-list) |
3978 ))) | 3979 ))) |
3979 | 3980 |
3980 (defun edebug-eval-redisplay () | 3981 (defun edebug-eval-redisplay () |
3981 "Redisplay eval list in outside environment. | 3982 "Redisplay eval list in outside environment. |
3982 May only be called from within edebug-recursive-edit." | 3983 May only be called from within `edebug-recursive-edit'." |
3983 (edebug-create-eval-buffer) | 3984 (edebug-create-eval-buffer) |
3984 (edebug-outside-excursion | 3985 (edebug-outside-excursion |
3985 (edebug-eval-display-list (edebug-eval-result-list)) | 3986 (edebug-eval-display-list (edebug-eval-result-list)) |
3986 )) | 3987 )) |
3987 | 3988 |
4069 ;; Note that debug and its utilities must be byte-compiled to work, | 4070 ;; Note that debug and its utilities must be byte-compiled to work, |
4070 ;; since they depend on the backtrace looking a certain way. But | 4071 ;; since they depend on the backtrace looking a certain way. But |
4071 ;; edebug is not dependent on this, yet. | 4072 ;; edebug is not dependent on this, yet. |
4072 | 4073 |
4073 (defun edebug (&optional edebug-arg-mode &rest debugger-args) | 4074 (defun edebug (&optional edebug-arg-mode &rest debugger-args) |
4074 "Replacement for debug. | 4075 "Replacement for `debug'. |
4075 If we are running an edebugged function, | 4076 If we are running an edebugged function, show where we last were. |
4076 show where we last were. Otherwise call debug normally." | 4077 Otherwise call `debug' normally." |
4077 ;; (message "entered: %s depth: %s edebug-recursion-depth: %s" | 4078 ;; (message "entered: %s depth: %s edebug-recursion-depth: %s" |
4078 ;; edebug-entered (recursion-depth) edebug-recursion-depth) (sit-for 1) | 4079 ;; edebug-entered (recursion-depth) edebug-recursion-depth) (sit-for 1) |
4079 (if (and edebug-entered ; anything active? | 4080 (if (and edebug-entered ; anything active? |
4080 (eq (recursion-depth) edebug-recursion-depth)) | 4081 (eq (recursion-depth) edebug-recursion-depth)) |
4081 (let (;; Where were we before the error occurred? | 4082 (let (;; Where were we before the error occurred? |
4171 (set-buffer oldbuf)) | 4172 (set-buffer oldbuf)) |
4172 buf-name) | 4173 buf-name) |
4173 | 4174 |
4174 | 4175 |
4175 (defun edebug-trace (fmt &rest args) | 4176 (defun edebug-trace (fmt &rest args) |
4176 "Convenience call to edebug-trace-display using edebug-trace-buffer" | 4177 "Convenience call to `edebug-trace-display' using `edebug-trace-buffer'." |
4177 (apply 'edebug-trace-display edebug-trace-buffer fmt args)) | 4178 (apply 'edebug-trace-display edebug-trace-buffer fmt args)) |
4178 | 4179 |
4179 | 4180 |
4180 ;;; Frequency count and coverage | 4181 ;;; Frequency count and coverage |
4181 | 4182 |
4182 (defun edebug-display-freq-count () | 4183 (defun edebug-display-freq-count () |
4183 "Display the frequency count data for each line of the current definition. | 4184 "Display the frequency count data for each line of the current definition. |
4184 The frequency counts are inserted as comment lines after | 4185 The frequency counts are inserted as comment lines after each line, |
4185 each line, and you can undo all insertions with one `undo' command. | 4186 and you can undo all insertions with one `undo' command. |
4186 | 4187 |
4187 The counts are inserted starting under the `(' before an expression | 4188 The counts are inserted starting under the `(' before an expression |
4188 or the `)' after an expression, or on the last char of a symbol. | 4189 or the `)' after an expression, or on the last char of a symbol. |
4189 The counts are only displayed when they differ from previous counts on | 4190 The counts are only displayed when they differ from previous counts on |
4190 the same line. | 4191 the same line. |