Commits

Anonymous committed 220a327

Fix loop macro problems, sync with GNU Emacs 21.1 <1039954706.24941.60.camel@bobcat.ods.org>.

Comments (0)

Files changed (3)

 	* .cvsignore: Remove files now handled automatically by CVS.
 	* Makefile: Use `compile' instead of hard-coded `all'.
 
+	* cl-specs.el:
+	* cl-specs.el (cl-macro-list):
+	* cl-specs.el (cl-macro-list1):
+	Fix some problems with `loop' macros.
+	
+	* edebug.el:
+	* edebug.el (edebug-version): Removed.
+	* edebug.el (edebug-maintainer-address): Removed.
+	* edebug.el (edebug-submit-bug-report): Removed.
+	* edebug.el ('edebug-submit-bug-report): New.
+	* edebug.el (def-edebug-spec):
+	* edebug.el (edebug-lambda-list-keywordp):
+	* edebug.el (edebug-keywordp): Removed.
+	* edebug.el (edebug-window-list):
+	* edebug.el (edebug-window-live-p):
+	* edebug.el (edebug-get-displayed-buffer-points):
+	* edebug.el (edebug-eval-defun):
+	* edebug.el (edebug-install-read-eval-functions):
+	* edebug.el (edebug-uninstall-read-eval-functions):
+	* edebug.el (edebug-storing-offsets):
+	* edebug.el (edebug-wrap-def-body):
+	* edebug.el (edebug-make-enter-wrapper):
+	* edebug.el (edebug-form):
+	* edebug.el (edebug-spec):
+	* edebug.el (define-derived-mode): New.
+	* edebug.el (define-minor-mode): New.
+	* edebug.el (with-syntax-table): New.
+	* edebug.el (dolist): New.
+	* edebug.el (dotimes): New.
+	* edebug.el (push): New.
+	* edebug.el (pop): New.
+	* edebug.el (unless): New.
+	* edebug.el (when): New.
+	* edebug.el (easy-menu-define): New.
+	* edebug.el (with-custom-print): New.
+	* edebug.el (sregexq): New.
+	* edebug.el (rx): New.
+	* edebug.el (edebug-tracing):
+	* edebug.el (edebug-outside-current-prefix-arg):
+	* edebug.el (edebug-outside-current-prefix-arg)): New.
+	* edebug.el (edebug-recursive-edit):
+	* edebug.el (edebug-changing-windows):
+	* edebug.el (edebug-outside-excursion):
+	* edebug.el (edebug-mode-menus):
+	* edebug.el (edebug-emacs-19-specific):
+	* edebug.el (edebug-emacs-version-specific):
+	Sync with FSF 21.1.
+
 2002-10-15  Ville Skytt�  <scop@xemacs.org>
 
 	* Makefile (srckit): Remove.
 ;;; cl-specs.el --- Edebug specs for cl.el
 
 ;; Copyright (C) 1993 Free Software Foundation, Inc.
+;; Copyright (C) 2002 Ben Wing.
 ;; Author: Daniel LaLiberte <liberte@holonexus.org>
 ;; Keywords: lisp, tools, maint
 
 (def-edebug-spec symbol-macrolet 
   ((&rest (symbol sexp)) cl-declarations body))
 
+;; XEmacs change: Should look like inner macro lists, not outer ones,
+;; because &environment is not allowed. --ben
 (def-edebug-spec destructuring-bind
-  (&define cl-macro-list form cl-declarations def-body))
+  (&define cl-macro-list1 form cl-declarations def-body))
 
 ;; Setf
 
 ;; Note that &environment is only allowed as first or last items in the 
 ;; top level list.
 
+;; XEmacs change.  #### In fact, CLTL2 says &environment can occur anywhere
+;; in the list.  The list can also be dotted.  Yuck, &environment can occur
+;; only once, even though anywhere in the list -- how do I encode that? 
+;; Also had to add the &or and separate; otherwise dotted specs were
+;; causing errors.  --ben
+
 (def-edebug-spec cl-macro-list
-  (([&optional "&environment" arg]
+  (&or
+   ([&optional "&environment" arg]
+    [&optional "&whole" arg]
+    [&optional "&environment" arg]
+    [&rest cl-macro-arg]
+    . [&or arg nil])
+
+   ([&optional "&environment" arg]
+    [&optional "&whole" arg]
+    [&optional "&environment" arg]
+    [&rest cl-macro-arg]
+    [&optional "&environment" arg]
+    [&optional ["&optional" &rest 
+		&or (cl-macro-arg &optional def-form cl-macro-arg) arg]]
+    [&optional "&environment" arg]
+    [&optional [[&or "&rest" "&body"] cl-macro-arg]]
+    [&optional "&environment" arg]
+    [&optional ["&key" [&rest 
+			[&or ([&or (symbolp cl-macro-arg) arg] 
+			      &optional def-form cl-macro-arg)
+			     arg]]
+		&optional "&allow-other-keywords"]]
+    [&optional "&environment" arg]
+    [&optional ["&aux" &rest
+		&or (symbolp &optional def-form) symbolp]]
+    [&optional "&environment" arg]
+    )))
+
+(def-edebug-spec cl-macro-arg
+  (&or arg cl-macro-list1))
+
+(def-edebug-spec cl-macro-list1
+  (&or
+   ([&optional "&whole" arg]
+    [&rest cl-macro-arg]
+    . [&or arg nil])
+
+   ([&optional "&whole" arg]
     [&rest cl-macro-arg]
     [&optional ["&optional" &rest 
 		&or (cl-macro-arg &optional def-form cl-macro-arg) arg]]
 		&optional "&allow-other-keywords"]]
     [&optional ["&aux" &rest
 		&or (symbolp &optional def-form) symbolp]]
-    [&optional "&environment" arg]
     )))
 
-(def-edebug-spec cl-macro-arg
-  (&or arg cl-macro-list1))
-
-(def-edebug-spec cl-macro-list1
-  (([&optional "&whole" arg]  ;; only allowed at lower levels
-    [&rest cl-macro-arg]
-    [&optional ["&optional" &rest 
-		&or (cl-macro-arg &optional def-form cl-macro-arg) arg]]
-    [&optional [[&or "&rest" "&body"] cl-macro-arg]]
-    [&optional ["&key" [&rest 
-			[&or ([&or (symbolp cl-macro-arg) arg] 
-			      &optional def-form cl-macro-arg)
-			     arg]]
-		&optional "&allow-other-keywords"]]
-    [&optional ["&aux" &rest
-		&or (symbolp &optional def-form) symbolp]]
-    . [&or arg nil])))
-
 
 (def-edebug-spec defun*
   ;; Same as defun but use cl-lambda-list.
 ;;; edebug.el --- a source-level debugger for Emacs Lisp
 
-;; Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 97, 1999
+;; Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 97, 1999, 2000, 2001
 ;;       Free Software Foundation, Inc.
 
-;; Author: Daniel LaLiberte <liberte@hypernews.org>
+;; Author: Daniel LaLiberte <liberte@holonexus.org>
 ;; Maintainer: FSF
 ;; Keywords: lisp, tools, maint
 
 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ;; 02111-1307, USA.
 
-;;; Synched up with: FSF 20.7.
+;;; Synched up with: FSF 21.1.
 
 ;;; Commentary:
 
 ;; GTE Labs
 ;; 40 Sylvan Rd
 ;; Waltham, MA  02254
-;; dlaliberte@gte.com
+;; liberte@holonexus.org
 
 ;;; Code:
 
-(defconst edebug-version
-  (concat "In Emacs version " emacs-version))
-
 ;;; Bug reporting
 
-(defconst edebug-maintainer-address "bug-gnu-emacs@gnu.org")
-
-(defun edebug-submit-bug-report ()
-  "Submit, via mail, a bug report on edebug."
-  (interactive)
-  (require 'reporter)
-  (and (y-or-n-p "Do you really want to submit a report on edebug? ")
-       (reporter-submit-bug-report
-         edebug-maintainer-address
-         (concat "edebug.el " edebug-version)
-         (list '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
-	       ))))
+(defalias 'edebug-submit-bug-report 'report-emacs-bug)
 
 ;;; Options
 
 
 ;;;###autoload
 (defmacro def-edebug-spec (symbol spec)
-  "Set the edebug-form-spec property of SYMBOL according to SPEC.
+  "Set the `edebug-form-spec' property of SYMBOL according to SPEC.
 Both SYMBOL and SPEC are unevaluated. The SPEC can be 0, t, a symbol
 \(naming a function), or a list."
-  (` (put (quote (, symbol)) 'edebug-form-spec (quote (, spec)))))
+  `(put (quote ,symbol) 'edebug-form-spec (quote ,spec)))
 
 (defmacro def-edebug-form-spec (symbol spec-form)
   "For compatibility with old version.  Use `def-edebug-spec' instead."
           (setq newsymbol (make-symbol newname))))
     newsymbol))
 
-;; Only used by CL-like code.
-(defun edebug-keywordp (object)
-  "Return t if OBJECT is a keyword.
-A keyword is a symbol that starts with `:'."
-  (and (symbolp object)
-       (= ?: (aref (symbol-name object) 0))))
-
 (defun edebug-lambda-list-keywordp (object)
   "Return t if OBJECT is a lambda list keyword.
 A lambda list keyword is a symbol that starts with `&'."
 (defun edebug-window-list ()
   "Return a list of windows, in order of `next-window'."
   ;; This doesn't work for epoch.
-  (let* ((first-window (selected-window))
-	 (window-list (list first-window))
-	 (next (next-window first-window)))
-    (while (not (eq next first-window))
-      (setq window-list (cons next window-list))
-      (setq next (next-window next)))
+  (let (window-list)
+    (walk-windows (lambda (w) (setq window-list (cons w window-list))))
     (nreverse window-list)))
 
 (defun edebug-window-live-p (window)
   "Return non-nil if WINDOW is visible."
-  (let* ((first-window (selected-window))
-	 (next (next-window first-window t)))
-    (while (not (or (eq next window) 
-		    (eq next first-window)))
-      (setq next (next-window next t)))
-    (eq next window)))
+  (get-window-with-predicate (lambda (w) (eq w window))))
 
 ;; Not used.
 '(defun edebug-two-window-p ()
 and the restriction will be restored to the original buffer,
 and the current buffer remains current.
 Return the result of the last expression in BODY."
-  (` (let ((edebug:s-r-beg (point-min-marker))
-	   (edebug:s-r-end (point-max-marker)))
-       (unwind-protect
-	   (progn (,@ body))
-	 (save-excursion
-	   (set-buffer (marker-buffer edebug:s-r-beg))
-	   (narrow-to-region edebug:s-r-beg edebug:s-r-end))))))
+  `(let ((edebug:s-r-beg (point-min-marker))
+	 (edebug:s-r-end (point-max-marker)))
+     (unwind-protect
+	 (progn ,@body)
+       (save-excursion
+	 (set-buffer (marker-buffer edebug:s-r-beg))
+	 (narrow-to-region edebug:s-r-beg edebug:s-r-end)))))
 
 ;;; Display
 
 
 (defun edebug-get-displayed-buffer-points ()
   ;; Return a list of buffer point pairs, for all displayed buffers.
-  (save-excursion
-    (let* ((first-window (selected-window))
-	   (next (next-window first-window))
-	   (buffer-point-list nil)
-	   buffer)
-      (while (not (eq next first-window))
-	(set-buffer (setq buffer (window-buffer next)))
-	(setq buffer-point-list
-	      (cons (cons buffer (point)) buffer-point-list))
-	(setq next (next-window next)))
-      buffer-point-list)))
+  (let (list)
+    (walk-windows (lambda (w)
+		    (unless (eq w (selected-window))
+		      (setq list (cons (cons (window-buffer w)
+					     (window-point w))
+				       list)))))
+    list))
 
 
 (defun edebug-set-buffer-points (buffer-points)
 ;; read is redefined to maybe instrument forms.
 ;; eval-defun is redefined to check edebug-all-forms and edebug-all-defs.
 
-;; Use the Lisp version of eval-region.
-(require 'eval-reg "eval-reg")
-
 ;; Save the original read function
 (or (fboundp 'edebug-original-read)
     (defalias 'edebug-original-read  (symbol-function 'read)))
 (defun edebug-eval-defun (edebug-it)
   "Evaluate the top-level form containing point, or after point.
 
-This version, from Edebug, has the following differences: With a
-prefix argument instrument the code for Edebug.  If `edebug-all-defs' is
-non-nil, then the code is instrumented *unless* there is a prefix
-argument.  If instrumenting, it prints: `Edebug: FUNCTIONNAME'.
-Otherwise, it prints in the minibuffer."
+If the current defun is actually a call to `defvar', then reset the
+variable using its initial value expression even if the variable
+already has some other value.  (Normally `defvar' does not change the
+variable's value if it already has a value.)
+
+With a prefix argument, instrument the code for Edebug.
+
+Setting `edebug-all-defs' to a non-nil value reverses the meaning of
+the prefix argument.  Code is then instrumented when this function is
+invoked without a prefix argument
+
+If acting on a `defun' for FUNCTION, and the function was
+instrumented, `Edebug: FUNCTION' is printed in the minibuffer.  If not
+instrumented, just FUNCTION is printed.
+
+If not acting on a `defun', the result of evaluation is displayed in
+the minibuffer."
   (interactive "P")
   (let* ((edebugging (not (eq (not edebug-it) (not edebug-all-defs))))
 	 (edebug-result)
 	  (let ((edebug-all-forms edebugging)
 		(edebug-all-defs (eq edebug-all-defs (not edebug-it))))
 	    (edebug-read-top-level-form))))
+    ;; This should be consistent with `eval-defun-1', but not the
+    ;; same, since that gets a macroexpended form.
     (cond ((and (eq (car form) 'defvar)
 		(cdr-safe (cdr-safe form)))
 	   ;; Force variable to be bound.
 (defun edebug-install-read-eval-functions ()
   (interactive)
   ;; Don't install if already installed.
-  (if (eq (symbol-function 'read) 'edebug-read) nil
-    (elisp-eval-region-install)
-    (defalias 'read 'edebug-read)
+  (unless load-read-function
+    (setq load-read-function 'edebug-read)
     (defalias 'eval-defun 'edebug-eval-defun)))
 
 (defun edebug-uninstall-read-eval-functions ()
   (interactive)
-  (elisp-eval-region-uninstall)
-  (defalias 'read (symbol-function 'edebug-original-read))
+  (setq load-read-function nil)
   (defalias 'eval-defun (symbol-function 'edebug-original-eval-defun)))
 
 ;;; Edebug internal data
 (put 'edebug-storing-offsets 'lisp-indent-hook 1)
 
 (defmacro edebug-storing-offsets (point &rest body)
-  (` (unwind-protect
-	 (progn 
-	   (edebug-store-before-offset (, point))
-	   (,@ body)) 
-       (edebug-store-after-offset (point)))))
+  `(unwind-protect
+       (progn 
+	 (edebug-store-before-offset ,point)
+	 ,@body) 
+     (edebug-store-after-offset (point))))
 
 
 ;;; Reader for Emacs Lisp.
 	   (edebug-read-storing-offsets stream))
 	(edebug-storing-offsets opoint symbol)))))
 
+;; from 21.1:
 (defun edebug-read-function (stream)
   ;; Turn #'thing into (function thing)
   (forward-char 1)
-  ;; XEmacs change.
-  ;; XEmacs allows #b0101, #o1 and #x1 as numbers.
-  (cond ((memq (char-after) '(?b ?o ?x))
-	 (forward-char -1)
-	 (edebug-original-read stream))
-	((/= ?\' (following-char))
-	 (edebug-syntax-error "Bad char"))
-	(t
+  (cond ((eq ?\' (following-char))
 	 (forward-char 1)
 	 (list 
 	  (edebug-storing-offsets (point)  
 	    (if (featurep 'cl) 'function* 'function))
-	  (edebug-read-storing-offsets stream)))))
+	  (edebug-read-storing-offsets stream)))
+	;; XEmacs: Add #* for bit vectors
+	((memq (following-char) '(?: ?B ?O ?X ?b ?o ?x ?1 ?2 ?3 ?4 ?5 ?6
+				     ?7 ?8 ?9 ?0 ?*))
+	 (backward-char 1)
+	 (edebug-original-read stream))
+	(t (edebug-syntax-error "Bad char after #"))))
 
 (defun edebug-read-list (stream)
   (forward-char 1)			; skip \(
 (defun edebug-wrap-def-body (forms)
   "Wrap the FORMS of a definition body."
   (if edebug-def-interactive
-      (` (let (((, (edebug-interactive-p-name))
-		(interactive-p)))
-	   (, (edebug-make-enter-wrapper forms))))
+      `(let ((,(edebug-interactive-p-name)
+	      (interactive-p)))
+	 ,(edebug-make-enter-wrapper forms))
     (edebug-make-enter-wrapper forms)))
 
 
   ;; Do this after parsing since that may find a name.
   (setq edebug-def-name 
 	(or edebug-def-name edebug-old-def-name (edebug-gensym "edebug-anon")))
-  (` (edebug-enter
-      (quote (, edebug-def-name))
-      (, (if edebug-inside-func  
-	     (` (list (,@ 
-		       ;; Doesn't work with more than one def-body!!
-		       ;; But the list will just be reversed.
-		       (nreverse edebug-def-args))))
-	   'nil))
-      (function (lambda () (,@ forms)))
-      )))
+  `(edebug-enter
+    (quote ,edebug-def-name)
+    ,(if edebug-inside-func  
+	 `(list
+	   ;; Doesn't work with more than one def-body!!
+	   ;; But the list will just be reversed.
+	   ,@(nreverse edebug-def-args))
+       'nil)
+    (function (lambda () ,@forms))
+    ))
 
 
 (defvar edebug-form-begin-marker) ; the mark for def being instrumented
 	  (cond
 	   ;; Check for constant symbols that don't get wrapped.
 	   ((or (memq form '(t nil))
-		(and (fboundp 'edebug-keywordp) (edebug-keywordp form)))
+		(keywordp form))
 	    form)
 
 	   (t ;; just a variable
 ;; user may want to define macros or functions with the same names.
 ;; We could use an internal obarray for these primitive specs.
 
-(mapcar 
- (function (lambda (pair)
-	     (put (car pair) 'edebug-form-spec (cdr pair))))
- '((&optional . edebug-match-&optional)
-   (&rest . edebug-match-&rest)
-   (&or . edebug-match-&or)
-   (form . edebug-match-form)
-   (sexp . edebug-match-sexp)
-   (body . edebug-match-body)
-   (&define . edebug-match-&define)
-   (name . edebug-match-name)
-   (:name . edebug-match-colon-name)
-   (arg . edebug-match-arg)
-   (def-body . edebug-match-def-body)
-   (def-form . edebug-match-def-form)
-   ;; Less frequently used:
-   ;; (function . edebug-match-function)
-   (lambda-expr . edebug-match-lambda-expr)
-   (&not . edebug-match-&not)
-   (&key . edebug-match-&key)
-   (place . edebug-match-place)
-   (gate . edebug-match-gate)
-   ;;   (nil . edebug-match-nil)  not this one - special case it.
-   ))
+(dolist (pair '((&optional . edebug-match-&optional)
+		(&rest . edebug-match-&rest)
+		(&or . edebug-match-&or)
+		(form . edebug-match-form)
+		(sexp . edebug-match-sexp)
+		(body . edebug-match-body)
+		(&define . edebug-match-&define)
+		(name . edebug-match-name)
+		(:name . edebug-match-colon-name)
+		(arg . edebug-match-arg)
+		(def-body . edebug-match-def-body)
+		(def-form . edebug-match-def-form)
+		;; Less frequently used:
+		;; (function . edebug-match-function)
+		(lambda-expr . edebug-match-lambda-expr)
+		(&not . edebug-match-&not)
+		(&key . edebug-match-&key)
+		(place . edebug-match-place)
+		(gate . edebug-match-gate)
+		;;   (nil . edebug-match-nil)  not this one - special case it.
+		))
+  (put (car pair) 'edebug-form-spec (cdr pair)))
 
 (defun edebug-match-symbol (cursor symbol)
   ;; Match a symbol spec.
 
 (def-edebug-spec def-edebug-spec
   ;; Top level is different from lower levels.
-  (&define :name edebug-spec name 
+  (&define :name edebug-spec name
 	   &or "nil" edebug-spec-p "t" "0" (&rest edebug-spec)))
 
 (def-edebug-spec edebug-spec-list
    edebug-spec-list
    stringp
    [edebug-lambda-list-keywordp &rest edebug-spec]
-   ;; [edebug-keywordp gate edebug-spec] ;; need edebug-keywordp for this.
+   [keywordp gate edebug-spec]
    edebug-spec-p  ;; Including all the special ones e.g. form.
    symbolp;; a predicate
    ))
 	   def-body))
 (def-edebug-spec defmacro
   (&define name lambda-list def-body))
+(def-edebug-spec define-derived-mode
+  (&define name symbolp stringp [&optional stringp] def-body))
+(def-edebug-spec define-minor-mode
+  (&define name stringp
+	   [&optional sexp sexp &or consp symbolp]
+	   [&rest [keywordp sexp]]
+	   def-body))
+;; This plain doesn't work ;-(   -sm
+;; (def-edebug-spec define-skeleton
+;;   (&define name stringp def-body))
 
 (def-edebug-spec arglist lambda-list)  ;; deprecated - use lambda-list.
 
 (def-edebug-spec with-temp-file t)
 (def-edebug-spec with-temp-buffer t)
 (def-edebug-spec with-temp-message t)
+(def-edebug-spec with-syntax-table t)
+(def-edebug-spec dolist ((symbolp form &rest form) &rest form))
+(def-edebug-spec dotimes ((symbolp form &rest form) &rest form))
+(def-edebug-spec push (form sexp))
+(def-edebug-spec pop (sexp))
+(def-edebug-spec unless t)
+(def-edebug-spec when t)
 
 ;; Anything else?
 
 	   [&optional ("interactive" interactive)]
 	   def-body))
 
+(def-edebug-spec easy-menu-define (symbolp body))
+
+(def-edebug-spec with-custom-print body)
+
+(def-edebug-spec sregexq (&rest sexp))
+(def-edebug-spec rx (&rest sexp))
+
 ;;; The debugger itself
 
 (defvar edebug-active nil)  ;; Non-nil when edebug is active
 (defmacro edebug-tracing (msg &rest body)
   "Print MSG in *edebug-trace* before and after evaluating BODY.
 The result of BODY is also printed."
-  (` (let ((edebug-stack-depth (1+ edebug-stack-depth))
-	   edebug-result)
-       (edebug-print-trace-before (, msg))
-       (prog1 (setq edebug-result (progn (,@ body)))
-	 (edebug-print-trace-after 
-	  (format "%s result: %s" (, msg) edebug-result))))))
+  `(let ((edebug-stack-depth (1+ edebug-stack-depth))
+	 edebug-result)
+     (edebug-print-trace-before ,msg)
+     (prog1 (setq edebug-result (progn ,@body))
+       (edebug-print-trace-after 
+	(format "%s result: %s" ,msg edebug-result)))))
 
 (defun edebug-print-trace-before (msg)
   "Function called to print trace info before expression evaluation.
 (defvar edebug-outside-map)
 (defvar edebug-outside-standard-output)
 (defvar edebug-outside-standard-input)
+(defvar edebug-outside-current-prefix-arg)
 (defvar edebug-outside-last-command-char)
 (defvar edebug-outside-last-command)
 (defvar edebug-outside-this-command)
 	;; XEmacs:  added the boundp checks
 	(edebug-outside-unread-command-char
 	 (and (boundp 'unread-command-char) unread-command-char))
+	(edebug-outside-current-prefix-arg
+	 (and (boundp 'current-prefix-arg) current-prefix-arg))
 
 	(edebug-outside-last-input-event
 	 (and (boundp 'last-input-event) last-input-event))
 
 	      ;; Assume no edebug command sets unread-command-char.
 	      (unread-command-char -1)
+	      (current-prefix-arg nil)
 
 	      ;; More for Emacs 19
 	      (last-input-event nil)
        unread-command-char edebug-outside-unread-command-char
        unread-command-event edebug-outside-unread-command-event
        unread-command-events edebug-outside-unread-command-events
+       current-prefix-arg edebug-outside-current-prefix-arg
        last-input-char edebug-outside-last-input-char
        last-input-event edebug-outside-last-input-event
        last-event-frame edebug-outside-last-event-frame
 	   (if edebug-save-windows "on" "off")))
 
 (defmacro edebug-changing-windows (&rest body)
-  (` (let ((window (selected-window)))
-       (setq edebug-inside-windows (edebug-current-windows t))
-       (edebug-set-windows edebug-outside-windows)
-       (,@ body) ;; Code to change edebug-save-windows
-       (setq edebug-outside-windows (edebug-current-windows 
-				     edebug-save-windows))
-       ;; Problem: what about outside windows that are deleted inside?
-       (edebug-set-windows edebug-inside-windows))))
+  `(let ((window (selected-window)))
+     (setq edebug-inside-windows (edebug-current-windows t))
+     (edebug-set-windows edebug-outside-windows)
+     ,@body;; Code to change edebug-save-windows
+     (setq edebug-outside-windows (edebug-current-windows 
+				   edebug-save-windows))
+     ;; Problem: what about outside windows that are deleted inside?
+     (edebug-set-windows edebug-inside-windows)))
 
 (defun edebug-toggle-save-selected-window ()
   "Toggle the saving and restoring of the selected window. 
 (defmacro edebug-outside-excursion (&rest body)
   "Evaluate an expression list in the outside context.
 Return the result of the last expression."
-  (` (save-excursion			; of current-buffer
-       (if edebug-save-windows
-	   (progn
-	     ;; After excursion, we will 
-	     ;; restore to current window configuration.
-	     (setq edebug-inside-windows
-		   (edebug-current-windows edebug-save-windows))
-	     ;; Restore outside windows.
-	     (edebug-set-windows edebug-outside-windows)))
-
-       (set-buffer edebug-buffer)  ; why?
-       ;; (use-local-map edebug-outside-map)
-       (set-match-data edebug-outside-match-data)
-       ;; Restore outside context.
-       (let (;; (edebug-inside-map (current-local-map)) ;; restore map??
-	     (last-command-char edebug-outside-last-command-char)
-	     (last-command-event edebug-outside-last-command-event)
-	     (last-command edebug-outside-last-command)
-	     (this-command edebug-outside-this-command)
-	     (unread-command-char edebug-outside-unread-command-char)
-	     (unread-command-event edebug-outside-unread-command-event)
-	     (unread-command-events edebug-outside-unread-command-events)
-	     (last-input-char edebug-outside-last-input-char)
-	     (last-input-event edebug-outside-last-input-event)
-	     (last-event-frame edebug-outside-last-event-frame)
-	     (last-nonmenu-event edebug-outside-last-nonmenu-event)
-	     (track-mouse edebug-outside-track-mouse)
-	     (standard-output edebug-outside-standard-output)
-	     (standard-input edebug-outside-standard-input)
-
-	     (executing-kbd-macro edebug-outside-executing-macro)
-	     (defining-kbd-macro edebug-outside-defining-kbd-macro)
-	     (pre-command-hook edebug-outside-pre-command-hook)
-	     (post-command-hook edebug-outside-post-command-hook)
-
-	     ;; See edebug-display
-	     (overlay-arrow-position edebug-outside-o-a-p)
-	     (overlay-arrow-string edebug-outside-o-a-s)
-	     (cursor-in-echo-area edebug-outside-c-i-e-a)
-	     )
-	 (unwind-protect
-	     (save-excursion		; of edebug-buffer
-	       (set-buffer edebug-outside-buffer)
-	       (goto-char edebug-outside-point)
-	       (if (marker-buffer (edebug-mark-marker))
-		   (set-marker (edebug-mark-marker) edebug-outside-mark))
-	       (,@ body))
-
-	   ;; Back to edebug-buffer.  Restore rest of inside context.
-	   ;; (use-local-map edebug-inside-map)
-	   (if edebug-save-windows
-	       ;; Restore inside windows.
-	       (edebug-set-windows edebug-inside-windows))
-
-	   ;; Save values that may have been changed.
-	   (setq 
-	    edebug-outside-last-command-char last-command-char
-	    edebug-outside-last-command-event last-command-event
-	    edebug-outside-last-command last-command
-	    edebug-outside-this-command this-command
-	    edebug-outside-unread-command-char unread-command-char
-	    edebug-outside-unread-command-event unread-command-event
-	    edebug-outside-unread-command-events unread-command-events
-	    edebug-outside-last-input-char last-input-char
-	    edebug-outside-last-input-event last-input-event
-	    edebug-outside-last-event-frame last-event-frame
-	    edebug-outside-last-nonmenu-event last-nonmenu-event
-	    edebug-outside-track-mouse track-mouse
-	    edebug-outside-standard-output standard-output
-	    edebug-outside-standard-input standard-input
-
-	    edebug-outside-executing-macro executing-kbd-macro
-	    edebug-outside-defining-kbd-macro defining-kbd-macro
-	    edebug-outside-pre-command-hook pre-command-hook
-	    edebug-outside-post-command-hook post-command-hook
-
-	    edebug-outside-o-a-p overlay-arrow-position
-	    edebug-outside-o-a-s overlay-arrow-string
-	    edebug-outside-c-i-e-a cursor-in-echo-area
-	    )))				; let
-       )))
+  `(save-excursion			; of current-buffer
+     (if edebug-save-windows
+	 (progn
+	   ;; After excursion, we will 
+	   ;; restore to current window configuration.
+	   (setq edebug-inside-windows
+		 (edebug-current-windows edebug-save-windows))
+	   ;; Restore outside windows.
+	   (edebug-set-windows edebug-outside-windows)))
+
+     (set-buffer edebug-buffer)		; why?
+     ;; (use-local-map edebug-outside-map)
+     (set-match-data edebug-outside-match-data)
+     ;; Restore outside context.
+     (let (;; (edebug-inside-map (current-local-map)) ;; restore map??
+	   (last-command-char edebug-outside-last-command-char)
+	   (last-command-event edebug-outside-last-command-event)
+	   (last-command edebug-outside-last-command)
+	   (this-command edebug-outside-this-command)
+	   (unread-command-char edebug-outside-unread-command-char)
+	   (unread-command-event edebug-outside-unread-command-event)
+	   (unread-command-events edebug-outside-unread-command-events)
+	   (current-prefix-arg edebug-outside-current-prefix-arg)
+	   (last-input-char edebug-outside-last-input-char)
+	   (last-input-event edebug-outside-last-input-event)
+	   (last-event-frame edebug-outside-last-event-frame)
+	   (last-nonmenu-event edebug-outside-last-nonmenu-event)
+	   (track-mouse edebug-outside-track-mouse)
+	   (standard-output edebug-outside-standard-output)
+	   (standard-input edebug-outside-standard-input)
+
+	   (executing-kbd-macro edebug-outside-executing-macro)
+	   (defining-kbd-macro edebug-outside-defining-kbd-macro)
+	   (pre-command-hook edebug-outside-pre-command-hook)
+	   (post-command-hook edebug-outside-post-command-hook)
+
+	   ;; See edebug-display
+	   (overlay-arrow-position edebug-outside-o-a-p)
+	   (overlay-arrow-string edebug-outside-o-a-s)
+	   (cursor-in-echo-area edebug-outside-c-i-e-a)
+	   )
+       (unwind-protect
+	   (save-excursion		; of edebug-buffer
+	     (set-buffer edebug-outside-buffer)
+	     (goto-char edebug-outside-point)
+	     (if (marker-buffer (edebug-mark-marker))
+		 (set-marker (edebug-mark-marker) edebug-outside-mark))
+	     ,@body)
+
+	 ;; Back to edebug-buffer.  Restore rest of inside context.
+	 ;; (use-local-map edebug-inside-map)
+	 (if edebug-save-windows
+	     ;; Restore inside windows.
+	     (edebug-set-windows edebug-inside-windows))
+
+	 ;; Save values that may have been changed.
+	 (setq 
+	  edebug-outside-last-command-char last-command-char
+	  edebug-outside-last-command-event last-command-event
+	  edebug-outside-last-command last-command
+	  edebug-outside-this-command this-command
+	  edebug-outside-unread-command-char unread-command-char
+	  edebug-outside-unread-command-event unread-command-event
+	  edebug-outside-unread-command-events unread-command-events
+	  edebug-outside-current-prefix-arg current-prefix-arg
+	  edebug-outside-last-input-char last-input-char
+	  edebug-outside-last-input-event last-input-event
+	  edebug-outside-last-event-frame last-event-frame
+	  edebug-outside-last-nonmenu-event last-nonmenu-event
+	  edebug-outside-track-mouse track-mouse
+	  edebug-outside-standard-output standard-output
+	  edebug-outside-standard-input standard-input
+
+	  edebug-outside-executing-macro executing-kbd-macro
+	  edebug-outside-defining-kbd-macro defining-kbd-macro
+	  edebug-outside-pre-command-hook pre-command-hook
+	  edebug-outside-post-command-hook post-command-hook
+
+	  edebug-outside-o-a-p overlay-arrow-position
+	  edebug-outside-o-a-s overlay-arrow-string
+	  edebug-outside-c-i-e-a cursor-in-echo-area
+	  )))				; let
+     ))
 
 (defvar cl-debug-env nil) ;; defined in cl; non-nil when lexical env used.
 
      ["Last Sexp" edebug-eval-last-sexp t]
      ["Visit Eval List" edebug-visit-eval-list t])
 
-    ("Options"
-     ["Edebug All Defs" edebug-all-defs t]
-     ["Edebug All Forms" edebug-all-forms t]
+      ("Options"
+     ["Edebug All Defs" edebug-all-defs
+:style toggle :selected edebug-all-defs]
+     ["Edebug All Forms" edebug-all-forms
+:style toggle :selected edebug-all-forms]
      "----"
-     ["Toggle Tracing" (edebug-toggle 'edebug-trace) t]
-     ["Toggle Coverage Testing" (edebug-toggle 'edebug-test-coverage) t]
-     ["Toggle Window Saving" edebug-toggle-save-windows t]
-     ["Toggle Point Saving" 
-      (edebug-toggle 'edebug-save-displayed-buffer-points) t]
+     ["Tracing" (edebug-toggle 'edebug-trace)
+:style toggle :selected edebug-trace]
+     ["Test Coverage" (edebug-toggle 'edebug-test-coverage)
+:style toggle :selected edebug-test-coverage]
+     ["Save Windows" edebug-toggle-save-windows
+:style toggle :selected edebug-save-windows]
+     ["Save Point" 
+      (edebug-toggle 'edebug-save-displayed-buffer-points)
+:style toggle :selected edebug-save-displayed-buffer-points]
      ))
-  "XEmacs style menus for Edebug.")
+  "Menus for Edebug.")
 
 
 ;;; Emacs version specific code
       (edebug-safe-prin1-to-string (car values)))))
 
   (easy-menu-define edebug-menu edebug-mode-map "Edebug menus" edebug-mode-menus)
-  (if window-system
+  (if (display-popup-menus-p)
       (x-popup-menu nil (lookup-key edebug-mode-map [menu-bar Edebug])))
   )
 
    ((string-match "XEmacs" emacs-version);; XEmacs
     (edebug-xemacs-specific))
 
-   ((and (boundp 'epoch::version) epoch::version)
-    (require 'edebug-epoch))
-
    ((not (string-match "^18" emacs-version))
     (edebug-emacs-19-specific))))