diff options
| author | Richard M. Stallman | 1996-03-20 13:30:16 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-03-20 13:30:16 +0000 |
| commit | f7359658348635b5e37de9c89ced90cc271f1fb8 (patch) | |
| tree | b59312cf91c583cd58de625ce11bedaf70a6b899 | |
| parent | 4fd2d8e9bc8e21ba86755679abe8465eb5408b5a (diff) | |
| download | emacs-f7359658348635b5e37de9c89ced90cc271f1fb8.tar.gz emacs-f7359658348635b5e37de9c89ced90cc271f1fb8.zip | |
Comment change.
| -rw-r--r-- | lisp/emacs-lisp/edebug.el | 562 |
1 files changed, 270 insertions, 292 deletions
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 1b55e107c25..7931e449b75 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; edebug.el --- a source-level debugger for Emacs Lispl | 1 | ;;; edebug.el --- a source-level debugger for Emacs Lisp |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1988,'89,'90,'91,'92,'93,'94 Free Software Foundation, Inc | 3 | ;; Copyright (C) 1988,'89,'90,'91,'92,'93,'94,'95 Free Software Foundation, Inc |
| 4 | 4 | ||
| 5 | ;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu> | 5 | ;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu> |
| 6 | ;; Keywords: lisp, tools, maint | 6 | ;; Keywords: lisp, tools, maint |
| @@ -8,7 +8,7 @@ | |||
| 8 | ;; LCD Archive Entry: | 8 | ;; LCD Archive Entry: |
| 9 | ;; edebug|Daniel LaLiberte|liberte@cs.uiuc.edu | 9 | ;; edebug|Daniel LaLiberte|liberte@cs.uiuc.edu |
| 10 | ;; |A source level debugger for Emacs Lisp. | 10 | ;; |A source level debugger for Emacs Lisp. |
| 11 | ;; |$Date: 1994/04/05 01:21:06 $|$Revision: 3.5 $|~/modes/edebug.el| | 11 | ;; |$Date: 1996/03/20 13:19:48 $|$Revision: 3.5.1.27 $|~/modes/edebug.el| |
| 12 | 12 | ||
| 13 | ;; This file is part of GNU Emacs. | 13 | ;; This file is part of GNU Emacs. |
| 14 | 14 | ||
| @@ -23,103 +23,80 @@ | |||
| 23 | ;; GNU General Public License for more details. | 23 | ;; GNU General Public License for more details. |
| 24 | 24 | ||
| 25 | ;; You should have received a copy of the GNU General Public License | 25 | ;; You should have received a copy of the GNU General Public License |
| 26 | ;; along with GNU Emacs; see the file COPYING. If not, write to | 26 | ;; along with GNU Emacs; see the file COPYING. If not, write to the |
| 27 | ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 27 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 28 | 28 | ;; Boston, MA 02111-1307, USA. | |
| 29 | ;;;; Commentary: | 29 | |
| 30 | 30 | ;;; Commentary: | |
| 31 | ;;; This minor mode allows programmers to step through Emacs Lisp | 31 | |
| 32 | ;;; source code while executing functions. You can also set | 32 | ;; This minor mode allows programmers to step through Emacs Lisp |
| 33 | ;;; breakpoints, trace (stopping at each expression), evaluate | 33 | ;; source code while executing functions. You can also set |
| 34 | ;;; expressions as if outside Edebug, reevaluate and display a list of | 34 | ;; breakpoints, trace (stopping at each expression), evaluate |
| 35 | ;;; expressions, trap errors normally caught by debug, and display a | 35 | ;; expressions as if outside Edebug, reevaluate and display a list of |
| 36 | ;;; debug style backtrace. | 36 | ;; expressions, trap errors normally caught by debug, and display a |
| 37 | 37 | ;; debug style backtrace. | |
| 38 | ;;;; Installation | 38 | |
| 39 | ;;; ============= | 39 | ;;; Installation |
| 40 | 40 | ;; ============= | |
| 41 | ;;; Put edebug.el in some directory in your load-path and | 41 | |
| 42 | ;;; byte-compile it. Also read the beginning of edebug-epoch.el, | 42 | ;; Put edebug.el in some directory in your load-path and |
| 43 | ;;; cl-specs.el, and edebug-cl-read.el if they apply to you. | 43 | ;; byte-compile it. Also read the beginning of edebug-epoch.el, |
| 44 | 44 | ;; cl-specs.el, and edebug-cl-read.el if they apply to you. | |
| 45 | ;;; Unless you are using Emacs 19 which is already set up to use Edebug, | 45 | |
| 46 | ;;; put the following forms in your .emacs file. | 46 | ;; Unless you are using Emacs 19 which is already set up to use Edebug, |
| 47 | ;;; (define-key emacs-lisp-mode-map "\C-xx" 'edebug-eval-top-level-form) | 47 | ;; put the following forms in your .emacs file. |
| 48 | ;;; (autoload 'edebug-eval-top-level-form "edebug") | 48 | ;; (define-key emacs-lisp-mode-map "\C-xx" 'edebug-eval-top-level-form) |
| 49 | 49 | ;; (autoload 'edebug-eval-top-level-form "edebug") | |
| 50 | ;;; If you wish to change the default edebug global command prefix, change: | 50 | |
| 51 | ;;; (setq edebug-global-prefix "\C-xX") | 51 | ;; If you wish to change the default edebug global command prefix, change: |
| 52 | 52 | ;; (setq edebug-global-prefix "\C-xX") | |
| 53 | ;;; Other options, are described in the manual. | 53 | |
| 54 | 54 | ;; Other options, are described in the manual. | |
| 55 | ;;; In previous versions of Edebug, users were directed to set | 55 | |
| 56 | ;;; `debugger' to `edebug-debug'. This is no longer necessary | 56 | ;; In previous versions of Edebug, users were directed to set |
| 57 | ;;; since Edebug automatically sets it whenever Edebug is active. | 57 | ;; `debugger' to `edebug-debug'. This is no longer necessary |
| 58 | 58 | ;; since Edebug automatically sets it whenever Edebug is active. | |
| 59 | ;;;; Minimal Instructions | 59 | |
| 60 | ;;; ===================== | 60 | ;;; Minimal Instructions |
| 61 | 61 | ;; ===================== | |
| 62 | ;;; First evaluate a defun with C-xx, then run the function. Step | 62 | |
| 63 | ;;; through the code with SPC, mark breakpoints with b, go until a | 63 | ;; First evaluate a defun with C-xx, then run the function. Step |
| 64 | ;;; breakpoint is reached with g, and quit execution with q. Use the | 64 | ;; through the code with SPC, mark breakpoints with b, go until a |
| 65 | ;;; "?" command in edebug to describe other commands. See edebug.tex | 65 | ;; breakpoint is reached with g, and quit execution with q. Use the |
| 66 | ;;; or the Emacs 19 Lisp Reference Manual for more instructions. | 66 | ;; "?" command in edebug to describe other commands. See edebug.tex |
| 67 | 67 | ;; or the Emacs 19 Lisp Reference Manual for more instructions. | |
| 68 | ;;; Send me your enhancements, ideas, bugs, or fixes. | 68 | |
| 69 | ;;; For bugs, you can call edebug-submit-bug-report if you have reporter.el. | 69 | ;; Send me your enhancements, ideas, bugs, or fixes. |
| 70 | ;;; There is an edebug mailing list if you want to keep up | 70 | ;; For bugs, you can call edebug-submit-bug-report if you have reporter.el. |
| 71 | ;;; with the latest developments. Requests to: edebug-request@cs.uiuc.edu | 71 | ;; There is an edebug mailing list if you want to keep up |
| 72 | 72 | ;; with the latest developments. Requests to: edebug-request@cs.uiuc.edu | |
| 73 | ;;; Daniel LaLiberte 217-398-4114 | 73 | |
| 74 | ;;; University of Illinois, Urbana-Champaign | 74 | ;; Daniel LaLiberte 217-398-4114 |
| 75 | ;;; Department of Computer Science | 75 | ;; University of Illinois, Urbana-Champaign |
| 76 | ;;; 1304 W Springfield | 76 | ;; Department of Computer Science |
| 77 | ;;; Urbana, IL 61801 | 77 | ;; 1304 W Springfield |
| 78 | 78 | ;; Urbana, IL 61801 | |
| 79 | ;;; uiucdcs!liberte | 79 | |
| 80 | ;;; liberte@cs.uiuc.edu | 80 | ;; uiucdcs!liberte |
| 81 | 81 | ;; liberte@cs.uiuc.edu | |
| 82 | ;;; =============================== | 82 | |
| 83 | ;;; $Header: /import/kaplan/kaplan/liberte/Edebug/RCS/edebug.el,v 3.5 1994/04/08 21:39:52 liberte Exp liberte $ | 83 | ;; For the early revision history, see edebug-history. |
| 84 | ;;; $Log: edebug.el,v $ | 84 | |
| 85 | ;;; Revision 3.5 1994/04/04 21:39:52 liberte | 85 | ;;; Code: |
| 86 | ;;; * Change "-emacs-" to "-original-" throughout. | ||
| 87 | ;;; * (edebug-last-sexp) Fix missing ";;" | ||
| 88 | ;;; * (edebug-read) Fix docstring, &optional arg, | ||
| 89 | ;;; and the check that stream is current-buffer. | ||
| 90 | ;;; * (edebug-install-read-eval-functions) Use (elisp-eval-region-install). | ||
| 91 | ;;; * (edebug-uninstall-read-eval-functions) Restore to symbol-function values. | ||
| 92 | ;;; * (edebug-eval-defun) Repair check for edebug-all-defs. | ||
| 93 | ;;; * (edebug-top-level-form) Set edebug-all-defs to t. | ||
| 94 | ;;; * (edebug-read-and-maybe-wrap-form1) Call edebug-original-read | ||
| 95 | ;;; instead of read. | ||
| 96 | ;;; * (edebug-enter) Bind pre-command-hook and post-command-hook to nil. | ||
| 97 | ;;; Reset these variables and executing-macro to outside values. | ||
| 98 | ;;; * (edebug-display) Reset global variables to outside values. | ||
| 99 | ;;; * (edebug-recursive-edit) Reset global variables to outside values. | ||
| 100 | ;;; * (edebug-outside-excursion) Set outside values of global variables | ||
| 101 | ;;; in case they were changed by side effect. | ||
| 102 | ;;; * (edebug-instrument-callee) Use edebug-original-read instaed of read. | ||
| 103 | ;;; * (edebug-eval-result-list) While evaluating evaluation list, | ||
| 104 | ;;; bind edebug-execution-mode and edebug-trace to nil, to avoid loop. | ||
| 105 | ;;; | ||
| 106 | ;;; | ||
| 107 | ;;; For the rest of the revision history, see edebug-history. | ||
| 108 | 86 | ||
| 109 | (defconst edebug-version | 87 | (defconst edebug-version |
| 110 | (let ((raw-version "$Revision: 3.5 $")) | 88 | (let ((raw-version "$Revision: 3.5.1.27 $")) |
| 111 | (substring raw-version (string-match "[0-9.]*" raw-version) | 89 | (substring raw-version (string-match "[0-9.]*" raw-version) |
| 112 | (match-end 0)))) | 90 | (match-end 0)))) |
| 113 | 91 | ||
| 114 | (require 'backquote) | 92 | (require 'backquote) |
| 115 | 93 | ||
| 116 | ;; Emacs 18 doesnt have defalias. | 94 | ;; Emacs 18 doesn't have defalias. |
| 117 | (eval-and-compile | 95 | (eval-and-compile |
| 118 | (or (fboundp 'defalias) (fset 'defalias 'fset))) | 96 | (or (fboundp 'defalias) (fset 'defalias 'fset))) |
| 119 | 97 | ||
| 120 | 98 | ||
| 121 | ;;;; Bug reporting | 99 | ;;; Bug reporting |
| 122 | ;;; ============== | ||
| 123 | 100 | ||
| 124 | (defconst edebug-maintainer-address "liberte@cs.uiuc.edu") | 101 | (defconst edebug-maintainer-address "liberte@cs.uiuc.edu") |
| 125 | 102 | ||
| @@ -147,9 +124,7 @@ | |||
| 147 | 'edebug-print-circle | 124 | 'edebug-print-circle |
| 148 | )))) | 125 | )))) |
| 149 | 126 | ||
| 150 | 127 | ;;; Options | |
| 151 | ;;;; Options | ||
| 152 | ;;; =============================== | ||
| 153 | 128 | ||
| 154 | (defvar edebug-setup-hook nil | 129 | (defvar edebug-setup-hook nil |
| 155 | "*Functions to call before edebug is used. | 130 | "*Functions to call before edebug is used. |
| @@ -166,21 +141,21 @@ This applies to `eval-defun', `eval-region', `eval-buffer', and | |||
| 166 | 141 | ||
| 167 | You can use the command `edebug-all-defs' to toggle the value of this | 142 | You can use the command `edebug-all-defs' to toggle the value of this |
| 168 | variable. You may wish to make it local to each buffer with | 143 | variable. You may wish to make it local to each buffer with |
| 169 | (make-local-variable 'edebug-all-defs) in your | 144 | \(make-local-variable 'edebug-all-defs) in your |
| 170 | `emacs-lisp-mode-hook'.") | 145 | `emacs-lisp-mode-hook'.") |
| 171 | 146 | ||
| 172 | (defvar edebug-all-forms nil | 147 | (defvar edebug-all-forms nil |
| 173 | "*Non-nil evaluation of all forms will instrument for Edebug. | 148 | "*Non-nil evaluation of all forms will instrument for Edebug. |
| 174 | This doesn't apply to loading or evaluations in the minibuffer. | 149 | This doesn't apply to loading or evaluations in the minibuffer. |
| 175 | Use the command edebug-all-forms to toggle the value of this option.") | 150 | Use the command `edebug-all-forms' to toggle the value of this option.") |
| 176 | 151 | ||
| 177 | (defvar edebug-eval-macro-args nil | 152 | (defvar edebug-eval-macro-args nil |
| 178 | "*Non-nil means all macro call arguments may be evaluated. | 153 | "*Non-nil means all macro call arguments may be evaluated. |
| 179 | If this variable is nil, the default, edebug will *not* wrap | 154 | If this variable is nil, the default, Edebug will *not* wrap |
| 180 | macro call arguments as if they will be evaluated. | 155 | macro call arguments as if they will be evaluated. |
| 181 | For each macro, a edebug-form-spec overrides this option. | 156 | For each macro, a `edebug-form-spec' overrides this option. |
| 182 | So to specify exceptions for macros that have some arguments evaluated | 157 | So to specify exceptions for macros that have some arguments evaluated |
| 183 | and some not, you should specify an edebug-form-spec. | 158 | and some not, you should specify an `edebug-form-spec'. |
| 184 | 159 | ||
| 185 | This option is going away soon.") | 160 | This option is going away soon.") |
| 186 | 161 | ||
| @@ -241,11 +216,11 @@ Use this with caution since it is not debugged.") | |||
| 241 | 216 | ||
| 242 | 217 | ||
| 243 | (defvar edebug-print-length 50 | 218 | (defvar edebug-print-length 50 |
| 244 | "*Default value of print-length to use while printing results in edebug.") | 219 | "*Default value of `print-length' to use while printing results in Edebug.") |
| 245 | (defvar edebug-print-level 50 | 220 | (defvar edebug-print-level 50 |
| 246 | "*Default value of print-level to use while printing results in edebug.") | 221 | "*Default value of `print-level' to use while printing results in Edebug.") |
| 247 | (defvar edebug-print-circle t | 222 | (defvar edebug-print-circle t |
| 248 | "*Default value of print-circle to use while printing results in edebug.") | 223 | "*Default value of `print-circle' to use while printing results in Edebug.") |
| 249 | 224 | ||
| 250 | (defvar edebug-unwrap-results nil | 225 | (defvar edebug-unwrap-results nil |
| 251 | "*Non-nil if Edebug should unwrap results of expressions. | 226 | "*Non-nil if Edebug should unwrap results of expressions. |
| @@ -271,19 +246,17 @@ After execution is resumed, the error is signaled again.") | |||
| 271 | "*If non-nil, an expression to test for at every stop point. | 246 | "*If non-nil, an expression to test for at every stop point. |
| 272 | If the result is non-nil, then break. Errors are ignored.") | 247 | If the result is non-nil, then break. Errors are ignored.") |
| 273 | 248 | ||
| 274 | 249 | ;;; Form spec utilities. | |
| 275 | ;;;; Form spec utilities. | ||
| 276 | ;;; =============================== | ||
| 277 | 250 | ||
| 278 | ;;;###autoload | 251 | ;;;###autoload |
| 279 | (defmacro def-edebug-spec (symbol spec) | 252 | (defmacro def-edebug-spec (symbol spec) |
| 280 | "Set the edebug-form-spec property of SYMBOL according to SPEC. | 253 | "Set the edebug-form-spec property of SYMBOL according to SPEC. |
| 281 | Both SYMBOL and SPEC are unevaluated. The SPEC can be 0, t, a symbol | 254 | Both SYMBOL and SPEC are unevaluated. The SPEC can be 0, t, a symbol |
| 282 | (naming a function), or a list." | 255 | \(naming a function), or a list." |
| 283 | (` (put (quote (, symbol)) 'edebug-form-spec (quote (, spec))))) | 256 | (` (put (quote (, symbol)) 'edebug-form-spec (quote (, spec))))) |
| 284 | 257 | ||
| 285 | (defmacro def-edebug-form-spec (symbol spec-form) | 258 | (defmacro def-edebug-form-spec (symbol spec-form) |
| 286 | "For compatibility with old version. Use def-edebug-spec instead." | 259 | "For compatibility with old version. Use `def-edebug-spec' instead." |
| 287 | (message "Obsolete: use def-edebug-spec instead.") | 260 | (message "Obsolete: use def-edebug-spec instead.") |
| 288 | (def-edebug-spec symbol (eval spec-form))) | 261 | (def-edebug-spec symbol (eval spec-form))) |
| 289 | 262 | ||
| @@ -298,18 +271,13 @@ Both SYMBOL and SPEC are unevaluated. The SPEC can be 0, t, a symbol | |||
| 298 | edebug-form-spec | 271 | edebug-form-spec |
| 299 | )) | 272 | )) |
| 300 | 273 | ||
| 274 | ;;; Utilities | ||
| 301 | 275 | ||
| 302 | ;;;; Utilities | 276 | ;; Define edebug-gensym - from old cl.el |
| 303 | ;;; =============================== | 277 | (defvar edebug-gensym-index 0 |
| 304 | 278 | "Integer used by `edebug-gensym' to produce new names.") | |
| 305 | (if (not (fboundp 'gensym)) | ||
| 306 | (progn | ||
| 307 | 279 | ||
| 308 | ;; Define gensym - from old cl.el | 280 | (defun edebug-gensym (&optional prefix) |
| 309 | (defvar *gensym-index* 0 | ||
| 310 | "Integer used by gensym to produce new names.") | ||
| 311 | |||
| 312 | (defun gensym (&optional prefix) | ||
| 313 | "Generate a fresh uninterned symbol. | 281 | "Generate a fresh uninterned symbol. |
| 314 | There is an optional argument, PREFIX. PREFIX is the | 282 | There is an optional argument, PREFIX. PREFIX is the |
| 315 | string that begins the new name. Most people take just the default, | 283 | string that begins the new name. Most people take just the default, |
| @@ -319,31 +287,29 @@ except when debugging needs suggest otherwise." | |||
| 319 | (let ((newsymbol nil) | 287 | (let ((newsymbol nil) |
| 320 | (newname "")) | 288 | (newname "")) |
| 321 | (while (not newsymbol) | 289 | (while (not newsymbol) |
| 322 | (setq newname (concat prefix *gensym-index*)) | 290 | (setq newname (concat prefix (int-to-string edebug-gensym-index))) |
| 323 | (setq *gensym-index* (+ *gensym-index* 1)) | 291 | (setq edebug-gensym-index (+ edebug-gensym-index 1)) |
| 324 | (if (not (intern-soft newname)) | 292 | (if (not (intern-soft newname)) |
| 325 | (setq newsymbol (make-symbol newname)))) | 293 | (setq newsymbol (make-symbol newname)))) |
| 326 | newsymbol)) | 294 | newsymbol)) |
| 327 | )) | ||
| 328 | 295 | ||
| 329 | ;; Only used by CL-like code. | 296 | ;; Only used by CL-like code. |
| 330 | '(if (not (fboundp 'keywordp)) | 297 | (defun edebug-keywordp (object) |
| 331 | (defun keywordp (object) | 298 | "Return t if OBJECT is a keyword. |
| 332 | "Return t if OBJECT is a keyword. | 299 | A keyword is a symbol that starts with `:'." |
| 333 | A keyword is a symbol that starts with "":""." | 300 | (and (symbolp object) |
| 334 | (and (symbolp object) | 301 | (= ?: (aref (symbol-name object) 0)))) |
| 335 | (= ?: (aref (symbol-name object) 0))))) | 302 | |
| 336 | 303 | (defun edebug-lambda-list-keywordp (object) | |
| 337 | (defun lambda-list-keywordp (object) | ||
| 338 | "Return t if OBJECT is a lambda list keyword. | 304 | "Return t if OBJECT is a lambda list keyword. |
| 339 | A lambda list keyword is a symbol that starts with ""&""." | 305 | A lambda list keyword is a symbol that starts with `&'." |
| 340 | (and (symbolp object) | 306 | (and (symbolp object) |
| 341 | (= ?& (aref (symbol-name object) 0)))) | 307 | (= ?& (aref (symbol-name object) 0)))) |
| 342 | 308 | ||
| 343 | 309 | ||
| 344 | (defun edebug-last-sexp () | 310 | (defun edebug-last-sexp () |
| 345 | ;; Return the last sexp before point in current buffer. | 311 | ;; Return the last sexp before point in current buffer. |
| 346 | ;; Assumes elisp syntax is active. | 312 | ;; Assumes Emacs Lisp syntax is active. |
| 347 | (car | 313 | (car |
| 348 | (read-from-string | 314 | (read-from-string |
| 349 | (buffer-substring | 315 | (buffer-substring |
| @@ -353,8 +319,8 @@ A lambda list keyword is a symbol that starts with ""&""." | |||
| 353 | (point))))) | 319 | (point))))) |
| 354 | 320 | ||
| 355 | (defun edebug-window-list () | 321 | (defun edebug-window-list () |
| 356 | "Return a list of windows, in order of next-window." | 322 | "Return a list of windows, in order of `next-window'." |
| 357 | ;; This doesnt work for epoch. | 323 | ;; This doesn't work for epoch. |
| 358 | (let* ((first-window (selected-window)) | 324 | (let* ((first-window (selected-window)) |
| 359 | (window-list (list first-window)) | 325 | (window-list (list first-window)) |
| 360 | (next (next-window first-window))) | 326 | (next (next-window first-window))) |
| @@ -396,6 +362,7 @@ A lambda list keyword is a symbol that starts with ""&""." | |||
| 396 | "Returns the function named by OBJECT, or nil if it is not a function." | 362 | "Returns the function named by OBJECT, or nil if it is not a function." |
| 397 | (setq object (edebug-lookup-function object)) | 363 | (setq object (edebug-lookup-function object)) |
| 398 | (if (or (subrp object) | 364 | (if (or (subrp object) |
| 365 | (byte-code-function-p object) | ||
| 399 | (and (listp object) | 366 | (and (listp object) |
| 400 | (eq (car object) 'lambda) | 367 | (eq (car object) 'lambda) |
| 401 | (listp (car (cdr object))))) | 368 | (listp (car (cdr object))))) |
| @@ -426,8 +393,7 @@ Return the result of the last expression in BODY." | |||
| 426 | (set-buffer (marker-buffer edebug:s-r-beg)) | 393 | (set-buffer (marker-buffer edebug:s-r-beg)) |
| 427 | (narrow-to-region edebug:s-r-beg edebug:s-r-end)))))) | 394 | (narrow-to-region edebug:s-r-beg edebug:s-r-end)))))) |
| 428 | 395 | ||
| 429 | ;;;; Display | 396 | ;;; Display |
| 430 | ;;; ============ | ||
| 431 | 397 | ||
| 432 | (defconst edebug-trace-buffer "*edebug-trace*" | 398 | (defconst edebug-trace-buffer "*edebug-trace*" |
| 433 | "Name of the buffer to put trace info in.") | 399 | "Name of the buffer to put trace info in.") |
| @@ -449,7 +415,7 @@ Return the result of the last expression in BODY." | |||
| 449 | (split-window)) | 415 | (split-window)) |
| 450 | ;; (message "next window: %s" (next-window)) (sit-for 1) | 416 | ;; (message "next window: %s" (next-window)) (sit-for 1) |
| 451 | (if (eq (get-buffer-window edebug-trace-buffer) (next-window)) | 417 | (if (eq (get-buffer-window edebug-trace-buffer) (next-window)) |
| 452 | ;; Dont select trace window | 418 | ;; Don't select trace window |
| 453 | nil | 419 | nil |
| 454 | (select-window (next-window)))) | 420 | (select-window (next-window)))) |
| 455 | (set-window-buffer (selected-window) buffer) | 421 | (set-window-buffer (selected-window) buffer) |
| @@ -521,13 +487,12 @@ Return the result of the last expression in BODY." | |||
| 521 | (defalias 'edebug-input-pending-p 'input-pending-p) | 487 | (defalias 'edebug-input-pending-p 'input-pending-p) |
| 522 | 488 | ||
| 523 | 489 | ||
| 524 | ;;;; Redefine read and eval functions | 490 | ;;; Redefine read and eval functions |
| 525 | ;;; ================================= | 491 | ;; read is redefined to maybe instrument forms. |
| 526 | ;;; read is redefined to maybe instrument forms. | 492 | ;; eval-defun is redefined to check edebug-all-forms and edebug-all-defs. |
| 527 | ;;; eval-defun is redefined to check edebug-all-forms and edebug-all-defs. | ||
| 528 | 493 | ||
| 529 | ;;; Use the Lisp version of eval-region. | 494 | ;; Use the Lisp version of eval-region. |
| 530 | (require 'elisp-eval-region "eval-region") | 495 | (require 'eval-reg "eval-reg") |
| 531 | 496 | ||
| 532 | ;; Save the original read function | 497 | ;; Save the original read function |
| 533 | (or (fboundp 'edebug-original-read) | 498 | (or (fboundp 'edebug-original-read) |
| @@ -545,7 +510,7 @@ STREAM or the value of `standard-input' may be: | |||
| 545 | t (read text line using minibuffer and use it). | 510 | t (read text line using minibuffer and use it). |
| 546 | 511 | ||
| 547 | This version, from Edebug, maybe instruments the expression. But the | 512 | This version, from Edebug, maybe instruments the expression. But the |
| 548 | STREAM must be the current buffer to do so. Whether it instuments is | 513 | STREAM must be the current buffer to do so. Whether it instruments is |
| 549 | also dependent on the values of `edebug-all-defs' and | 514 | also dependent on the values of `edebug-all-defs' and |
| 550 | `edebug-all-forms'." | 515 | `edebug-all-forms'." |
| 551 | (or stream (setq stream standard-input)) | 516 | (or stream (setq stream standard-input)) |
| @@ -556,22 +521,27 @@ also dependent on the values of `edebug-all-defs' and | |||
| 556 | (or (fboundp 'edebug-original-eval-defun) | 521 | (or (fboundp 'edebug-original-eval-defun) |
| 557 | (defalias 'edebug-original-eval-defun (symbol-function 'eval-defun))) | 522 | (defalias 'edebug-original-eval-defun (symbol-function 'eval-defun))) |
| 558 | 523 | ||
| 524 | ;; We should somehow arrange to be able to do this | ||
| 525 | ;; without actually replacing the eval-defun command. | ||
| 559 | (defun edebug-eval-defun (edebug-it) | 526 | (defun edebug-eval-defun (edebug-it) |
| 560 | "Evaluate the top-level form containing point, or after point. | 527 | "Evaluate the top-level form containing point, or after point. |
| 561 | 528 | ||
| 562 | This version, from Edebug, has the following differences: With a | 529 | This version, from Edebug, has the following differences: With a |
| 563 | prefix argument instrument the code for Edebug. If `edebug-all-defs' is | 530 | prefix argument instrument the code for Edebug. If `edebug-all-defs' is |
| 564 | non-nil, then the code is instrumented *unless* there is a prefix | 531 | non-nil, then the code is instrumented *unless* there is a prefix |
| 565 | argument. If instrumenting, it prints: \"Edebug: <function name>\". | 532 | argument. If instrumenting, it prints: `Edebug: FUNCTIONNAME'. |
| 566 | Otherwise, it prints in the minibuffer." | 533 | Otherwise, it prints in the minibuffer." |
| 567 | (interactive "P") | 534 | (interactive "P") |
| 568 | (let ((edebugging (not (eq (not edebug-it) (not edebug-all-defs)))) | 535 | (let* ((edebugging (not (eq (not edebug-it) (not edebug-all-defs)))) |
| 569 | (edebug-result)) | 536 | (edebug-result) |
| 570 | (setq edebug-result | 537 | (form |
| 571 | (eval | 538 | (let ((edebug-all-forms edebugging) |
| 572 | (let ((edebug-all-forms edebugging) | 539 | (edebug-all-defs (eq edebug-all-defs (not edebug-it)))) |
| 573 | (edebug-all-defs (eq edebug-all-defs (not edebug-it)))) | 540 | (edebug-read-top-level-form)))) |
| 574 | (edebug-read-top-level-form)))) | 541 | (if (and (eq (car form) 'defvar) |
| 542 | (cdr-safe (cdr-safe form))) | ||
| 543 | (setq form (cons 'defconst (cdr form)))) | ||
| 544 | (setq edebug-result (eval form)) | ||
| 575 | (if (not edebugging) | 545 | (if (not edebugging) |
| 576 | (princ edebug-result) | 546 | (princ edebug-result) |
| 577 | edebug-result))) | 547 | edebug-result))) |
| @@ -585,11 +555,10 @@ Otherwise, it prints in the minibuffer." | |||
| 585 | "Evaluate a top level form, such as a defun or defmacro. | 555 | "Evaluate a top level form, such as a defun or defmacro. |
| 586 | This is like `eval-defun', but the code is always instrumented for Edebug. | 556 | This is like `eval-defun', but the code is always instrumented for Edebug. |
| 587 | Print its name in the minibuffer and leave point where it is, | 557 | Print its name in the minibuffer and leave point where it is, |
| 588 | or if an error occurs, leave point after it with mark at the original | 558 | or if an error occurs, leave point after it with mark at the original point." |
| 589 | point." | ||
| 590 | (interactive) | 559 | (interactive) |
| 591 | (eval | 560 | (eval |
| 592 | ;; Bind edebug-all-forms only while reading, not while evaling | 561 | ;; Bind edebug-all-forms only while reading, not while evalling |
| 593 | ;; but this causes problems while edebugging edebug. | 562 | ;; but this causes problems while edebugging edebug. |
| 594 | (let ((edebug-all-forms t) | 563 | (let ((edebug-all-forms t) |
| 595 | (edebug-all-defs t)) | 564 | (edebug-all-defs t)) |
| @@ -628,7 +597,7 @@ point." | |||
| 628 | (defun edebug-install-read-eval-functions () | 597 | (defun edebug-install-read-eval-functions () |
| 629 | (interactive) | 598 | (interactive) |
| 630 | ;; Don't install if already installed. | 599 | ;; Don't install if already installed. |
| 631 | (if (eq 'read 'edebug-read) nil | 600 | (if (eq (symbol-function 'read) 'edebug-read) nil |
| 632 | (elisp-eval-region-install) | 601 | (elisp-eval-region-install) |
| 633 | (defalias 'read 'edebug-read) | 602 | (defalias 'read 'edebug-read) |
| 634 | (defalias 'eval-defun 'edebug-eval-defun))) | 603 | (defalias 'eval-defun 'edebug-eval-defun))) |
| @@ -640,11 +609,10 @@ point." | |||
| 640 | (defalias 'eval-defun (symbol-function 'edebug-original-eval-defun))) | 609 | (defalias 'eval-defun (symbol-function 'edebug-original-eval-defun))) |
| 641 | 610 | ||
| 642 | 611 | ||
| 643 | ;;;; Edebug internal data | 612 | ;;; Edebug internal data |
| 644 | ;;; =============================== | ||
| 645 | 613 | ||
| 646 | ;;; The internal data that is needed for edebugging is kept in the | 614 | ;; The internal data that is needed for edebugging is kept in the |
| 647 | ;;; buffer-local variable `edebug-form-data'. | 615 | ;; buffer-local variable `edebug-form-data'. |
| 648 | 616 | ||
| 649 | (make-variable-buffer-local 'edebug-form-data) | 617 | (make-variable-buffer-local 'edebug-form-data) |
| 650 | 618 | ||
| @@ -725,10 +693,7 @@ point." | |||
| 725 | ;; (set-marker (nth 2 entry) nil) | 693 | ;; (set-marker (nth 2 entry) nil) |
| 726 | (setq edebug-form-data (delq entry edebug-form-data))))) | 694 | (setq edebug-form-data (delq entry edebug-form-data))))) |
| 727 | 695 | ||
| 728 | 696 | ;;; Parser utilities | |
| 729 | ;;;; Parser utilities | ||
| 730 | ;;; =============================== | ||
| 731 | |||
| 732 | 697 | ||
| 733 | (defun edebug-syntax-error (&rest args) | 698 | (defun edebug-syntax-error (&rest args) |
| 734 | ;; Signal an invalid-read-syntax with ARGS. | 699 | ;; Signal an invalid-read-syntax with ARGS. |
| @@ -746,6 +711,8 @@ point." | |||
| 746 | (aset table ?\( 'lparen) | 711 | (aset table ?\( 'lparen) |
| 747 | (aset table ?\) 'rparen) | 712 | (aset table ?\) 'rparen) |
| 748 | (aset table ?\' 'quote) | 713 | (aset table ?\' 'quote) |
| 714 | (aset table ?\` 'backquote) | ||
| 715 | (aset table ?\, 'comma) | ||
| 749 | (aset table ?\" 'string) | 716 | (aset table ?\" 'string) |
| 750 | (aset table ?\? 'char) | 717 | (aset table ?\? 'char) |
| 751 | (aset table ?\[ 'lbracket) | 718 | (aset table ?\[ 'lbracket) |
| @@ -753,12 +720,13 @@ point." | |||
| 753 | (aset table ?\. 'dot) | 720 | (aset table ?\. 'dot) |
| 754 | (aset table ?\# 'hash) | 721 | (aset table ?\# 'hash) |
| 755 | ;; We treat numbers as symbols, because of confusion with -, -1, and 1-. | 722 | ;; We treat numbers as symbols, because of confusion with -, -1, and 1-. |
| 756 | ;; We dont care about any other chars since they wont be seen. | 723 | ;; We don't care about any other chars since they won't be seen. |
| 757 | table)) | 724 | table)) |
| 758 | 725 | ||
| 759 | (defun edebug-next-token-class () | 726 | (defun edebug-next-token-class () |
| 760 | ;; Move to the next token and return its class. We only care about | 727 | ;; Move to the next token and return its class. We only care about |
| 761 | ;; lparen, rparen, dot, quote, string, char, vector, or symbol. | 728 | ;; lparen, rparen, dot, quote, backquote, comma, string, char, vector, |
| 729 | ;; or symbol. | ||
| 762 | (edebug-skip-whitespace) | 730 | (edebug-skip-whitespace) |
| 763 | (aref edebug-read-syntax-table (following-char))) | 731 | (aref edebug-read-syntax-table (following-char))) |
| 764 | 732 | ||
| @@ -795,12 +763,14 @@ point." | |||
| 795 | (forward-char -1)))) | 763 | (forward-char -1)))) |
| 796 | ((eq class 'quote) (forward-char 1) | 764 | ((eq class 'quote) (forward-char 1) |
| 797 | (list 'quote (edebug-read-sexp))) | 765 | (list 'quote (edebug-read-sexp))) |
| 766 | ((eq class 'backquote) | ||
| 767 | (list '\` (edebug-read-sexp))) | ||
| 768 | ((eq class 'comma) | ||
| 769 | (list '\, (edebug-read-sexp))) | ||
| 798 | (t ; anything else, just read it. | 770 | (t ; anything else, just read it. |
| 799 | (edebug-original-read (current-buffer)))))) | 771 | (edebug-original-read (current-buffer)))))) |
| 800 | 772 | ||
| 801 | 773 | ;;; Offsets for reader | |
| 802 | ;;;; Offsets for reader | ||
| 803 | ;;; ============================== | ||
| 804 | 774 | ||
| 805 | ;; Define a structure to represent offset positions of expressions. | 775 | ;; Define a structure to represent offset positions of expressions. |
| 806 | ;; Each offset structure looks like: (before . after) for constituents, | 776 | ;; Each offset structure looks like: (before . after) for constituents, |
| @@ -875,8 +845,8 @@ point." | |||
| 875 | (edebug-store-after-offset (point))))) | 845 | (edebug-store-after-offset (point))))) |
| 876 | 846 | ||
| 877 | 847 | ||
| 878 | ;;;; Reader for Emacs Lisp. | 848 | ;;; Reader for Emacs Lisp. |
| 879 | ;;; ========================================== | 849 | |
| 880 | ;; Uses edebug-next-token-class (and edebug-skip-whitespace) above. | 850 | ;; Uses edebug-next-token-class (and edebug-skip-whitespace) above. |
| 881 | 851 | ||
| 882 | (defconst edebug-read-alist | 852 | (defconst edebug-read-alist |
| @@ -884,6 +854,8 @@ point." | |||
| 884 | (lparen . edebug-read-list) | 854 | (lparen . edebug-read-list) |
| 885 | (string . edebug-read-string) | 855 | (string . edebug-read-string) |
| 886 | (quote . edebug-read-quote) | 856 | (quote . edebug-read-quote) |
| 857 | (backquote . edebug-read-backquote) | ||
| 858 | (comma . edebug-read-comma) | ||
| 887 | (lbracket . edebug-read-vector) | 859 | (lbracket . edebug-read-vector) |
| 888 | (hash . edebug-read-function) | 860 | (hash . edebug-read-function) |
| 889 | )) | 861 | )) |
| @@ -920,6 +892,42 @@ point." | |||
| 920 | (edebug-storing-offsets (point) 'quote) | 892 | (edebug-storing-offsets (point) 'quote) |
| 921 | (edebug-read-storing-offsets stream))) | 893 | (edebug-read-storing-offsets stream))) |
| 922 | 894 | ||
| 895 | (defun edebug-read-backquote (stream) | ||
| 896 | ;; Turn `thing into (\` thing) | ||
| 897 | (let ((opoint (point))) | ||
| 898 | (forward-char 1) | ||
| 899 | ;; Generate the same structure of offsets we would have | ||
| 900 | ;; if the resulting list appeared verbatim in the input text. | ||
| 901 | (edebug-storing-offsets opoint | ||
| 902 | (list | ||
| 903 | (edebug-storing-offsets opoint '\`) | ||
| 904 | (edebug-read-storing-offsets stream))))) | ||
| 905 | |||
| 906 | (defvar edebug-read-backquote-new nil | ||
| 907 | "Non-nil if reading the inside of a new-style backquote with no parens around it. | ||
| 908 | Value of nil means reading the inside of an old-style backquote construct | ||
| 909 | which is surrounded by an extra set of parentheses. | ||
| 910 | This controls how we read comma constructs.") | ||
| 911 | |||
| 912 | (defun edebug-read-comma (stream) | ||
| 913 | ;; Turn ,thing into (\, thing). Handle ,@ and ,. also. | ||
| 914 | (let ((opoint (point))) | ||
| 915 | (forward-char 1) | ||
| 916 | (let ((symbol '\,)) | ||
| 917 | (cond ((eq (following-char) ?\.) | ||
| 918 | (setq symbol '\,\.) | ||
| 919 | (forward-char 1)) | ||
| 920 | ((eq (following-char) ?\@) | ||
| 921 | (setq symbol '\,@) | ||
| 922 | (forward-char 1))) | ||
| 923 | ;; Generate the same structure of offsets we would have | ||
| 924 | ;; if the resulting list appeared verbatim in the input text. | ||
| 925 | (if edebug-read-backquote-new | ||
| 926 | (list | ||
| 927 | (edebug-storing-offsets opoint symbol) | ||
| 928 | (edebug-read-storing-offsets stream)) | ||
| 929 | (edebug-storing-offsets opoint symbol))))) | ||
| 930 | |||
| 923 | (defun edebug-read-function (stream) | 931 | (defun edebug-read-function (stream) |
| 924 | ;; Turn #'thing into (function thing) | 932 | ;; Turn #'thing into (function thing) |
| 925 | (forward-char 1) | 933 | (forward-char 1) |
| @@ -935,7 +943,18 @@ point." | |||
| 935 | (prog1 | 943 | (prog1 |
| 936 | (let ((elements)) | 944 | (let ((elements)) |
| 937 | (while (not (memq (edebug-next-token-class) '(rparen dot))) | 945 | (while (not (memq (edebug-next-token-class) '(rparen dot))) |
| 938 | (setq elements (cons (edebug-read-storing-offsets stream) elements))) | 946 | (if (eq (edebug-next-token-class) 'backquote) |
| 947 | (let ((edebug-read-backquote-new (not (null elements))) | ||
| 948 | (opoint (point))) | ||
| 949 | (if edebug-read-backquote-new | ||
| 950 | (setq elements (cons (edebug-read-backquote stream) elements)) | ||
| 951 | (forward-char 1) ; Skip backquote. | ||
| 952 | ;; Call edebug-storing-offsets here so that we | ||
| 953 | ;; produce the same offsets we would have had | ||
| 954 | ;; if the backquote were an ordinary symbol. | ||
| 955 | (setq elements (cons (edebug-storing-offsets opoint '\`) | ||
| 956 | elements)))) | ||
| 957 | (setq elements (cons (edebug-read-storing-offsets stream) elements)))) | ||
| 939 | (setq elements (nreverse elements)) | 958 | (setq elements (nreverse elements)) |
| 940 | (if (eq 'dot (edebug-next-token-class)) | 959 | (if (eq 'dot (edebug-next-token-class)) |
| 941 | (let (dotted-form) | 960 | (let (dotted-form) |
| @@ -960,10 +979,7 @@ point." | |||
| 960 | (forward-char 1) ; skip \] | 979 | (forward-char 1) ; skip \] |
| 961 | )) | 980 | )) |
| 962 | 981 | ||
| 963 | 982 | ;;; Cursors for traversal of list and vector elements with offsets. | |
| 964 | |||
| 965 | ;;;; Cursors for traversal of list and vector elements with offsets. | ||
| 966 | ;;;==================================================================== | ||
| 967 | 983 | ||
| 968 | (defvar edebug-dotted-spec nil) | 984 | (defvar edebug-dotted-spec nil) |
| 969 | 985 | ||
| @@ -1040,29 +1056,28 @@ point." | |||
| 1040 | (setq offset (cdr offset))) | 1056 | (setq offset (cdr offset))) |
| 1041 | offset)) | 1057 | offset)) |
| 1042 | 1058 | ||
| 1043 | ;;;; The Parser | 1059 | ;;; The Parser |
| 1044 | ;;; =============================== | ||
| 1045 | 1060 | ||
| 1046 | ;;; The top level function for parsing forms is | 1061 | ;; The top level function for parsing forms is |
| 1047 | ;;; edebug-read-and-maybe-wrap-form; it calls all the rest. It checks the | 1062 | ;; edebug-read-and-maybe-wrap-form; it calls all the rest. It checks the |
| 1048 | ;;; syntax a bit and leaves point at any error it finds, but otherwise | 1063 | ;; syntax a bit and leaves point at any error it finds, but otherwise |
| 1049 | ;;; should appear to work like eval-defun. | 1064 | ;; should appear to work like eval-defun. |
| 1050 | 1065 | ||
| 1051 | ;;; The basic plan is to surround each expression with a call to | 1066 | ;; The basic plan is to surround each expression with a call to |
| 1052 | ;;; the edebug debugger together with indexes into a table of positions of | 1067 | ;; the edebug debugger together with indexes into a table of positions of |
| 1053 | ;;; all expressions. Thus an expression "exp" becomes: | 1068 | ;; all expressions. Thus an expression "exp" becomes: |
| 1054 | 1069 | ||
| 1055 | ;;; (edebug-after (edebug-before 1) 2 exp) | 1070 | ;; (edebug-after (edebug-before 1) 2 exp) |
| 1056 | 1071 | ||
| 1057 | ;;; When this is evaluated, first point is moved to the beginning of | 1072 | ;; When this is evaluated, first point is moved to the beginning of |
| 1058 | ;;; exp at offset 1 of the current function. The expression is | 1073 | ;; exp at offset 1 of the current function. The expression is |
| 1059 | ;;; evaluated, which may cause more edebug calls, and then point is | 1074 | ;; evaluated, which may cause more edebug calls, and then point is |
| 1060 | ;;; moved to offset 2 after the end of exp. | 1075 | ;; moved to offset 2 after the end of exp. |
| 1061 | 1076 | ||
| 1062 | ;;; The highest level expressions of the function are wrapped in a call to | 1077 | ;; The highest level expressions of the function are wrapped in a call to |
| 1063 | ;;; edebug-enter, which supplies the function name and the actual | 1078 | ;; edebug-enter, which supplies the function name and the actual |
| 1064 | ;;; arguments to the function. See functions edebug-enter, edebug-before, | 1079 | ;; arguments to the function. See functions edebug-enter, edebug-before, |
| 1065 | ;;; and edebug-after for more details. | 1080 | ;; and edebug-after for more details. |
| 1066 | 1081 | ||
| 1067 | ;; Dynamically bound vars, left unbound, but globally declared. | 1082 | ;; Dynamically bound vars, left unbound, but globally declared. |
| 1068 | ;; This is to quiet the byte compiler. | 1083 | ;; This is to quiet the byte compiler. |
| @@ -1093,7 +1108,7 @@ point." | |||
| 1093 | (let (result | 1108 | (let (result |
| 1094 | edebug-top-window-data | 1109 | edebug-top-window-data |
| 1095 | edebug-def-name;; make sure it is locally nil | 1110 | edebug-def-name;; make sure it is locally nil |
| 1096 | ;; I dont like these here!! | 1111 | ;; I don't like these here!! |
| 1097 | edebug-&optional | 1112 | edebug-&optional |
| 1098 | edebug-&rest | 1113 | edebug-&rest |
| 1099 | edebug-gate | 1114 | edebug-gate |
| @@ -1102,7 +1117,7 @@ point." | |||
| 1102 | no-match | 1117 | no-match |
| 1103 | ;; Do this once here instead of several times. | 1118 | ;; Do this once here instead of several times. |
| 1104 | (max-lisp-eval-depth (+ 800 max-lisp-eval-depth)) | 1119 | (max-lisp-eval-depth (+ 800 max-lisp-eval-depth)) |
| 1105 | (max-specpdl-size (+ 1200 max-specpdl-size))) | 1120 | (max-specpdl-size (+ 2000 max-specpdl-size))) |
| 1106 | (setq no-match | 1121 | (setq no-match |
| 1107 | (catch 'no-match | 1122 | (catch 'no-match |
| 1108 | (setq result (edebug-read-and-maybe-wrap-form1)) | 1123 | (setq result (edebug-read-and-maybe-wrap-form1)) |
| @@ -1117,7 +1132,7 @@ point." | |||
| 1117 | def-kind | 1132 | def-kind |
| 1118 | defining-form-p | 1133 | defining-form-p |
| 1119 | def-name | 1134 | def-name |
| 1120 | ;; These offset things dont belong here, but to support recursive | 1135 | ;; These offset things don't belong here, but to support recursive |
| 1121 | ;; calls to edebug-read, they need to be here. | 1136 | ;; calls to edebug-read, they need to be here. |
| 1122 | edebug-offsets | 1137 | edebug-offsets |
| 1123 | edebug-offsets-stack | 1138 | edebug-offsets-stack |
| @@ -1206,12 +1221,12 @@ point." | |||
| 1206 | ;; Uses the dynamically bound vars edebug-def-name and edebug-def-args. | 1221 | ;; Uses the dynamically bound vars edebug-def-name and edebug-def-args. |
| 1207 | ;; Do this after parsing since that may find a name. | 1222 | ;; Do this after parsing since that may find a name. |
| 1208 | (setq edebug-def-name | 1223 | (setq edebug-def-name |
| 1209 | (or edebug-def-name edebug-old-def-name (gensym "edebug-anon"))) | 1224 | (or edebug-def-name edebug-old-def-name (edebug-gensym "edebug-anon"))) |
| 1210 | (` (edebug-enter | 1225 | (` (edebug-enter |
| 1211 | (quote (, edebug-def-name)) | 1226 | (quote (, edebug-def-name)) |
| 1212 | (, (if edebug-inside-func | 1227 | (, (if edebug-inside-func |
| 1213 | (` (list (,@ | 1228 | (` (list (,@ |
| 1214 | ;; Doesnt work with more than one def-body!! | 1229 | ;; Doesn't work with more than one def-body!! |
| 1215 | ;; But the list will just be reversed. | 1230 | ;; But the list will just be reversed. |
| 1216 | (nreverse edebug-def-args)))) | 1231 | (nreverse edebug-def-args)))) |
| 1217 | 'nil)) | 1232 | 'nil)) |
| @@ -1240,7 +1255,7 @@ point." | |||
| 1240 | ;; (edebug-after (edebug-before BEFORE-INDEX) AFTER-INDEX FORM) | 1255 | ;; (edebug-after (edebug-before BEFORE-INDEX) AFTER-INDEX FORM) |
| 1241 | ;; Also increment the offset index for subsequent use. | 1256 | ;; Also increment the offset index for subsequent use. |
| 1242 | ;; if (not edebug-stop-before-symbols) and form is a symbol, | 1257 | ;; if (not edebug-stop-before-symbols) and form is a symbol, |
| 1243 | ;; then dont call edebug-before. | 1258 | ;; then don't call edebug-before. |
| 1244 | (list 'edebug-after | 1259 | (list 'edebug-after |
| 1245 | (list 'edebug-before before-index) | 1260 | (list 'edebug-before before-index) |
| 1246 | after-index form)) | 1261 | after-index form)) |
| @@ -1326,7 +1341,7 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 1326 | 1341 | ||
| 1327 | ;; Set the name here if it was not set by edebug-make-enter-wrapper. | 1342 | ;; Set the name here if it was not set by edebug-make-enter-wrapper. |
| 1328 | (setq edebug-def-name | 1343 | (setq edebug-def-name |
| 1329 | (or edebug-def-name edebug-old-def-name (gensym "edebug-anon"))) | 1344 | (or edebug-def-name edebug-old-def-name (edebug-gensym "edebug-anon"))) |
| 1330 | 1345 | ||
| 1331 | ;; Add this def as a dependent of containing def. Buggy. | 1346 | ;; Add this def as a dependent of containing def. Buggy. |
| 1332 | '(if (and edebug-containing-def-name | 1347 | '(if (and edebug-containing-def-name |
| @@ -1429,9 +1444,9 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 1429 | 1444 | ||
| 1430 | ((symbolp form) | 1445 | ((symbolp form) |
| 1431 | (cond | 1446 | (cond |
| 1432 | ;; Check for constant symbols that dont get wrapped. | 1447 | ;; Check for constant symbols that don't get wrapped. |
| 1433 | ((or (memq form '(t nil)) | 1448 | ((or (memq form '(t nil)) |
| 1434 | (and (fboundp 'keywordp) (keywordp form))) | 1449 | (and (fboundp 'edebug-keywordp) (edebug-keywordp form))) |
| 1435 | form) | 1450 | form) |
| 1436 | 1451 | ||
| 1437 | ;; This option may go away. | 1452 | ;; This option may go away. |
| @@ -1518,9 +1533,7 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 1518 | "Head of list form must be a symbol or lambda expression."))) | 1533 | "Head of list form must be a symbol or lambda expression."))) |
| 1519 | )) | 1534 | )) |
| 1520 | 1535 | ||
| 1521 | 1536 | ;;; Matching of specs. | |
| 1522 | ;;;; Matching of specs. | ||
| 1523 | ;;; =================== | ||
| 1524 | 1537 | ||
| 1525 | (defvar edebug-after-dotted-spec nil) | 1538 | (defvar edebug-after-dotted-spec nil) |
| 1526 | 1539 | ||
| @@ -1528,8 +1541,8 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 1528 | (defconst edebug-max-depth 150) ;; maximum number of matching recursions. | 1541 | (defconst edebug-max-depth 150) ;; maximum number of matching recursions. |
| 1529 | 1542 | ||
| 1530 | 1543 | ||
| 1531 | ;;;; Failure to match | 1544 | ;;; Failure to match |
| 1532 | ;;; ================== | 1545 | |
| 1533 | ;; This throws to no-match, if there are higher alternatives. | 1546 | ;; This throws to no-match, if there are higher alternatives. |
| 1534 | ;; Otherwise it signals an error. The place of the error is found | 1547 | ;; Otherwise it signals an error. The place of the error is found |
| 1535 | ;; with the two before- and after-offset functions. | 1548 | ;; with the two before- and after-offset functions. |
| @@ -1617,7 +1630,7 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 1617 | 1630 | ||
| 1618 | 1631 | ||
| 1619 | ;; Define specs for all the symbol specs with functions used to process them. | 1632 | ;; Define specs for all the symbol specs with functions used to process them. |
| 1620 | ;; Perhaps we shouldnt be doing this with edebug-form-specs since the | 1633 | ;; Perhaps we shouldn't be doing this with edebug-form-specs since the |
| 1621 | ;; user may want to define macros or functions with the same names. | 1634 | ;; user may want to define macros or functions with the same names. |
| 1622 | ;; We could use an internal obarray for these primitive specs. | 1635 | ;; We could use an internal obarray for these primitive specs. |
| 1623 | 1636 | ||
| @@ -1639,7 +1652,6 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 1639 | ;; Less frequently used: | 1652 | ;; Less frequently used: |
| 1640 | ;; (function . edebug-match-function) | 1653 | ;; (function . edebug-match-function) |
| 1641 | (lambda-expr . edebug-match-lambda-expr) | 1654 | (lambda-expr . edebug-match-lambda-expr) |
| 1642 | ;; (keywordp . edebug-match-keywordp) | ||
| 1643 | (¬ . edebug-match-¬) | 1655 | (¬ . edebug-match-¬) |
| 1644 | (&key . edebug-match-&key) | 1656 | (&key . edebug-match-&key) |
| 1645 | (place . edebug-match-place) | 1657 | (place . edebug-match-place) |
| @@ -1736,7 +1748,7 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 1736 | (let (edebug-gate ;; only while matching each spec | 1748 | (let (edebug-gate ;; only while matching each spec |
| 1737 | edebug-best-error | 1749 | edebug-best-error |
| 1738 | edebug-error-point) | 1750 | edebug-error-point) |
| 1739 | ;; Doesnt support e.g. &or symbolp &rest form | 1751 | ;; Doesn't support e.g. &or symbolp &rest form |
| 1740 | (edebug-match-one-spec cursor (car specs))))) | 1752 | (edebug-match-one-spec cursor (car specs))))) |
| 1741 | ;; Match failed, so reset and try again. | 1753 | ;; Match failed, so reset and try again. |
| 1742 | (setq specs (cdr specs)) | 1754 | (setq specs (cdr specs)) |
| @@ -1765,7 +1777,7 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 1765 | (defun edebug-match-&key (cursor specs) | 1777 | (defun edebug-match-&key (cursor specs) |
| 1766 | ;; Following specs must look like (<name> <spec>) ... | 1778 | ;; Following specs must look like (<name> <spec>) ... |
| 1767 | ;; where <name> is the name of a keyword, and spec is its spec. | 1779 | ;; where <name> is the name of a keyword, and spec is its spec. |
| 1768 | ;; This really doesnt save much over the expanded form and takes time. | 1780 | ;; This really doesn't save much over the expanded form and takes time. |
| 1769 | (edebug-match-&rest | 1781 | (edebug-match-&rest |
| 1770 | cursor | 1782 | cursor |
| 1771 | (cons '&or | 1783 | (cons '&or |
| @@ -1869,7 +1881,7 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 1869 | 1881 | ||
| 1870 | (defun edebug-match-&define (cursor specs) | 1882 | (defun edebug-match-&define (cursor specs) |
| 1871 | ;; Match a defining form. | 1883 | ;; Match a defining form. |
| 1872 | ;; Normally, &define is interpretted specially other places. | 1884 | ;; Normally, &define is interpreted specially other places. |
| 1873 | ;; This should only be called inside of a spec list to match the remainder | 1885 | ;; This should only be called inside of a spec list to match the remainder |
| 1874 | ;; of the current list. e.g. ("lambda" &define args def-body) | 1886 | ;; of the current list. e.g. ("lambda" &define args def-body) |
| 1875 | (edebug-make-form-wrapper | 1887 | (edebug-make-form-wrapper |
| @@ -1907,17 +1919,6 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 1907 | ))) | 1919 | ))) |
| 1908 | 1920 | ||
| 1909 | 1921 | ||
| 1910 | ;; Not needed if the predicate exists. | ||
| 1911 | '(defun edebug-match-keywordp (cursor) | ||
| 1912 | ;; Match a common lisp style keyword symbol. | ||
| 1913 | (let ((sexp (edebug-top-element cursor))) | ||
| 1914 | (if (keywordp sexp) | ||
| 1915 | (prog1 | ||
| 1916 | (list sexp) | ||
| 1917 | (edebug-move-cursor cursor)) | ||
| 1918 | (edebug-no-match cursor "Keyword expected")))) | ||
| 1919 | |||
| 1920 | |||
| 1921 | (defun edebug-match-name (cursor) | 1922 | (defun edebug-match-name (cursor) |
| 1922 | ;; Set the edebug-def-name bound in edebug-defining-form. | 1923 | ;; Set the edebug-def-name bound in edebug-defining-form. |
| 1923 | (let ((name (edebug-top-element-required cursor "Expected name"))) | 1924 | (let ((name (edebug-top-element-required cursor "Expected name"))) |
| @@ -1945,7 +1946,7 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 1945 | ;; set the def-args bound in edebug-defining-form | 1946 | ;; set the def-args bound in edebug-defining-form |
| 1946 | (let ((edebug-arg (edebug-top-element-required cursor "Expected arg"))) | 1947 | (let ((edebug-arg (edebug-top-element-required cursor "Expected arg"))) |
| 1947 | (if (or (not (symbolp edebug-arg)) | 1948 | (if (or (not (symbolp edebug-arg)) |
| 1948 | (lambda-list-keywordp edebug-arg)) | 1949 | (edebug-lambda-list-keywordp edebug-arg)) |
| 1949 | (edebug-no-match cursor "Bad argument:" edebug-arg)) | 1950 | (edebug-no-match cursor "Bad argument:" edebug-arg)) |
| 1950 | (edebug-move-cursor cursor) | 1951 | (edebug-move-cursor cursor) |
| 1951 | (setq edebug-def-args (cons edebug-arg edebug-def-args)) | 1952 | (setq edebug-def-args (cons edebug-arg edebug-def-args)) |
| @@ -1995,14 +1996,14 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 1995 | ("quote" symbolp) | 1996 | ("quote" symbolp) |
| 1996 | edebug-spec-list | 1997 | edebug-spec-list |
| 1997 | stringp | 1998 | stringp |
| 1998 | [lambda-list-keywordp &rest edebug-spec] | 1999 | [edebug-lambda-list-keywordp &rest edebug-spec] |
| 1999 | ;; [keywordp gate edebug-spec] ;; need keywordp for this. | 2000 | ;; [edebug-keywordp gate edebug-spec] ;; need edebug-keywordp for this. |
| 2000 | edebug-spec-p ;; Including all the special ones e.g. form. | 2001 | edebug-spec-p ;; Including all the special ones e.g. form. |
| 2001 | symbolp;; a predicate | 2002 | symbolp;; a predicate |
| 2002 | )) | 2003 | )) |
| 2003 | 2004 | ||
| 2004 | 2005 | ||
| 2005 | ;;;;* Emacs special forms and some functions. | 2006 | ;;;* Emacs special forms and some functions. |
| 2006 | 2007 | ||
| 2007 | ;; quote expects only one argument, although it allows any number. | 2008 | ;; quote expects only one argument, although it allows any number. |
| 2008 | (def-edebug-spec quote sexp) | 2009 | (def-edebug-spec quote sexp) |
| @@ -2019,7 +2020,7 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 2019 | (def-edebug-spec defmacro | 2020 | (def-edebug-spec defmacro |
| 2020 | (&define name lambda-list def-body)) | 2021 | (&define name lambda-list def-body)) |
| 2021 | 2022 | ||
| 2022 | (def-edebug-spec arglist lambda-list) ;; denegrated - use lambda-list. | 2023 | (def-edebug-spec arglist lambda-list) ;; deprecated - use lambda-list. |
| 2023 | 2024 | ||
| 2024 | (def-edebug-spec lambda-list | 2025 | (def-edebug-spec lambda-list |
| 2025 | (([&rest arg] | 2026 | (([&rest arg] |
| @@ -2076,7 +2077,7 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 2076 | &rest (symbolp body))) | 2077 | &rest (symbolp body))) |
| 2077 | 2078 | ||
| 2078 | 2079 | ||
| 2079 | (def-edebug-spec ` (backquote-form)) | 2080 | (def-edebug-spec \` (backquote-form)) |
| 2080 | 2081 | ||
| 2081 | ;; Supports quotes inside backquotes, | 2082 | ;; Supports quotes inside backquotes, |
| 2082 | ;; but only at the top level inside unquotes. | 2083 | ;; but only at the top level inside unquotes. |
| @@ -2103,8 +2104,8 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 2103 | 2104 | ||
| 2104 | ;; ,@ might have some problems. | 2105 | ;; ,@ might have some problems. |
| 2105 | 2106 | ||
| 2106 | (defalias 'edebug-` '`) ;; same macro as regular backquote. | 2107 | (defalias 'edebug-\` '\`) ;; same macro as regular backquote. |
| 2107 | (def-edebug-spec edebug-` (def-form)) | 2108 | (def-edebug-spec edebug-\` (def-form)) |
| 2108 | 2109 | ||
| 2109 | ;; Assume immediate quote in unquotes mean backquote at next higher level. | 2110 | ;; Assume immediate quote in unquotes mean backquote at next higher level. |
| 2110 | (def-edebug-spec , (&or ("quote" edebug-`) def-form)) | 2111 | (def-edebug-spec , (&or ("quote" edebug-`) def-form)) |
| @@ -2120,7 +2121,6 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 2120 | ;; Anything else? | 2121 | ;; Anything else? |
| 2121 | 2122 | ||
| 2122 | 2123 | ||
| 2123 | ;;==================== | ||
| 2124 | ;; Some miscellaneous specs for macros in public packages. | 2124 | ;; Some miscellaneous specs for macros in public packages. |
| 2125 | ;; Send me yours. | 2125 | ;; Send me yours. |
| 2126 | 2126 | ||
| @@ -2138,9 +2138,7 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 2138 | [&optional ("interactive" interactive)] | 2138 | [&optional ("interactive" interactive)] |
| 2139 | def-body)) | 2139 | def-body)) |
| 2140 | 2140 | ||
| 2141 | 2141 | ;;; The debugger itself | |
| 2142 | ;;;; The debugger itself | ||
| 2143 | ;;; =============================== | ||
| 2144 | 2142 | ||
| 2145 | (defvar edebug-active nil) ;; Non-nil when edebug is active | 2143 | (defvar edebug-active nil) ;; Non-nil when edebug is active |
| 2146 | 2144 | ||
| @@ -2197,15 +2195,16 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 2197 | 2195 | ||
| 2198 | (defvar edebug-outside-pre-command-hook) | 2196 | (defvar edebug-outside-pre-command-hook) |
| 2199 | (defvar edebug-outside-post-command-hook) | 2197 | (defvar edebug-outside-post-command-hook) |
| 2198 | (defvar edebug-outside-post-command-idle-hook) | ||
| 2200 | 2199 | ||
| 2201 | ;; Emacs 19 | 2200 | ;; Emacs 19 |
| 2202 | (defvar pre-command-hook nil) | 2201 | (defvar pre-command-hook nil) |
| 2203 | (defvar post-command-hook nil) | 2202 | (defvar post-command-hook nil) |
| 2203 | (defvar post-command-idle-hook nil) | ||
| 2204 | 2204 | ||
| 2205 | (defvar cl-lexical-debug) ;; Defined in cl.el | 2205 | (defvar cl-lexical-debug) ;; Defined in cl.el |
| 2206 | 2206 | ||
| 2207 | ;;; Handling signals | 2207 | ;;; Handling signals |
| 2208 | ;;; ================= | ||
| 2209 | 2208 | ||
| 2210 | (if (not (fboundp 'edebug-original-signal)) | 2209 | (if (not (fboundp 'edebug-original-signal)) |
| 2211 | (defalias 'edebug-original-signal (symbol-function 'signal))) | 2210 | (defalias 'edebug-original-signal (symbol-function 'signal))) |
| @@ -2234,7 +2233,6 @@ error is signaled again." | |||
| 2234 | 2233 | ||
| 2235 | 2234 | ||
| 2236 | ;;; Entering Edebug | 2235 | ;;; Entering Edebug |
| 2237 | ;;; ================== | ||
| 2238 | 2236 | ||
| 2239 | (defun edebug-enter (edebug-function edebug-args edebug-body) | 2237 | (defun edebug-enter (edebug-function edebug-args edebug-body) |
| 2240 | ;; Entering FUNC. The arguments are ARGS, and the body is BODY. | 2238 | ;; Entering FUNC. The arguments are ARGS, and the body is BODY. |
| @@ -2267,7 +2265,8 @@ error is signaled again." | |||
| 2267 | ;; Save the outside value of executing macro. (here??) | 2265 | ;; Save the outside value of executing macro. (here??) |
| 2268 | (edebug-outside-executing-macro executing-macro) | 2266 | (edebug-outside-executing-macro executing-macro) |
| 2269 | (edebug-outside-pre-command-hook pre-command-hook) | 2267 | (edebug-outside-pre-command-hook pre-command-hook) |
| 2270 | (edebug-outside-post-command-hook post-command-hook)) | 2268 | (edebug-outside-post-command-hook post-command-hook) |
| 2269 | (edebug-outside-post-command-idle-hook post-command-idle-hook)) | ||
| 2271 | (unwind-protect | 2270 | (unwind-protect |
| 2272 | (let (;; Don't keep reading from an executing kbd macro | 2271 | (let (;; Don't keep reading from an executing kbd macro |
| 2273 | ;; within edebug unless edebug-continue-kbd-macro is | 2272 | ;; within edebug unless edebug-continue-kbd-macro is |
| @@ -2279,7 +2278,8 @@ error is signaled again." | |||
| 2279 | ;; a hook function is instrumented - to avoid infinite loop. | 2278 | ;; a hook function is instrumented - to avoid infinite loop. |
| 2280 | ;; This may be more than we need, however. | 2279 | ;; This may be more than we need, however. |
| 2281 | (pre-command-hook nil) | 2280 | (pre-command-hook nil) |
| 2282 | (post-command-hook nil)) | 2281 | (post-command-hook nil) |
| 2282 | (post-command-idle-hook nil)) | ||
| 2283 | (setq edebug-execution-mode (or edebug-next-execution-mode | 2283 | (setq edebug-execution-mode (or edebug-next-execution-mode |
| 2284 | edebug-initial-mode | 2284 | edebug-initial-mode |
| 2285 | edebug-execution-mode) | 2285 | edebug-execution-mode) |
| @@ -2291,8 +2291,9 @@ error is signaled again." | |||
| 2291 | (fset 'signal (symbol-function 'edebug-original-signal)))) | 2291 | (fset 'signal (symbol-function 'edebug-original-signal)))) |
| 2292 | ;; Reset global variables in case outside value was changed. | 2292 | ;; Reset global variables in case outside value was changed. |
| 2293 | (setq executing-macro edebug-outside-executing-macro | 2293 | (setq executing-macro edebug-outside-executing-macro |
| 2294 | edebug-outside-pre-command-hook pre-command-hook | 2294 | pre-command-hook edebug-outside-pre-command-hook |
| 2295 | edebug-outside-post-command-hook post-command-hook | 2295 | post-command-hook edebug-outside-post-command-hook |
| 2296 | post-command-idle-hook edebug-outside-post-command-idle-hook | ||
| 2296 | ))) | 2297 | ))) |
| 2297 | 2298 | ||
| 2298 | (let* ((edebug-data (get edebug-function 'edebug)) | 2299 | (let* ((edebug-data (get edebug-function 'edebug)) |
| @@ -2548,8 +2549,8 @@ MSG is printed after `::::} '." | |||
| 2548 | (setq edebug-buffer-points (edebug-get-displayed-buffer-points))) | 2549 | (setq edebug-buffer-points (edebug-get-displayed-buffer-points))) |
| 2549 | 2550 | ||
| 2550 | ;; First move the edebug buffer point to edebug-point | 2551 | ;; First move the edebug buffer point to edebug-point |
| 2551 | ;; so that window start doesnt get changed when we display it. | 2552 | ;; so that window start doesn't get changed when we display it. |
| 2552 | ;; I dont know if this is going to help. | 2553 | ;; I don't know if this is going to help. |
| 2553 | ;;(set-buffer edebug-buffer) | 2554 | ;;(set-buffer edebug-buffer) |
| 2554 | ;;(goto-char edebug-point) | 2555 | ;;(goto-char edebug-point) |
| 2555 | 2556 | ||
| @@ -2644,7 +2645,7 @@ MSG is printed after `::::} '." | |||
| 2644 | (eq edebug-arg-mode 'error)) | 2645 | (eq edebug-arg-mode 'error)) |
| 2645 | (progn | 2646 | (progn |
| 2646 | ;; (setq edebug-execution-mode 'step) | 2647 | ;; (setq edebug-execution-mode 'step) |
| 2647 | ;; (edebug-overlay-arrow) ; this doesnt always show up. | 2648 | ;; (edebug-overlay-arrow) ; This doesn't always show up. |
| 2648 | (edebug-recursive-edit))) ; <---------- Recursive edit | 2649 | (edebug-recursive-edit))) ; <---------- Recursive edit |
| 2649 | 2650 | ||
| 2650 | ;; Reset the edebug-window-data to whatever it is now. | 2651 | ;; Reset the edebug-window-data to whatever it is now. |
| @@ -2690,7 +2691,7 @@ MSG is printed after `::::} '." | |||
| 2690 | 'no-force) | 2691 | 'no-force) |
| 2691 | ;; Unrestore edebug-buffer's window-point. | 2692 | ;; Unrestore edebug-buffer's window-point. |
| 2692 | ;; Needed in addition to setting the buffer point | 2693 | ;; Needed in addition to setting the buffer point |
| 2693 | ;; - otherwise quitting doesnt leave point as is. | 2694 | ;; - otherwise quitting doesn't leave point as is. |
| 2694 | ;; But this causes point to not be restored at times. | 2695 | ;; But this causes point to not be restored at times. |
| 2695 | ;; Also, it may not be a visible window. | 2696 | ;; Also, it may not be a visible window. |
| 2696 | ;; (set-window-point window edebug-point) | 2697 | ;; (set-window-point window edebug-point) |
| @@ -2710,8 +2711,8 @@ MSG is printed after `::::} '." | |||
| 2710 | (set-buffer edebug-outside-buffer) | 2711 | (set-buffer edebug-outside-buffer) |
| 2711 | ;; Restore point, and mark. | 2712 | ;; Restore point, and mark. |
| 2712 | ;; Needed even if restoring windows because | 2713 | ;; Needed even if restoring windows because |
| 2713 | ;; that doesnt restore point and mark in the current buffer. | 2714 | ;; that doesn't restore point and mark in the current buffer. |
| 2714 | ;; But dont restore point if edebug-buffer is current buffer. | 2715 | ;; But don't restore point if edebug-buffer is current buffer. |
| 2715 | (if (not (eq edebug-buffer edebug-outside-buffer)) | 2716 | (if (not (eq edebug-buffer edebug-outside-buffer)) |
| 2716 | (goto-char edebug-outside-point)) | 2717 | (goto-char edebug-outside-point)) |
| 2717 | (if (marker-buffer (edebug-mark-marker)) | 2718 | (if (marker-buffer (edebug-mark-marker)) |
| @@ -2765,7 +2766,6 @@ MSG is printed after `::::} '." | |||
| 2765 | 2766 | ||
| 2766 | ;; Emacs 18 | 2767 | ;; Emacs 18 |
| 2767 | (defvar edebug-outside-unread-command-char) | 2768 | (defvar edebug-outside-unread-command-char) |
| 2768 | (defvar unread-command-char -1) | ||
| 2769 | 2769 | ||
| 2770 | ;; Lucid Emacs | 2770 | ;; Lucid Emacs |
| 2771 | (defvar edebug-outside-unread-command-event) ;; like unread-command-events | 2771 | (defvar edebug-outside-unread-command-event) ;; like unread-command-events |
| @@ -2779,14 +2779,6 @@ MSG is printed after `::::} '." | |||
| 2779 | (defvar edebug-outside-last-nonmenu-event) | 2779 | (defvar edebug-outside-last-nonmenu-event) |
| 2780 | (defvar edebug-outside-track-mouse) | 2780 | (defvar edebug-outside-track-mouse) |
| 2781 | 2781 | ||
| 2782 | ;; For Emacs 18, define vars defined by Emacs 19. | ||
| 2783 | (defvar last-input-event nil) | ||
| 2784 | (defvar last-command-event nil) | ||
| 2785 | (defvar unread-command-events nil) | ||
| 2786 | (defvar last-event-frame nil) | ||
| 2787 | (defvar last-nonmenu-event nil) | ||
| 2788 | (defvar track-mouse nil) | ||
| 2789 | |||
| 2790 | ;; Disable byte compiler warnings about unread-command-char and -event | 2782 | ;; Disable byte compiler warnings about unread-command-char and -event |
| 2791 | ;; (maybe works with byte-compile-version 2.22 at least) | 2783 | ;; (maybe works with byte-compile-version 2.22 at least) |
| 2792 | (defvar edebug-unread-command-char-warning) | 2784 | (defvar edebug-unread-command-char-warning) |
| @@ -2935,7 +2927,6 @@ MSG is printed after `::::} '." | |||
| 2935 | 2927 | ||
| 2936 | 2928 | ||
| 2937 | ;;; Display related functions | 2929 | ;;; Display related functions |
| 2938 | ;;; =============================== | ||
| 2939 | 2930 | ||
| 2940 | (defun edebug-adjust-window (old-start) | 2931 | (defun edebug-adjust-window (old-start) |
| 2941 | ;; If pos is not visible, adjust current window to fit following context. | 2932 | ;; If pos is not visible, adjust current window to fit following context. |
| @@ -3108,9 +3099,7 @@ The default is one second." | |||
| 3108 | (message "Displaying %s %s" buffer | 3099 | (message "Displaying %s %s" buffer |
| 3109 | (if already-displaying "off" "on")))) | 3100 | (if already-displaying "off" "on")))) |
| 3110 | 3101 | ||
| 3111 | |||
| 3112 | ;;; Breakpoint related functions | 3102 | ;;; Breakpoint related functions |
| 3113 | ;;; =============================== | ||
| 3114 | 3103 | ||
| 3115 | (defun edebug-find-stop-point () | 3104 | (defun edebug-find-stop-point () |
| 3116 | ;; Return (function . index) of the nearest edebug stop point. | 3105 | ;; Return (function . index) of the nearest edebug stop point. |
| @@ -3174,7 +3163,8 @@ The default is one second." | |||
| 3174 | (goto-char (+ edebug-def-mark | 3163 | (goto-char (+ edebug-def-mark |
| 3175 | (aref offset-vector (car breakpoint)))) | 3164 | (aref offset-vector (car breakpoint)))) |
| 3176 | 3165 | ||
| 3177 | (message (concat (if (nth 2 breakpoint) | 3166 | (message "%s" |
| 3167 | (concat (if (nth 2 breakpoint) | ||
| 3178 | "Temporary " "") | 3168 | "Temporary " "") |
| 3179 | (if (car (cdr breakpoint)) | 3169 | (if (car (cdr breakpoint)) |
| 3180 | (format "Condition: %s" | 3170 | (format "Condition: %s" |
| @@ -3269,7 +3259,6 @@ With prefix argument, make it a temporary breakpoint." | |||
| 3269 | 3259 | ||
| 3270 | 3260 | ||
| 3271 | ;;; Mode switching functions | 3261 | ;;; Mode switching functions |
| 3272 | ;;; =============================== | ||
| 3273 | 3262 | ||
| 3274 | (defun edebug-set-mode (mode shortmsg msg) | 3263 | (defun edebug-set-mode (mode shortmsg msg) |
| 3275 | ;; Set the edebug mode to MODE. | 3264 | ;; Set the edebug mode to MODE. |
| @@ -3494,7 +3483,6 @@ This is useful for exiting even if unwind-protect code may be executed." | |||
| 3494 | ;; (edebug-set-mode 'exiting "Exit...")) | 3483 | ;; (edebug-set-mode 'exiting "Exit...")) |
| 3495 | 3484 | ||
| 3496 | 3485 | ||
| 3497 | ;;; ----------------------------------------------------------------- | ||
| 3498 | ;;; The following initial mode setting definitions are not used yet. | 3486 | ;;; The following initial mode setting definitions are not used yet. |
| 3499 | 3487 | ||
| 3500 | '(defconst edebug-initial-mode-alist | 3488 | '(defconst edebug-initial-mode-alist |
| @@ -3540,9 +3528,7 @@ edebug-mode." | |||
| 3540 | (error "Key must map to one of the mode changing commands") | 3528 | (error "Key must map to one of the mode changing commands") |
| 3541 | ))) | 3529 | ))) |
| 3542 | 3530 | ||
| 3543 | |||
| 3544 | ;;; Evaluation of expressions | 3531 | ;;; Evaluation of expressions |
| 3545 | ;;; =============================== | ||
| 3546 | 3532 | ||
| 3547 | (def-edebug-spec edebug-outside-excursion t) | 3533 | (def-edebug-spec edebug-outside-excursion t) |
| 3548 | 3534 | ||
| @@ -3583,6 +3569,7 @@ Return the result of the last expression." | |||
| 3583 | (defining-kbd-macro edebug-outside-defining-kbd-macro) | 3569 | (defining-kbd-macro edebug-outside-defining-kbd-macro) |
| 3584 | (pre-command-hook edebug-outside-pre-command-hook) | 3570 | (pre-command-hook edebug-outside-pre-command-hook) |
| 3585 | (post-command-hook edebug-outside-post-command-hook) | 3571 | (post-command-hook edebug-outside-post-command-hook) |
| 3572 | (post-command-idle-hook edebug-outside-post-command-idle-hook) | ||
| 3586 | 3573 | ||
| 3587 | ;; See edebug-display | 3574 | ;; See edebug-display |
| 3588 | (overlay-arrow-position edebug-outside-o-a-p) | 3575 | (overlay-arrow-position edebug-outside-o-a-p) |
| @@ -3624,6 +3611,7 @@ Return the result of the last expression." | |||
| 3624 | edebug-outside-defining-kbd-macro defining-kbd-macro | 3611 | edebug-outside-defining-kbd-macro defining-kbd-macro |
| 3625 | edebug-outside-pre-command-hook pre-command-hook | 3612 | edebug-outside-pre-command-hook pre-command-hook |
| 3626 | edebug-outside-post-command-hook post-command-hook | 3613 | edebug-outside-post-command-hook post-command-hook |
| 3614 | edebug-outside-post-command-idle-hook post-command-idle-hook | ||
| 3627 | 3615 | ||
| 3628 | edebug-outside-o-a-p overlay-arrow-position | 3616 | edebug-outside-o-a-p overlay-arrow-position |
| 3629 | edebug-outside-o-a-s overlay-arrow-string | 3617 | edebug-outside-o-a-s overlay-arrow-string |
| @@ -3648,8 +3636,8 @@ Return the result of the last expression." | |||
| 3648 | (get (car edebug-err) 'error-message) | 3636 | (get (car edebug-err) 'error-message) |
| 3649 | (car (cdr edebug-err)))))) | 3637 | (car (cdr edebug-err)))))) |
| 3650 | 3638 | ||
| 3651 | ;;;; Printing | 3639 | ;;; Printing |
| 3652 | ;;; ========= | 3640 | |
| 3653 | ;; Replace printing functions. | 3641 | ;; Replace printing functions. |
| 3654 | 3642 | ||
| 3655 | ;; obsolete names | 3643 | ;; obsolete names |
| @@ -3731,8 +3719,7 @@ Return the result of the last expression." | |||
| 3731 | (interactive) | 3719 | (interactive) |
| 3732 | (message "%s" edebug-previous-result)) | 3720 | (message "%s" edebug-previous-result)) |
| 3733 | 3721 | ||
| 3734 | ;;;; Read, Eval and Print | 3722 | ;;; Read, Eval and Print |
| 3735 | ;;; ===================== | ||
| 3736 | 3723 | ||
| 3737 | (defun edebug-eval-expression (edebug-expr) | 3724 | (defun edebug-eval-expression (edebug-expr) |
| 3738 | "Evaluate an expression in the outside environment. | 3725 | "Evaluate an expression in the outside environment. |
| @@ -3765,9 +3752,7 @@ print value into current buffer." | |||
| 3765 | (princ "\n") | 3752 | (princ "\n") |
| 3766 | )) | 3753 | )) |
| 3767 | 3754 | ||
| 3768 | 3755 | ;;; Edebug Minor Mode | |
| 3769 | ;;;; Edebug Minor Mode | ||
| 3770 | ;;; =============================== | ||
| 3771 | 3756 | ||
| 3772 | ;; Global GUD bindings for all emacs-lisp-mode buffers. | 3757 | ;; Global GUD bindings for all emacs-lisp-mode buffers. |
| 3773 | (define-key emacs-lisp-mode-map "\C-x\C-a\C-s" 'edebug-step-mode) | 3758 | (define-key emacs-lisp-mode-map "\C-x\C-a\C-s" 'edebug-step-mode) |
| @@ -3930,9 +3915,8 @@ edebug-global-break-condition | |||
| 3930 | " | 3915 | " |
| 3931 | (use-local-map edebug-mode-map)) | 3916 | (use-local-map edebug-mode-map)) |
| 3932 | 3917 | ||
| 3918 | ;;; edebug eval list mode | ||
| 3933 | 3919 | ||
| 3934 | ;;;; edebug eval list mode | ||
| 3935 | ;;; =============================================== | ||
| 3936 | ;; A list of expressions and their evaluations is displayed in *edebug*. | 3920 | ;; A list of expressions and their evaluations is displayed in *edebug*. |
| 3937 | 3921 | ||
| 3938 | (defun edebug-eval-result-list () | 3922 | (defun edebug-eval-result-list () |
| @@ -4067,9 +4051,7 @@ Global commands prefixed by global-edebug-prefix: | |||
| 4067 | (setq mode-name "Edebug-Eval") | 4051 | (setq mode-name "Edebug-Eval") |
| 4068 | (use-local-map edebug-eval-mode-map)) | 4052 | (use-local-map edebug-eval-mode-map)) |
| 4069 | 4053 | ||
| 4070 | 4054 | ;;; Interface with standard debugger. | |
| 4071 | ;;;; Interface with standard debugger. | ||
| 4072 | ;;; ======================================== | ||
| 4073 | 4055 | ||
| 4074 | ;; (setq debugger 'edebug) ; to use the edebug debugger | 4056 | ;; (setq debugger 'edebug) ; to use the edebug debugger |
| 4075 | ;; (setq debugger 'debug) ; use the standard debugger | 4057 | ;; (setq debugger 'debug) ; use the standard debugger |
| @@ -4148,8 +4130,7 @@ show where we last were. Otherwise call debug normally." | |||
| 4148 | ))))) | 4130 | ))))) |
| 4149 | 4131 | ||
| 4150 | 4132 | ||
| 4151 | ;;;; Trace display | 4133 | ;;; Trace display |
| 4152 | ;; =============================== | ||
| 4153 | 4134 | ||
| 4154 | (defun edebug-trace-display (buf-name fmt &rest args) | 4135 | (defun edebug-trace-display (buf-name fmt &rest args) |
| 4155 | "In buffer BUF-NAME, display FMT and ARGS at the end and make it visible. | 4136 | "In buffer BUF-NAME, display FMT and ARGS at the end and make it visible. |
| @@ -4184,8 +4165,7 @@ You must include newlines in FMT to break lines, but one newline is appended." | |||
| 4184 | (apply 'edebug-trace-display edebug-trace-buffer fmt args)) | 4165 | (apply 'edebug-trace-display edebug-trace-buffer fmt args)) |
| 4185 | 4166 | ||
| 4186 | 4167 | ||
| 4187 | ;;;; Frequency count and coverage | 4168 | ;;; Frequency count and coverage |
| 4188 | ;;; ============================== | ||
| 4189 | 4169 | ||
| 4190 | (defun edebug-display-freq-count () | 4170 | (defun edebug-display-freq-count () |
| 4191 | "Display the frequency count data for each line of the current | 4171 | "Display the frequency count data for each line of the current |
| @@ -4268,8 +4248,7 @@ It is removed when you hit any char." | |||
| 4268 | (undo))) | 4248 | (undo))) |
| 4269 | 4249 | ||
| 4270 | 4250 | ||
| 4271 | ;;;; Menus | 4251 | ;;; Menus |
| 4272 | ;;;========= | ||
| 4273 | 4252 | ||
| 4274 | (defun edebug-toggle (variable) | 4253 | (defun edebug-toggle (variable) |
| 4275 | (set variable (not (eval variable))) | 4254 | (set variable (not (eval variable))) |
| @@ -4336,8 +4315,8 @@ It is removed when you hit any char." | |||
| 4336 | "Lemacs style menus for Edebug.") | 4315 | "Lemacs style menus for Edebug.") |
| 4337 | 4316 | ||
| 4338 | 4317 | ||
| 4339 | ;;;; Emacs version specific code | 4318 | ;;; Emacs version specific code |
| 4340 | ;;;============================= | 4319 | |
| 4341 | ;;; The default for all above is Emacs 18, because it is easier to compile | 4320 | ;;; The default for all above is Emacs 18, because it is easier to compile |
| 4342 | ;;; Emacs 18 code in Emacs 19 than vice versa. This default will | 4321 | ;;; Emacs 18 code in Emacs 19 than vice versa. This default will |
| 4343 | ;;; change once most people are using Emacs 19 or derivatives. | 4322 | ;;; change once most people are using Emacs 19 or derivatives. |
| @@ -4402,7 +4381,9 @@ Print result in minibuffer." | |||
| 4402 | (setq values (cons (edebug-eval edebug-expr) values)) | 4381 | (setq values (cons (edebug-eval edebug-expr) values)) |
| 4403 | (edebug-safe-prin1-to-string (car values))))) | 4382 | (edebug-safe-prin1-to-string (car values))))) |
| 4404 | 4383 | ||
| 4405 | (easy-menu-define 'edebug edebug-mode-map "Edebug menus" edebug-mode-menus) | 4384 | (easy-menu-define edebug-menu edebug-mode-map "Edebug menus" edebug-mode-menus) |
| 4385 | (if window-system | ||
| 4386 | (x-popup-menu nil (lookup-key edebug-mode-map [menu-bar Edebug]))) | ||
| 4406 | ) | 4387 | ) |
| 4407 | 4388 | ||
| 4408 | 4389 | ||
| @@ -4445,8 +4426,8 @@ Print result in minibuffer." | |||
| 4445 | (edebug-emacs-version-specific) | 4426 | (edebug-emacs-version-specific) |
| 4446 | 4427 | ||
| 4447 | 4428 | ||
| 4448 | ;;;; Byte-compiler | 4429 | ;;; Byte-compiler |
| 4449 | ;;; ==================== | 4430 | |
| 4450 | ;; Extension for bytecomp to resolve undefined function references. | 4431 | ;; Extension for bytecomp to resolve undefined function references. |
| 4451 | ;; Requires new byte compiler. | 4432 | ;; Requires new byte compiler. |
| 4452 | 4433 | ||
| @@ -4499,7 +4480,7 @@ Print result in minibuffer." | |||
| 4499 | 4480 | ||
| 4500 | (byte-compile-resolve-functions | 4481 | (byte-compile-resolve-functions |
| 4501 | '(reporter-submit-bug-report | 4482 | '(reporter-submit-bug-report |
| 4502 | gensym ;; also in cl.el | 4483 | edebug-gensym ;; also in cl.el |
| 4503 | ;; Interfaces to standard functions. | 4484 | ;; Interfaces to standard functions. |
| 4504 | edebug-original-eval-defun | 4485 | edebug-original-eval-defun |
| 4505 | edebug-original-read | 4486 | edebug-original-read |
| @@ -4516,7 +4497,7 @@ Print result in minibuffer." | |||
| 4516 | popup-menu | 4497 | popup-menu |
| 4517 | ;; CL | 4498 | ;; CL |
| 4518 | cl-macroexpand-all | 4499 | cl-macroexpand-all |
| 4519 | ;; And believe it or not, the byte compiler doesnt know about: | 4500 | ;; And believe it or not, the byte compiler doesn't know about: |
| 4520 | byte-compile-resolve-functions | 4501 | byte-compile-resolve-functions |
| 4521 | )) | 4502 | )) |
| 4522 | 4503 | ||
| @@ -4530,8 +4511,7 @@ Print result in minibuffer." | |||
| 4530 | ))) | 4511 | ))) |
| 4531 | 4512 | ||
| 4532 | 4513 | ||
| 4533 | ;;;; Autoloading of Edebug accessories | 4514 | ;;; Autoloading of Edebug accessories |
| 4534 | ;;;=================================== | ||
| 4535 | 4515 | ||
| 4536 | (if (featurep 'cl) | 4516 | (if (featurep 'cl) |
| 4537 | (add-hook 'edebug-setup-hook | 4517 | (add-hook 'edebug-setup-hook |
| @@ -4540,6 +4520,7 @@ Print result in minibuffer." | |||
| 4540 | (add-hook 'cl-load-hook | 4520 | (add-hook 'cl-load-hook |
| 4541 | (function (lambda () (require 'cl-specs))))) | 4521 | (function (lambda () (require 'cl-specs))))) |
| 4542 | 4522 | ||
| 4523 | ;;; edebug-cl-read and cl-read are available from liberte@cs.uiuc.edu | ||
| 4543 | (if (featurep 'cl-read) | 4524 | (if (featurep 'cl-read) |
| 4544 | (add-hook 'edebug-setup-hook | 4525 | (add-hook 'edebug-setup-hook |
| 4545 | (function (lambda () (require 'edebug-cl-read)))) | 4526 | (function (lambda () (require 'edebug-cl-read)))) |
| @@ -4548,8 +4529,7 @@ Print result in minibuffer." | |||
| 4548 | (function (lambda () (require 'edebug-cl-read))))) | 4529 | (function (lambda () (require 'edebug-cl-read))))) |
| 4549 | 4530 | ||
| 4550 | 4531 | ||
| 4551 | ;;;; Finalize Loading | 4532 | ;;; Finalize Loading |
| 4552 | ;;;=================== | ||
| 4553 | 4533 | ||
| 4554 | ;;; Finally, hook edebug into the rest of Emacs. | 4534 | ;;; Finally, hook edebug into the rest of Emacs. |
| 4555 | ;;; There are probably some other things that could go here. | 4535 | ;;; There are probably some other things that could go here. |
| @@ -4560,5 +4540,3 @@ Print result in minibuffer." | |||
| 4560 | (provide 'edebug) | 4540 | (provide 'edebug) |
| 4561 | 4541 | ||
| 4562 | ;;; edebug.el ends here | 4542 | ;;; edebug.el ends here |
| 4563 | |||
| 4564 | |||