]> code.delx.au - gnu-emacs/blobdiff - doc/lispref/functions.texi
Merge from trunk.
[gnu-emacs] / doc / lispref / functions.texi
index 9e6834383aee1bb2be016b052a014135653cdd19..f3b2375b61da57d6db9954fb355aa0b8edb7d231 100644 (file)
@@ -1,7 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001,
-@c   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+@c Copyright (C) 1990-1995, 1998-1999, 2001-2011
+@c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../../info/functions
 @node Functions, Macros, Variables, Top
@@ -22,7 +22,7 @@ define them.
 * Function Cells::        Accessing or setting the function definition
                             of a symbol.
 * Obsolete Functions::    Declaring functions obsolete.
-* Inline Functions::     Defining functions that the compiler will open code.
+* Inline Functions::      Defining functions that the compiler will open code.
 * Declaring Functions::   Telling the compiler that a function is defined.
 * Function Safety::       Determining whether a function is safe to call.
 * Related Topics::        Cross-references to specific Lisp primitives
@@ -112,6 +112,13 @@ editors; for Lisp programs, the distinction is normally unimportant.
 @item byte-code function
 A @dfn{byte-code function} is a function that has been compiled by the
 byte compiler.  @xref{Byte-Code Type}.
+
+@item autoload object
+@cindex autoload object
+An @dfn{autoload object} is a place-holder for a real function.  If
+the autoload object is called, it will make Emacs load the file
+containing the definition of the real function, and then call the real
+function instead.
 @end table
 
 @defun functionp object
@@ -783,6 +790,12 @@ This function returns @var{arg} and has no side effects.
 This function ignores any arguments and returns @code{nil}.
 @end defun
 
+  Emacs Lisp functions can also be user-visible @dfn{commands}.  A
+command is a function that has an @dfn{interactive} specification.
+You may want to call these functions as if they were called
+interactively.  See @ref{Interactive Call} for details on how to do
+that.
+
 @node Mapping Functions
 @section Mapping Functions
 @cindex mapping functions
@@ -817,7 +830,7 @@ length of @var{sequence}.  For example:
      @result{} (a c e)
 (mapcar '1+ [1 2 3])
      @result{} (2 3 4)
-(mapcar 'char-to-string "abc")
+(mapcar 'string "abc")
      @result{} ("a" "b" "c")
 @end group
 
@@ -1197,7 +1210,7 @@ was first made obsolete---for example, a date or a release number.
 @end defun
 
 You can define a function as an alias and declare it obsolete at the
-same time using the macro @code{define-obsolete-function-alias}.
+same time using the macro @code{define-obsolete-function-alias}:
 
 @defmac define-obsolete-function-alias obsolete-name current-name &optional when docstring
 This macro marks the function @var{obsolete-name} obsolete and also
@@ -1210,6 +1223,33 @@ equivalent to the following:
 @end example
 @end defmac
 
+In addition, you can mark a certain a particular calling convention
+for a function as obsolete:
+
+@defun set-advertised-calling-convention function signature
+This function specifies the argument list @var{signature} as the
+correct way to call @var{function}.  This causes the Emacs byte
+compiler to issue a warning whenever it comes across an Emacs Lisp
+program that calls @var{function} any other way (however, it will
+still allow the code to be byte compiled).
+
+For instance, in old versions of Emacs the @code{sit-for} function
+accepted three arguments, like this
+
+@smallexample
+  (sit-for seconds milliseconds nodisp)
+@end smallexample
+
+However, calling @code{sit-for} this way is considered obsolete
+(@pxref{Waiting}).  The old calling convention is deprecated like
+this:
+
+@smallexample
+(set-advertised-calling-convention
+  'sit-for '(seconds &optional nodisp))
+@end smallexample
+@end defun
+
 @node Inline Functions
 @section Inline Functions
 @cindex inline functions
@@ -1482,7 +1522,3 @@ See @ref{Mapping Functions}.
 @item undefined
 See @ref{Functions for Key Lookup}.
 @end table
-
-@ignore
-   arch-tag: 39100cdf-8a55-4898-acba-595db619e8e2
-@end ignore