diff options
Diffstat (limited to 'doc/lispref/functions.texi')
-rw-r--r-- | doc/lispref/functions.texi | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index e646e7c8b0a..eac5b91e76a 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -1,6 +1,6 @@ @c -*- mode: texinfo; coding: utf-8 -*- @c This is part of the GNU Emacs Lisp Reference Manual. -@c Copyright (C) 1990--1995, 1998--1999, 2001--2023 Free Software +@c Copyright (C) 1990--1995, 1998--1999, 2001--2024 Free Software @c Foundation, Inc. @c See the file elisp.texi for copying conditions. @node Functions @@ -533,6 +533,40 @@ Instead, use the @code{advertised-calling-convention} declaration compiler emit a warning message when it compiles Lisp programs which use the deprecated calling convention. +@ifnottex +The @code{(fn)} feature is typically used in the following situations: + +@itemize @minus +@item To spell out arguments and their purposes in a macro or a function. Example: + +@example +(defmacro lambda (&rest cdr) + "@dots{} +\(fn ARGS [DOCSTRING] [INTERACTIVE] BODY)"@dots{}) +@end example + +@item To provide a more detailed description and names of arguments. Example: + +@example +(defmacro macroexp--accumulate (var+list &rest body) + "@dots{} +\(fn (VAR LIST) BODY@dots{})" + (declare (indent 1)) + (let ((var (car var+list)) + (list (cadr var+list)) +@dots{}))) +@end example + +@item To better explain the purpose of a @code{defalias}. Example: + +@example +(defalias 'abbrev-get 'get + "@dots{} +\(fn ABBREV PROP)") +@end example +@end itemize +@end ifnottex + @cindex computed documentation string @kindex :documentation Documentation strings are usually static, but occasionally it can be @@ -946,8 +980,8 @@ lists) and call them using @code{funcall} or @code{apply}. Functions that accept function arguments are often called @dfn{functionals}. Sometimes, when you call a functional, it is useful to supply a no-op -function as the argument. Here are two different kinds of no-op -function: +function as the argument. Here are three different kinds of no-op +functions: @defun identity argument This function returns @var{argument} and has no side effects. |