aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2016-05-27 18:16:24 -0700
committerPaul Eggert2016-05-27 18:17:04 -0700
commit66cd9187e396abfa7220d6a8f8d1a7064ef20b1e (patch)
tree3a67532755b6302dcd6fee3b6f420ed3c3851646
parent4ce68f8f0f1dd1aa518e6e682b2c2cef1f49d953 (diff)
downloademacs-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.texi19
-rw-r--r--lisp/emacs-lisp/bytecomp.el2
-rw-r--r--lisp/subr.el19
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)}.
2204You don't have to specify the argument list, but if you do the 2204You don't have to specify the argument list, but if you do the
2205byte compiler can check that the calls match the declaration. 2205byte 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
2208Tell the byte compiler to assume that @var{function} is defined in the 2208Tell the byte compiler to assume that @var{function} is defined in the
2209file @var{file}. The trailing arguments @var{args} can contain one or 2209file @var{file}. The optional third argument @var{arglist} is either
2210two optional arguments. The first optional argument @var{arglist} is 2210@code{t}, meaning the argument list is unspecified, or a list of
2211either @code{t}, meaning the argument list is unspecified, or a list 2211formal parameters in the same style as @code{defun}. An omitted
2212of formal parameters in the same style as @code{defun}.@footnote{An 2212@var{arglist} defaults to @code{t}, not @code{nil}; this is atypical
2213omitted @var{arglist} defaults to @code{t}, not @code{nil}; this 2213behavior for omitted arguments, and it means that to supply a fourth
2214atypical behavior is why @code{declare-function} is defined to have 2214but not third argument one must specify @code{t} for the third-argument
2215the formal parameters @code{(function file &rest args)}, not 2215placeholder instead of the usual @code{nil}. The optional fourth
2216@code{(function file &optional arglist fileonly)}.} The second 2216argument @var{fileonly} non-@code{nil} means check only that
2217optional 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.
34The FILE argument is not used by the byte-compiler, but by the 34The 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
36definition for FN. Remaining ARGS are used by both the 36definition for FN.
37byte-compiler and `check-declare' to check for consistency.
38 37
39FILE can be either a Lisp file (in which case the \".el\" 38FILE can be either a Lisp file (in which case the \".el\"
40extension is optional), or a C file. C files are expanded 39extension 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
46them without error if they are not. 45them without error if they are not.
47 46
48ARGS can contain one or two optional args. First optional arg 47Optional ARGLIST specifies FN's arguments, or is t to not specify
49ARGLIST specifies FN's arguments, or is t to not specify FN's 48FN's arguments. An omitted ARGLIST defaults to t, not nil: a nil
50arguments. An omitted ARGLIST defaults to t, not nil: a nil
51ARGLIST specifies an empty argument list, and an explicit t 49ARGLIST specifies an empty argument list, and an explicit t
52ARGLIST is a placeholder that allows supplying a later arg. 50ARGLIST is a placeholder that allows supplying a later arg.
53Second optional arg FILEONLY non-nil means that `check-declare' 51
54will check only that FILE exists, not that it defines FN. This 52Optional FILEONLY non-nil means that `check-declare' will check
55is intended for function definitions that `check-declare' does 53only that FILE exists, not that it defines FN. This is intended
56not recognize, e.g., `defstruct'. 54for function definitions that `check-declare' does not recognize,
55e.g., `defstruct'.
57 56
58Note that for the purposes of `check-declare', this statement 57Note that for the purposes of `check-declare', this statement
59must be the first non-whitespace on a line. 58must be the first non-whitespace on a line.
60 59
61For more information, see Info node `(elisp)Declaring Functions'." 60For 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