Mercurial > emacs
comparison lisp/emacs-lisp/debug.el @ 63330:e51dacaad0d0
(debug-on-entry, cancel-debug-on-entry): Doc fixes.
author | Luc Teirlinck <teirllm@auburn.edu> |
---|---|
date | Sat, 11 Jun 2005 23:52:51 +0000 |
parents | 4a4691a3100d |
children | 8420228eae66 |
comparison
equal
deleted
inserted
replaced
63329:e039251ba8e4 | 63330:e51dacaad0d0 |
---|---|
612 (princ (format "Debugger Eval (%s): " exp)) | 612 (princ (format "Debugger Eval (%s): " exp)) |
613 (princ (debugger-eval-expression exp)) | 613 (princ (debugger-eval-expression exp)) |
614 (terpri)) | 614 (terpri)) |
615 | 615 |
616 (with-current-buffer (get-buffer debugger-record-buffer) | 616 (with-current-buffer (get-buffer debugger-record-buffer) |
617 (message "%s" | 617 (message "%s" |
618 (buffer-substring (line-beginning-position 0) | 618 (buffer-substring (line-beginning-position 0) |
619 (line-end-position 0))))) | 619 (line-end-position 0))))) |
620 | 620 |
621 (put 'debugger-mode 'mode-class 'special) | 621 (put 'debugger-mode 'mode-class 'special) |
622 | 622 |
654 (funcall debugger 'debug))) | 654 (funcall debugger 'debug))) |
655 | 655 |
656 ;;;###autoload | 656 ;;;###autoload |
657 (defun debug-on-entry (function) | 657 (defun debug-on-entry (function) |
658 "Request FUNCTION to invoke debugger each time it is called. | 658 "Request FUNCTION to invoke debugger each time it is called. |
659 When called interactively, prompt for FUNCTION in the minibuffer. | |
659 If you tell the debugger to continue, FUNCTION's execution proceeds. | 660 If you tell the debugger to continue, FUNCTION's execution proceeds. |
660 This works by modifying the definition of FUNCTION, | 661 This works by modifying the definition of FUNCTION, |
661 which must be written in Lisp, not predefined. | 662 which must be written in Lisp, not predefined. |
662 Use \\[cancel-debug-on-entry] to cancel the effect of this command. | 663 Use \\[cancel-debug-on-entry] to cancel the effect of this command. |
663 Redefining FUNCTION also cancels it." | 664 Redefining FUNCTION also cancels it." |
664 (interactive "aDebug on entry (to function): ") | 665 (interactive "aDebug on entry (to function): ") |
665 (when (and (subrp (symbol-function function)) | 666 (when (and (subrp (symbol-function function)) |
666 (eq (cdr (subr-arity (symbol-function function))) 'unevalled)) | 667 (eq (cdr (subr-arity (symbol-function function))) 'unevalled)) |
667 (error "Function %s is a special form" function)) | 668 (error "Function %s is a special form" function)) |
668 (if (or (symbolp (symbol-function function)) | 669 (if (or (symbolp (symbol-function function)) |
669 (subrp (symbol-function function))) | 670 (subrp (symbol-function function))) |
670 ;; The function is built-in or aliased to another function. | 671 ;; The function is built-in or aliased to another function. |
671 ;; Create a wrapper in which we can add the debug call. | 672 ;; Create a wrapper in which we can add the debug call. |
672 (fset function `(lambda (&rest debug-on-entry-args) | 673 (fset function `(lambda (&rest debug-on-entry-args) |
673 ,(interactive-form (symbol-function function)) | 674 ,(interactive-form (symbol-function function)) |
674 (apply ',(symbol-function function) | 675 (apply ',(symbol-function function) |
675 debug-on-entry-args))) | 676 debug-on-entry-args))) |
676 (when (eq (car-safe (symbol-function function)) 'autoload) | 677 (when (eq (car-safe (symbol-function function)) 'autoload) |
677 ;; The function is autoloaded. Load its real definition. | 678 ;; The function is autoloaded. Load its real definition. |
678 (load (cadr (symbol-function function)) nil noninteractive nil t)) | 679 (load (cadr (symbol-function function)) nil noninteractive nil t)) |
679 (when (or (not (consp (symbol-function function))) | 680 (when (or (not (consp (symbol-function function))) |
690 function) | 691 function) |
691 | 692 |
692 ;;;###autoload | 693 ;;;###autoload |
693 (defun cancel-debug-on-entry (&optional function) | 694 (defun cancel-debug-on-entry (&optional function) |
694 "Undo effect of \\[debug-on-entry] on FUNCTION. | 695 "Undo effect of \\[debug-on-entry] on FUNCTION. |
695 If argument is nil or an empty string, cancel for all functions." | 696 If argument is nil or an empty string, cancel for all functions. |
697 When called interactively, prompt for FUNCTION in the minibuffer. | |
698 To specify a nil argument interactively, exit with an empty minibuffer." | |
696 (interactive | 699 (interactive |
697 (list (let ((name | 700 (list (let ((name |
698 (completing-read "Cancel debug on entry (to function): " | 701 (completing-read "Cancel debug on entry (to function): " |
699 (mapcar 'symbol-name debug-function-list) | 702 (mapcar 'symbol-name debug-function-list) |
700 nil t nil))) | 703 nil t nil))) |
737 (fset function defn)))) | 740 (fset function defn)))) |
738 | 741 |
739 (defun debug-on-entry-1 (function flag) | 742 (defun debug-on-entry-1 (function flag) |
740 (let* ((defn (symbol-function function)) | 743 (let* ((defn (symbol-function function)) |
741 (tail defn)) | 744 (tail defn)) |
742 (when (eq (car-safe tail) 'macro) | 745 (when (eq (car-safe tail) 'macro) |
743 (setq tail (cdr tail))) | 746 (setq tail (cdr tail))) |
744 (if (not (eq (car-safe tail) 'lambda)) | 747 (if (not (eq (car-safe tail) 'lambda)) |
745 ;; Only signal an error when we try to set debug-on-entry. | 748 ;; Only signal an error when we try to set debug-on-entry. |
746 ;; When we try to clear debug-on-entry, we are now done. | 749 ;; When we try to clear debug-on-entry, we are now done. |
747 (when flag | 750 (when flag |