[comp.emacs] edebug.el patch 1

liberte@M.CS.UIUC.EDU (Daniel LaLiberte) (11/29/88)

Here is patch number 1 for edebug.el.  It fixes the bug in
handling cond (so patch will fail on one chunk if you installed
that fix already) and a couple other bugs with the use of ().

Dan LaLiberte
uiucdcs!liberte
liberte@cs.uiuc.edu
liberte%a.cs.uiuc.edu@uiucvmd.bitnet

=======================================

*** /tmp/,RCSt1006143	Mon Nov 28 12:18:48 1988
--- edebug.el	Mon Nov 28 12:16:17 1988
***************
*** 35,40
  ;;; liberte@cs.uiuc.edu
  ;;; liberte%a.cs.uiuc.edu@uiucvmd.bitnet
  
  ;;;========================================================================
  
  ;;; To use edebug, simply evaluate a defun with edebug-defun.  Before

--- 35,51 -----
  ;;; liberte@cs.uiuc.edu
  ;;; liberte%a.cs.uiuc.edu@uiucvmd.bitnet
  
+ ;;; $Header: edebug.el,v 1.2 88/11/28 12:14:15 liberte Exp $
+ ;;; $Log:	edebug.el,v $
+ ;;; Revision 1.2  88/11/28  12:14:15  liberte
+ ;;; Bug fixes: cond construct didnt execute.
+ ;;;   () in sexp list didnt parse
+ ;;;   () as variable in condition-case didnt parse.
+ ;;; 
+ ;;; Revision 1.1  88/11/28  12:11:27  liberte
+ ;;; Initial revision
+ ;;; 
+ 
  ;;;========================================================================
  
  ;;; To use edebug, simply evaluate a defun with edebug-defun.  Before
***************
*** 63,69
  
  ;; Use setq to change the value of global-edebug-prefix before loading 
  ;; edebug.el.
! (defvar global-edebug-prefix "\^XX"
    "Prefix key for global edebug commands.")
  
  (defvar allow-recursive-debug t

--- 74,80 -----
  
  ;; Use setq to change the value of global-edebug-prefix before loading 
  ;; edebug.el.
! (defconst global-edebug-prefix "\^XX"
    "Prefix key for global edebug commands.")
  
  (defvar allow-recursive-debug t
***************
*** 159,164
        (if (not (listp defun-args))
  	  (error "Bad arg list."))
  
        (setq tmp-point (point))
        (if (eq 'atom (edebug-next-token-class))
  	  (setq token (edebug-read-one)))

--- 170,176 -----
        (if (not (listp defun-args))
  	  (error "Bad arg list."))
  
+       ;; look for doc string
        (setq tmp-point (point))
        (if (eq 'atom (edebug-next-token-class))
  	  (setq token (edebug-read-one)))
***************
*** 168,173
  	    (setq tmp-point (point))
  	    ))
  
        (if (eq 'lparen (edebug-next-token-class))
  	  (progn
  	    (forward-char 1)

--- 180,186 -----
  	    (setq tmp-point (point))
  	    ))
  
+       ;; look for interactive form
        (if (eq 'lparen (edebug-next-token-class))
  	  (progn
  	    (forward-char 1) ; skip \(
***************
*** 170,176
  
        (if (eq 'lparen (edebug-next-token-class))
  	  (progn
! 	    (forward-char 1)
  	    (if (eq 'atom (edebug-next-token-class))
  		(progn
  		  (setq token (edebug-read-one))

--- 183,189 -----
        ;; look for interactive form
        (if (eq 'lparen (edebug-next-token-class))
  	  (progn
! 	    (forward-char 1) ; skip \(
  	    (if (eq 'atom (edebug-next-token-class))
  		(progn
  		  (setq token (edebug-read-one))
***************
*** 255,261
      (forward-char 1)    ; skip \(
      (if (eq 'atom (edebug-next-token-class))
  	(setq token (edebug-read-one))
!       (error "Bad form."))
  ;;    (message "head token: %s" token) (sit-for 2)
  
      (prog1

--- 268,276 -----
      (forward-char 1)    ; skip \(
      (if (eq 'atom (edebug-next-token-class))
  	(setq token (edebug-read-one))
!       (if (eq 'rparen (edebug-next-token-class))
! 	  (setq token nil)
! 	(error "Bad form.")))
  ;;    (message "head token: %s" token) (sit-for 2)
  
      (prog1
***************
*** 259,271
  ;;    (message "head token: %s" token) (sit-for 2)
  
      (prog1
! 	(cons token
! 	  (cond
! 	   ;; handle all special cases with unevaluated arguments - any more??
! 	   ((memq token '(let let*)) (edebug-let))
! 	   ((memq token '(setq setq-default)) (edebug-setq))
! 	   ((eq token 'cond) (edebug-cond))
! 	   ((eq token 'condition-case) (edebug-condition-case))
  
  	   ((memq token '(quote function defun defvar defconst defmacro))
  	    (edebug-sexp-list nil))

--- 274,287 -----
  ;;    (message "head token: %s" token) (sit-for 2)
  
      (prog1
! 	(and token
! 	     (cons token
! 		   (cond
! 		    ;; handle all special cases with unevaluated arguments
! 		    ((memq token '(let let*)) (edebug-let))
! 		    ((memq token '(setq setq-default)) (edebug-setq))
! 		    ((eq token 'cond) (edebug-cond))
! 		    ((eq token 'condition-case) (edebug-condition-case))
  
  		    ((memq token '(quote function
  					 defun defvar defconst defmacro))
***************
*** 267,274
  	   ((eq token 'cond) (edebug-cond))
  	   ((eq token 'condition-case) (edebug-condition-case))
  
! 	   ((memq token '(quote function defun defvar defconst defmacro))
! 	    (edebug-sexp-list nil))
  
  	   ;; is it a lisp macro?
  	   ((macrop token) (edebug-sexp-list nil))

--- 283,291 -----
  		    ((eq token 'cond) (edebug-cond))
  		    ((eq token 'condition-case) (edebug-condition-case))
  
! 		    ((memq token '(quote function
! 					 defun defvar defconst defmacro))
! 		     (edebug-sexp-list nil))
  
  		    ;; is it a lisp macro?
  		    ((macrop token) (edebug-sexp-list nil))
***************
*** 270,277
  	   ((memq token '(quote function defun defvar defconst defmacro))
  	    (edebug-sexp-list nil))
  
! 	   ;; is it a lisp macro?
! 	   ((macrop token) (edebug-sexp-list nil))
  
  	   (t (edebug-sexp-list t))
  	   ))

--- 287,294 -----
  					 defun defvar defconst defmacro))
  		     (edebug-sexp-list nil))
  
! 		    ;; is it a lisp macro?
! 		    ((macrop token) (edebug-sexp-list nil))
  
  		    (t (edebug-sexp-list t))
  		    )))
***************
*** 273,280
  	   ;; is it a lisp macro?
  	   ((macrop token) (edebug-sexp-list nil))
  
! 	   (t (edebug-sexp-list t))
! 	   ))
        (forward-char 1) ; skip \)
        )
      ))

--- 290,297 -----
  		    ;; is it a lisp macro?
  		    ((macrop token) (edebug-sexp-list nil))
  
! 		    (t (edebug-sexp-list t))
! 		    )))
        (forward-char 1) ; skip \)
        )
      ))
***************
*** 341,347
  		 (error "Bad condition in cond")
  	       (forward-char 1) ; \(
  	       (prog1
! 		   (list
  		    (edebug-sexp)
  		    (if (eq 'rparen (edebug-next-token-class))
  			nil

--- 358,364 -----
  		 (error "Bad condition in cond")
  	       (forward-char 1) ; \(
  	       (prog1
! 		   (cons
  		    (edebug-sexp)
  		    (if (eq 'rparen (edebug-next-token-class))
  			nil
***************
*** 358,364
  (defun edebug-condition-case ()
    "Return the debug form of a condition-case."
    (let (symb-sexp-list
! 	class)
      (cons
       (if (not (eq 'atom (edebug-next-token-class)))
  	 (error "Bad variable in condition-case")

--- 375,383 -----
  (defun edebug-condition-case ()
    "Return the debug form of a condition-case."
    (let (symb-sexp-list
! 	class
! 	token)
! 
      (cons
       (prog1
  	 ;; read the variable or nil
***************
*** 360,370
    (let (symb-sexp-list
  	class)
      (cons
!      (if (not (eq 'atom (edebug-next-token-class)))
! 	 (error "Bad variable in condition-case")
!        (edebug-read-one)
!        (edebug-next-token)
!        )
  
       (cons
        (edebug-sexp)  ; the form

--- 379,390 -----
  	token)
  
      (cons
!      (prog1
! 	 ;; read the variable or nil
! 	 (setq token (edebug-read-one))
!        (if (not (symbolp token))
! 	   (error "Bad symbol in condition-case: %s" token))
!        (edebug-next-token))
  
       (cons
        (edebug-sexp)  ; the form