From 708bb6f8849a4e4fac349ae19379ff41f46c067c Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 3 Dec 2007 00:33:35 +0000 Subject: (declare-function): Moved from byte-run.el. --- lisp/ChangeLog | 4 ++++ lisp/subr.el | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 373eead8fd..2745a811c2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2007-12-03 Richard Stallman + * subr.el (declare-function): Moved from byte-run.el. + + * emacs-lisp/byte-run.el (declare-function): Moved to subr.el + * window.el (recenter-top-bottom): Don't use `ecase'. 2007-12-02 Karl Fogel diff --git a/lisp/subr.el b/lisp/subr.el index 59be9164b6..3461700d6c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -36,6 +36,42 @@ Each element of this list holds the arguments to one call to `defcustom'.") (setq custom-declare-variable-list (cons arguments custom-declare-variable-list))) +(defmacro declare-function (fn file &optional arglist fileonly) + "Tell the byte-compiler that function FN is defined, in FILE. +Optional ARGLIST is the argument list used by the function. The +FILE argument is not used by the byte-compiler, but by the +`check-declare' package, which checks that FILE contains a +definition for FN. ARGLIST is used by both the byte-compiler and +`check-declare' to check for consistency. + +FILE can be either a Lisp file (in which case the \".el\" +extension is optional), or a C file. C files are expanded +relative to the Emacs \"src/\" directory. Lisp files are +searched for using `locate-library', and if that fails they are +expanded relative to the location of the file containing the +declaration. A FILE with an \"ext:\" prefix is an external file. +`check-declare' will check such files if they are found, and skip +them without error if they are not. + +FILEONLY non-nil means that `check-declare' will only check that +FILE exists, not that it defines FN. This is intended for +function-definitions that `check-declare' does not recognize, e.g. +`defstruct'. + +To specify a value for FILEONLY without passing an argument list, +set ARGLIST to `t'. This is necessary because `nil' means an +empty argument list, rather than an unspecified one. + +Note that for the purposes of `check-declare', this statement +must be the first non-whitespace on a line, and everything up to +the end of FILE must be all on the same line. For example: + +\(declare-function c-end-of-defun \"progmodes/cc-cmds.el\" + \(&optional arg)) + +For more information, see Info node `elisp(Declaring Functions)'." + ;; Does nothing - byte-compile-declare-function does the work. + nil) ;;;; Basic Lisp macros. -- cgit v1.2.3