comparison lisp/emacs-lisp/debug.el @ 60490:2e5cfcc774b9

(debug-on-entry-1): Fix handling of macros.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 07 Mar 2005 14:12:27 +0000
parents e68c831d220c
children 2433720b755c
comparison
equal deleted inserted replaced
60489:7d03f539a034 60490:2e5cfcc774b9
691 ;; to the .elc file. 691 ;; to the .elc file.
692 (setq body (cons (documentation function) body))) 692 (setq body (cons (documentation function) body)))
693 (fset function (cons 'lambda (cons (car contents) body))))))) 693 (fset function (cons 'lambda (cons (car contents) body)))))))
694 694
695 (defun debug-on-entry-1 (function defn flag) 695 (defun debug-on-entry-1 (function defn flag)
696 (if (subrp defn) 696 (let ((tail defn))
697 (error "%s is a built-in function" function) 697 (if (subrp tail)
698 (if (eq (car defn) 'macro) 698 (error "%s is a built-in function" function)
699 (debug-on-entry-1 function (cdr defn) flag) 699 (if (eq (car tail) 'macro) (setq tail (cdr tail)))
700 (or (eq (car defn) 'lambda) 700 (if (eq (car tail) 'lambda) (setq tail (cdr tail))
701 (error "%s not user-defined Lisp function" function)) 701 (error "%s not user-defined Lisp function" function))
702 (let ((tail (cdr defn))) 702 ;; Skip the docstring.
703 ;; Skip the docstring. 703 (when (and (stringp (cadr tail)) (cddr tail))
704 (when (and (stringp (cadr tail)) (cddr tail)) 704 (setq tail (cdr tail)))
705 (setq tail (cdr tail))) 705 ;; Skip the interactive form.
706 ;; Skip the interactive form. 706 (when (eq 'interactive (car-safe (cadr tail)))
707 (when (eq 'interactive (car-safe (cadr tail))) 707 (setq tail (cdr tail)))
708 (setq tail (cdr tail))) 708 (unless (eq flag (equal (cadr tail) debug-entry-code))
709 (unless (eq flag (equal (cadr tail) debug-entry-code)) 709 ;; Add/remove debug statement as needed.
710 ;; Add/remove debug statement as needed. 710 (if flag
711 (if flag 711 (setcdr tail (cons debug-entry-code (cdr tail)))
712 (setcdr tail (cons debug-entry-code (cdr tail))) 712 (setcdr tail (cddr tail))))
713 (setcdr tail (cddr tail)))) 713 defn)))
714 defn))))
715 714
716 (defun debugger-list-functions () 715 (defun debugger-list-functions ()
717 "Display a list of all the functions now set to debug on entry." 716 "Display a list of all the functions now set to debug on entry."
718 (interactive) 717 (interactive)
719 (require 'help-mode) 718 (require 'help-mode)