aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/advice.el47
1 files changed, 23 insertions, 24 deletions
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index 93ce7776d2f..09ef27528d2 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -1,6 +1,6 @@
1;;; advice.el --- an overloading mechanism for Emacs Lisp functions 1;;; advice.el --- an overloading mechanism for Emacs Lisp functions
2 2
3;; Copyright (C) 1993,1994,2000, 2001 Free Software Foundation, Inc. 3;; Copyright (C) 1993,1994,2000,01,2004 Free Software Foundation, Inc.
4 4
5;; Author: Hans Chalupsky <hans@cs.buffalo.edu> 5;; Author: Hans Chalupsky <hans@cs.buffalo.edu>
6;; Maintainer: FSF 6;; Maintainer: FSF
@@ -2563,29 +2563,28 @@ supplied to make subr arglist lookup more efficient."
2563Either use the one stored under the `ad-subr-arglist' property, 2563Either use the one stored under the `ad-subr-arglist' property,
2564or try to retrieve it from the docstring and cache it under 2564or try to retrieve it from the docstring and cache it under
2565that property, or otherwise use `(&rest ad-subr-args)'." 2565that property, or otherwise use `(&rest ad-subr-args)'."
2566 (cond ((ad-subr-args-defined-p subr-name) 2566 (if (ad-subr-args-defined-p subr-name)
2567 (ad-get-subr-args subr-name)) 2567 (ad-get-subr-args subr-name)
2568 ;; says jwz: Should use this for Lemacs 19.8 and above: 2568 ;; says jwz: Should use this for Lemacs 19.8 and above:
2569 ;;((fboundp 'subr-min-args) 2569 ;;((fboundp 'subr-min-args)
2570 ;; ...) 2570 ;; ...)
2571 ;; says hans: I guess what Jamie means is that I should use the values 2571 ;; says hans: I guess what Jamie means is that I should use the values
2572 ;; of `subr-min-args' and `subr-max-args' to construct the subr arglist 2572 ;; of `subr-min-args' and `subr-max-args' to construct the subr arglist
2573 ;; without having to look it up via parsing the docstring, e.g., 2573 ;; without having to look it up via parsing the docstring, e.g.,
2574 ;; values 1 and 2 would suggest `(arg1 &optional arg2)' as an 2574 ;; values 1 and 2 would suggest `(arg1 &optional arg2)' as an
2575 ;; argument list. However, that won't work because there is no 2575 ;; argument list. However, that won't work because there is no
2576 ;; way to distinguish a subr with args `(a &optional b &rest c)' from 2576 ;; way to distinguish a subr with args `(a &optional b &rest c)' from
2577 ;; one with args `(a &rest c)' using that mechanism. Also, the argument 2577 ;; one with args `(a &rest c)' using that mechanism. Also, the argument
2578 ;; names from the docstring are more meaningful. Hence, I'll stick with 2578 ;; names from the docstring are more meaningful. Hence, I'll stick with
2579 ;; the old way of doing things. 2579 ;; the old way of doing things.
2580 (t (let ((doc (or (ad-real-documentation subr-name t) ""))) 2580 (let ((doc (or (ad-real-documentation subr-name t) "")))
2581 (cond ((string-match "^\\(([^\)]+)\\)\n?\\'" doc) 2581 (if (not (string-match "\n\n\\((.+)\\)\\'" doc))
2582 (ad-define-subr-args 2582 (error "The usage info is missing from the subr %s" subr-name)
2583 subr-name 2583 (ad-define-subr-args
2584 (cdr (car (read-from-string 2584 subr-name
2585 (downcase (match-string 1 doc)))))) 2585 (cdr (car (read-from-string
2586 (ad-get-subr-args subr-name)) 2586 (downcase (match-string 1 doc))))))
2587 ;; This is actually an error. 2587 (ad-get-subr-args subr-name)))))
2588 (t '(&rest ad-subr-args)))))))
2589 2588
2590(defun ad-docstring (definition) 2589(defun ad-docstring (definition)
2591 "Return the unexpanded docstring of DEFINITION." 2590 "Return the unexpanded docstring of DEFINITION."