Merge from emacs-24; up to 2012-05-02T11:38:01Z!lekktu@gmail.com
[bpt/emacs.git] / lisp / emacs-lisp / edebug.el
index f47feeb..bbf0757 100644 (file)
@@ -51,6 +51,8 @@
 
 ;;; Code:
 
+(require 'macroexp)
+
 ;;; Bug reporting
 
 (defalias 'edebug-submit-bug-report 'report-emacs-bug)
@@ -240,10 +242,13 @@ If the result is non-nil, then break.  Errors are ignored."
 
 (defun get-edebug-spec (symbol)
   ;; Get the spec of symbol resolving all indirection.
-  (let ((edebug-form-spec (get symbol 'edebug-form-spec))
-       indirect)
-    (while (and (symbolp edebug-form-spec)
-               (setq indirect (get edebug-form-spec 'edebug-form-spec)))
+  (let ((edebug-form-spec nil)
+       (indirect symbol))
+    (while
+        (progn
+          (and (symbolp indirect)
+               (setq indirect
+                     (function-get indirect 'edebug-form-spec 'autoload))))
       ;; (edebug-trace "indirection: %s" edebug-form-spec)
       (setq edebug-form-spec indirect))
     edebug-form-spec
@@ -261,7 +266,7 @@ An extant spec symbol is a symbol that is not a function and has a
             (setq spec (cdr spec)))
           t))
        ((symbolp spec)
-        (unless (functionp spec) (get spec 'edebug-form-spec)))))
+        (unless (functionp spec) (function-get spec 'edebug-form-spec)))))
 
 ;;; Utilities
 
@@ -527,6 +532,7 @@ the minibuffer."
            (setq face-new-frame-defaults
                  (assq-delete-all (nth 1 form) face-new-frame-defaults))
            (put (nth 1 form) 'face-defface-spec nil)
+           (put (nth 1 form) 'face-documentation (nth 3 form))
           ;; See comments in `eval-defun-1' for purpose of code below
           (setq form (prog1 `(prog1 ,form
                                (put ',(nth 1 form) 'saved-face
@@ -916,8 +922,7 @@ already is one.)"
   (cond ((eq ?\' (following-char))
         (forward-char 1)
         (list
-         (edebug-storing-offsets (- (point) 2)
-           (if (featurep 'cl) 'function* 'function))
+         (edebug-storing-offsets (- (point) 2) 'function)
          (edebug-read-storing-offsets stream)))
        ((memq (following-char) '(?: ?B ?O ?X ?b ?o ?x ?1 ?2 ?3 ?4 ?5 ?6
                                  ?7 ?8 ?9 ?0))
@@ -1250,10 +1255,7 @@ expressions; a `progn' form will be returned enclosing these forms."
        ((eq 'edebug-after (car sexp))
        (nth 3 sexp))
        ((eq 'edebug-enter (car sexp))
-       (let ((forms (nthcdr 2 (nth 1 (nth 3 sexp)))))
-         (if (> (length forms) 1)
-             (cons 'progn forms)  ;; could return (values forms) instead.
-           (car forms))))
+        (macroexp-progn (nthcdr 2 (nth 1 (nth 3 sexp)))))
        (t sexp);; otherwise it is not wrapped, so just return it.
        )
     sexp))
@@ -1938,7 +1940,6 @@ expressions; a `progn' form will be returned enclosing these forms."
 
 ;;;; Edebug Form Specs
 ;;; ==========================================================
-;;; See cl-specs.el for common lisp specs.
 
 ;;;;* Spec for def-edebug-spec
 ;;; Out of date.
@@ -2011,12 +2012,6 @@ expressions; a `progn' form will be returned enclosing these forms."
 ;; A macro is allowed by Emacs.
 (def-edebug-spec function (&or symbolp lambda-expr))
 
-;; lambda is a macro in emacs 19.
-(def-edebug-spec lambda (&define lambda-list
-                                [&optional stringp]
-                                [&optional ("interactive" interactive)]
-                                def-body))
-
 ;; A macro expression is a lambda expression with "macro" prepended.
 (def-edebug-spec macro (&define "lambda" lambda-list def-body))
 
@@ -3062,7 +3057,6 @@ Otherwise, toggle for all windows."
       (edebug-toggle-save-selected-window)
     (edebug-toggle-save-all-windows)))
 
-
 (defun edebug-where ()
   "Show the debug windows and where we stopped in the program."
   (interactive)
@@ -3742,12 +3736,16 @@ This prints the value into current buffer."
 
 ;;; Edebug Minor Mode
 
-;; FIXME eh?
-(defvar gud-inhibit-global-bindings
-  "Non-nil means don't do global rebindings of C-x C-a subcommands.")
+(defvar edebug-inhibit-emacs-lisp-mode-bindings nil
+  "If non-nil, inhibit Edebug bindings on the C-x C-a key.
+By default, loading the `edebug' library causes these bindings to
+be installed in `emacs-lisp-mode-map'.")
+
+(define-obsolete-variable-alias 'gud-inhibit-global-bindings
+  'edebug-inhibit-emacs-lisp-mode-bindings "24.2")
 
 ;; Global GUD bindings for all emacs-lisp-mode buffers.
-(unless gud-inhibit-global-bindings
+(unless edebug-inhibit-emacs-lisp-mode-bindings
   (define-key emacs-lisp-mode-map "\C-x\C-a\C-s" 'edebug-step-mode)
   (define-key emacs-lisp-mode-map "\C-x\C-a\C-n" 'edebug-next-mode)
   (define-key emacs-lisp-mode-map "\C-x\C-a\C-c" 'edebug-go-mode)
@@ -4437,13 +4435,6 @@ With prefix argument, make it a temporary breakpoint."
 \f
 ;;; Autoloading of Edebug accessories
 
-(if (featurep 'cl)
-    (add-hook 'edebug-setup-hook
-             (function (lambda () (require 'cl-specs))))
-  ;; The following causes cl-specs to be loaded if you load cl.el.
-  (add-hook 'cl-load-hook
-           (function (lambda () (require 'cl-specs)))))
-
 ;; edebug-cl-read and cl-read are available from liberte@cs.uiuc.edu
 (if (featurep 'cl-read)
     (add-hook 'edebug-setup-hook