diff options
| author | Paul Eggert | 2016-05-27 18:16:24 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-05-27 18:17:04 -0700 |
| commit | 66cd9187e396abfa7220d6a8f8d1a7064ef20b1e (patch) | |
| tree | 3a67532755b6302dcd6fee3b6f420ed3c3851646 | |
| parent | 4ce68f8f0f1dd1aa518e6e682b2c2cef1f49d953 (diff) | |
| download | emacs-66cd9187e396abfa7220d6a8f8d1a7064ef20b1e.tar.gz emacs-66cd9187e396abfa7220d6a8f8d1a7064ef20b1e.zip | |
Don’t document declare-function internals
Suggested by Stefan Monnier in:
http://lists.gnu.org/archive/html/emacs-devel/2016-05/msg00618.html
* doc/lispref/functions.texi (Declaring Functions):
* lisp/subr.el (declare-function):
* lisp/emacs-lisp/bytecomp.el:
(byte-compile-macroexpand-declare-function):
Document as (fn file &optional arglist fileonly)
even though it is really (fn file &rest args).
| -rw-r--r-- | doc/lispref/functions.texi | 19 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 2 | ||||
| -rw-r--r-- | lisp/subr.el | 19 |
3 files changed, 21 insertions, 19 deletions
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 7513adfbbef..fff4ac0ee8d 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi | |||
| @@ -2204,17 +2204,16 @@ cases, this might be something like @code{(file &optional overwrite)}. | |||
| 2204 | You don't have to specify the argument list, but if you do the | 2204 | You don't have to specify the argument list, but if you do the |
| 2205 | byte compiler can check that the calls match the declaration. | 2205 | byte compiler can check that the calls match the declaration. |
| 2206 | 2206 | ||
| 2207 | @defmac declare-function function file &rest args | 2207 | @defmac declare-function function file &optional arglist fileonly |
| 2208 | Tell the byte compiler to assume that @var{function} is defined in the | 2208 | Tell the byte compiler to assume that @var{function} is defined in the |
| 2209 | file @var{file}. The trailing arguments @var{args} can contain one or | 2209 | file @var{file}. The optional third argument @var{arglist} is either |
| 2210 | two optional arguments. The first optional argument @var{arglist} is | 2210 | @code{t}, meaning the argument list is unspecified, or a list of |
| 2211 | either @code{t}, meaning the argument list is unspecified, or a list | 2211 | formal parameters in the same style as @code{defun}. An omitted |
| 2212 | of formal parameters in the same style as @code{defun}.@footnote{An | 2212 | @var{arglist} defaults to @code{t}, not @code{nil}; this is atypical |
| 2213 | omitted @var{arglist} defaults to @code{t}, not @code{nil}; this | 2213 | behavior for omitted arguments, and it means that to supply a fourth |
| 2214 | atypical behavior is why @code{declare-function} is defined to have | 2214 | but not third argument one must specify @code{t} for the third-argument |
| 2215 | the formal parameters @code{(function file &rest args)}, not | 2215 | placeholder instead of the usual @code{nil}. The optional fourth |
| 2216 | @code{(function file &optional arglist fileonly)}.} The second | 2216 | argument @var{fileonly} non-@code{nil} means check only that |
| 2217 | optional argument @var{fileonly} non-@code{nil} means only check that | ||
| 2218 | @var{file} exists, not that it actually defines @var{function}. | 2217 | @var{file} exists, not that it actually defines @var{function}. |
| 2219 | @end defmac | 2218 | @end defmac |
| 2220 | 2219 | ||
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 11eb44cea31..dc7574e778d 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -2959,6 +2959,8 @@ for symbols generated by the byte compiler itself." | |||
| 2959 | 2959 | ||
| 2960 | ;; Special macro-expander used during byte-compilation. | 2960 | ;; Special macro-expander used during byte-compilation. |
| 2961 | (defun byte-compile-macroexpand-declare-function (fn file &rest args) | 2961 | (defun byte-compile-macroexpand-declare-function (fn file &rest args) |
| 2962 | (declare (advertised-calling-convention | ||
| 2963 | (fn file &optional arglist fileonly) nil)) | ||
| 2962 | (let ((gotargs (and (consp args) (listp (car args)))) | 2964 | (let ((gotargs (and (consp args) (listp (car args)))) |
| 2963 | (unresolved (assq fn byte-compile-unresolved-functions))) | 2965 | (unresolved (assq fn byte-compile-unresolved-functions))) |
| 2964 | (when unresolved ; function was called before declaration | 2966 | (when unresolved ; function was called before declaration |
diff --git a/lisp/subr.el b/lisp/subr.el index 97cde6879cd..6e679e70f7e 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -33,8 +33,7 @@ | |||
| 33 | "Tell the byte-compiler that function FN is defined, in FILE. | 33 | "Tell the byte-compiler that function FN is defined, in FILE. |
| 34 | The FILE argument is not used by the byte-compiler, but by the | 34 | The FILE argument is not used by the byte-compiler, but by the |
| 35 | `check-declare' package, which checks that FILE contains a | 35 | `check-declare' package, which checks that FILE contains a |
| 36 | definition for FN. Remaining ARGS are used by both the | 36 | definition for FN. |
| 37 | byte-compiler and `check-declare' to check for consistency. | ||
| 38 | 37 | ||
| 39 | FILE can be either a Lisp file (in which case the \".el\" | 38 | FILE can be either a Lisp file (in which case the \".el\" |
| 40 | extension is optional), or a C file. C files are expanded | 39 | extension is optional), or a C file. C files are expanded |
| @@ -45,20 +44,22 @@ declaration. A FILE with an \"ext:\" prefix is an external file. | |||
| 45 | `check-declare' will check such files if they are found, and skip | 44 | `check-declare' will check such files if they are found, and skip |
| 46 | them without error if they are not. | 45 | them without error if they are not. |
| 47 | 46 | ||
| 48 | ARGS can contain one or two optional args. First optional arg | 47 | Optional ARGLIST specifies FN's arguments, or is t to not specify |
| 49 | ARGLIST specifies FN's arguments, or is t to not specify FN's | 48 | FN's arguments. An omitted ARGLIST defaults to t, not nil: a nil |
| 50 | arguments. An omitted ARGLIST defaults to t, not nil: a nil | ||
| 51 | ARGLIST specifies an empty argument list, and an explicit t | 49 | ARGLIST specifies an empty argument list, and an explicit t |
| 52 | ARGLIST is a placeholder that allows supplying a later arg. | 50 | ARGLIST is a placeholder that allows supplying a later arg. |
| 53 | Second optional arg FILEONLY non-nil means that `check-declare' | 51 | |
| 54 | will check only that FILE exists, not that it defines FN. This | 52 | Optional FILEONLY non-nil means that `check-declare' will check |
| 55 | is intended for function definitions that `check-declare' does | 53 | only that FILE exists, not that it defines FN. This is intended |
| 56 | not recognize, e.g., `defstruct'. | 54 | for function definitions that `check-declare' does not recognize, |
| 55 | e.g., `defstruct'. | ||
| 57 | 56 | ||
| 58 | Note that for the purposes of `check-declare', this statement | 57 | Note that for the purposes of `check-declare', this statement |
| 59 | must be the first non-whitespace on a line. | 58 | must be the first non-whitespace on a line. |
| 60 | 59 | ||
| 61 | For more information, see Info node `(elisp)Declaring Functions'." | 60 | For more information, see Info node `(elisp)Declaring Functions'." |
| 61 | (declare (advertised-calling-convention | ||
| 62 | (fn file &optional arglist fileonly) nil)) | ||
| 62 | ;; Does nothing - byte-compile-declare-function does the work. | 63 | ;; Does nothing - byte-compile-declare-function does the work. |
| 63 | nil) | 64 | nil) |
| 64 | 65 | ||