]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/debug.el
Added fast path to ERT explanation of `equal'.
[gnu-emacs] / lisp / emacs-lisp / debug.el
index 559aa0fda669d56a9e309e060bde2c34126f7cc7..88633eaaa4648eea379aa5615eeb77b45a7b2b97 100644 (file)
@@ -1,17 +1,16 @@
 ;;; debug.el --- debuggers and related commands for Emacs
 
-;; Copyright (C) 1985, 1986, 1994, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 1994, 2001-2011 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: lisp, tools, maint
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,9 +18,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
   :group 'debug)
 
 (defcustom debugger-mode-hook nil
-  "*Hooks run when `debugger-mode' is turned on."
+  "Hooks run when `debugger-mode' is turned on."
   :type 'hook
   :group 'debugger
   :version "20.3")
 
 (defcustom debugger-batch-max-lines 40
-  "*Maximum lines to show in debugger buffer in a noninteractive Emacs.
+  "Maximum lines to show in debugger buffer in a noninteractive Emacs.
 When the debugger is entered and Emacs is running in batch mode,
 if the backtrace text has more than this many lines,
 the middle is discarded, and just the beginning and end are displayed."
@@ -121,8 +118,7 @@ first will be printed into the backtrace buffer."
     (let (debugger-value
          (debug-on-error nil)
          (debug-on-quit nil)
-         (debugger-buffer (let ((default-major-mode 'fundamental-mode))
-                            (get-buffer-create "*Backtrace*")))
+         (debugger-buffer (get-buffer-create "*Backtrace*"))
          (debugger-old-buffer (current-buffer))
          (debugger-step-after-exit nil)
           (debugger-will-be-back nil)
@@ -202,7 +198,7 @@ first will be printed into the backtrace buffer."
                    (insert "...\n"))
                  (goto-char (point-min))
                  (message "%s" (buffer-string))
-                 (kill-emacs))
+                 (kill-emacs -1))
                (message "")
                (let ((standard-output nil)
                      (buffer-read-only t))
@@ -232,9 +228,10 @@ first will be printed into the backtrace buffer."
                     ;; would need to be de-iconified anyway immediately
                     ;; after when we re-enter the debugger, so iconifying it
                     ;; here would cause flashing.
-                    ;; Use quit-window rather than bury-buffer to quieten
-                    ;; Drew Adams.  --Stef
-                    (quit-window))))
+                    ;; Drew Adams is not happy with this: he wants to frame
+                    ;; to be left at the top-level, still working on how
+                    ;; best to do that.
+                    (bury-buffer))))
            (kill-buffer debugger-buffer))
          (with-timeout-unsuspend debugger-with-timeout-suspend)
          (set-match-data debugger-outer-match-data)))
@@ -268,7 +265,7 @@ first will be printed into the backtrace buffer."
 That buffer should be current already."
   (setq buffer-read-only nil)
   (erase-buffer)
-  (set-buffer-multibyte nil)
+  (set-buffer-multibyte t)             ;Why was it nil ?  -stef
   (setq buffer-undo-list t)
   (let ((standard-output (current-buffer))
        (print-escape-newlines t)
@@ -331,8 +328,7 @@ That buffer should be current already."
 (defun debugger-make-xrefs (&optional buffer)
   "Attach cross-references to function names in the `*Backtrace*' buffer."
   (interactive "b")
-  (save-excursion
-    (set-buffer (or buffer (current-buffer)))
+  (with-current-buffer (or buffer (current-buffer))
     (setq buffer (current-buffer))
     (let ((inhibit-read-only t)
          (old-end (point-min)) (new-end (point-min)))
@@ -517,9 +513,9 @@ Applies to the frame whose line point is on in the backtrace."
        (insert ? )))
   (beginning-of-line))
 
-(put 'debugger-env-macro 'lisp-indent-function 0)
 (defmacro debugger-env-macro (&rest body)
   "Run BODY in original environment."
+  (declare (indent 0))
   `(save-excursion
     (if (null (buffer-name debugger-old-buffer))
         ;; old buffer deleted
@@ -607,7 +603,7 @@ Applies to the frame whose line point is on in the backtrace."
     (define-key map [menu-bar debugger] (cons "Debugger" menu-map))
     (define-key menu-map [deb-top]
       '(menu-item "Quit" top-level
-                 :help "Quit debugging and return to top leve"))
+                 :help "Quit debugging and return to top level"))
     (define-key menu-map [deb-s0] '("--"))
     (define-key menu-map [deb-descr]
       '(menu-item "Describe Debugger Mode" describe-mode
@@ -675,7 +671,7 @@ Complete list of commands:
   (run-mode-hooks 'debugger-mode-hook))
 \f
 (defcustom debugger-record-buffer "*Debugger-record*"
-  "*Buffer name for expression values, for \\[debugger-record-expression]."
+  "Buffer name for expression values, for \\[debugger-record-expression]."
   :type 'string
   :group 'debugger
   :version "20.3")
@@ -699,6 +695,8 @@ Complete list of commands:
             (buffer-substring (line-beginning-position 0)
                               (line-end-position 0)))))
 
+(declare-function help-xref-interned "help-mode" (symbol))
+
 (defun debug-help-follow (&optional pos)
   "Follow cross-reference at POS, defaulting to point.
 
@@ -873,7 +871,8 @@ To specify a nil argument interactively, exit with an empty minibuffer."
   "Display a list of all the functions now set to debug on entry."
   (interactive)
   (require 'help-mode)
-  (help-setup-xref '(debugger-list-functions) (interactive-p))
+  (help-setup-xref '(debugger-list-functions)
+                  (called-interactively-p 'interactive))
   (with-output-to-temp-buffer (help-buffer)
     (with-current-buffer standard-output
       (if (null debug-function-list)
@@ -890,5 +889,4 @@ To specify a nil argument interactively, exit with an empty minibuffer."
 
 (provide 'debug)
 
-;; arch-tag: b6ec7047-f801-4103-9c63-d69322db9d3b
 ;;; debug.el ends here