changeset 85302:bc8b741390b0

(documentation): Advice deleted. Doc for advised functions is now handled at C level. (ad-stop-advice, ad-start-advice): Don't enable or disable advice for `documentation'. (ad-advised-definition-docstring-regexp): Var deleted. (ad-make-advised-definition-docstring): Store orig name as text property of string. (ad-advised-definition-p): Check for text property of docstring.
author Richard M. Stallman <rms@gnu.org>
date Sun, 14 Oct 2007 22:46:38 +0000
parents d68353926a20
children 6830ce7af289
files lisp/emacs-lisp/advice.el
diffstat 1 files changed, 4 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/advice.el	Sun Oct 14 20:42:05 2007 +0000
+++ b/lisp/emacs-lisp/advice.el	Sun Oct 14 22:46:38 2007 +0000
@@ -2603,17 +2603,13 @@
 		    (if (ad-interactive-form definition) 1 0))
 		 (cdr (cdr (ad-lambda-expression definition)))))))
 
-;; Matches the docstring of an advised definition.
-;; The first group of the regexp matches the function name:
-(defvar ad-advised-definition-docstring-regexp "^\\$ad-doc: \\(.+\\)\\$$")
-
 (defun ad-make-advised-definition-docstring (function)
   "Make an identifying docstring for the advised definition of FUNCTION.
 Put function name into the documentation string so we can infer
 the name of the advised function from the docstring.  This is needed
 to generate a proper advised docstring even if we are just given a
-definition (also see the defadvice for `documentation')."
-  (format "$ad-doc: %s$" (prin1-to-string function)))
+definition (see the code for `documentation')."
+  (propertize "Advice doc string" 'ad-advice-info function))
 
 (defun ad-advised-definition-p (definition)
   "Return non-nil if DEFINITION was generated from advice information."
@@ -2622,8 +2618,7 @@
 	  (ad-compiled-p definition))
       (let ((docstring (ad-docstring definition)))
 	(and (stringp docstring)
-	     (string-match
-	      ad-advised-definition-docstring-regexp docstring)))))
+	     (get-text-property 0 'ad-advice-info docstring)))))
 
 (defun ad-definition-type (definition)
   "Return symbol that describes the type of DEFINITION."
@@ -3917,24 +3912,6 @@
 ;; during bootstrapping.
 (ad-define-subr-args 'documentation '(function &optional raw))
 
-(defadvice documentation (after ad-advised-docstring first disable preact)
-  "Builds an advised docstring if FUNCTION is advised."
-  ;; Because we get the function name from the advised docstring
-  ;; this will work for function names as well as for definitions:
-  (if (and (stringp ad-return-value)
-	   (string-match
-	    ad-advised-definition-docstring-regexp ad-return-value))
-      (let ((function
-	     (car (read-from-string
-		   ad-return-value (match-beginning 1) (match-end 1)))))
-	(cond ((ad-is-advised function)
-	       (setq ad-return-value (ad-make-advised-docstring function))
-	       ;; Handle optional `raw' argument:
-	       (if (not (ad-get-arg 1))
-		   (setq ad-return-value
-			 (substitute-command-keys ad-return-value))))))))
-
-
 ;; @@ Starting, stopping and recovering from the advice package magic:
 ;; ===================================================================
 
@@ -3943,9 +3920,7 @@
   (interactive)
   ;; Advising `ad-activate-internal' means death!!
   (ad-set-advice-info 'ad-activate-internal nil)
-  (ad-safe-fset 'ad-activate-internal 'ad-activate)
-  (ad-enable-advice 'documentation 'after 'ad-advised-docstring)
-  (ad-activate 'documentation 'compile))
+  (ad-safe-fset 'ad-activate-internal 'ad-activate))
 
 (defun ad-stop-advice ()
   "Stop the automatic advice handling magic.
@@ -3953,8 +3928,6 @@
   (interactive)
   ;; Advising `ad-activate-internal' means death!!
   (ad-set-advice-info 'ad-activate-internal nil)
-  (ad-disable-advice 'documentation 'after 'ad-advised-docstring)
-  (ad-update 'documentation)
   (ad-safe-fset 'ad-activate-internal 'ad-activate-internal-off))
 
 (defun ad-recover-normality ()