aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lispref/functions.texi43
1 files changed, 41 insertions, 2 deletions
diff --git a/lispref/functions.texi b/lispref/functions.texi
index 26c2449fee6..bcdfc95cc1c 100644
--- a/lispref/functions.texi
+++ b/lispref/functions.texi
@@ -21,6 +21,7 @@ define them.
21* Anonymous Functions:: Lambda expressions are functions with no names. 21* Anonymous Functions:: Lambda expressions are functions with no names.
22* Function Cells:: Accessing or setting the function definition 22* Function Cells:: Accessing or setting the function definition
23 of a symbol. 23 of a symbol.
24* Obsolete Functions:: Declaring functions obsolete.
24* Inline Functions:: Defining functions that the compiler will open code. 25* Inline Functions:: Defining functions that the compiler will open code.
25* Function Safety:: Determining whether a function is safe to call. 26* Function Safety:: Determining whether a function is safe to call.
26* Related Topics:: Cross-references to specific Lisp primitives 27* Related Topics:: Cross-references to specific Lisp primitives
@@ -601,7 +602,7 @@ which file defined the function, just like @code{defun}
601 602
602By contrast, in programs that manipulate function definitions for other 603By contrast, in programs that manipulate function definitions for other
603purposes, it is better to use @code{fset}, which does not keep such 604purposes, it is better to use @code{fset}, which does not keep such
604records. 605records. @xref{Function Cells}.
605@end defun 606@end defun
606 607
607 You cannot create a new primitive function with @code{defun} or 608 You cannot create a new primitive function with @code{defun} or
@@ -1150,6 +1151,44 @@ file to redefine a function defined elsewhere. If you want to modify
1150a function defined by another package, it is cleaner to use 1151a function defined by another package, it is cleaner to use
1151@code{defadvice} (@pxref{Advising Functions}). 1152@code{defadvice} (@pxref{Advising Functions}).
1152 1153
1154@node Obsolete Functions
1155@section Declaring Functions Obsolete
1156
1157You can use @code{make-obsolete} to declare a function obsolete. This
1158indicates that the function may be removed at some stage in the future.
1159
1160@defun make-obsolete function new &optional when
1161This function makes the byte compiler warn that the function
1162@var{function} is obsolete. If @var{new} is a symbol, the warning
1163message says to use @var{new} instead of @var{function}. @var{new}
1164does not need to be an alias for @var{function}; it can be a different
1165function with similar functionality. If @var{new} is a string, it is
1166the warning message.
1167
1168If provided, @var{when} should be a string indicating when the function
1169was first made obsolete---for example, a date or a release number.
1170@end defun
1171
1172You can define a function as an alias and declare it obsolete at the
1173same time using the macro @code{define-obsolete-function-alias}.
1174
1175@defmac define-obsolete-function-alias function new &optional when docstring
1176This macro marks the function @var{function} obsolete and also defines
1177it as an alias for the function @var{new}. A typical call has the form:
1178
1179@example
1180(define-obsolete-function-alias 'old-fun 'new-fun "22.1" "Doc.")
1181@end example
1182
1183@noindent
1184which is equivalent to the following two lines of code:
1185
1186@example
1187(defalias 'old-fun 'new-fun "Doc.")
1188(make-obsolete 'old-fun 'new-fun "22.1")
1189@end example
1190@end defmac
1191
1153@node Inline Functions 1192@node Inline Functions
1154@section Inline Functions 1193@section Inline Functions
1155@cindex inline functions 1194@cindex inline functions
@@ -1186,7 +1225,7 @@ Inline functions can be used and open-coded later on in the same file,
1186following the definition, just like macros. 1225following the definition, just like macros.
1187 1226
1188@node Function Safety 1227@node Function Safety
1189@section Determining whether a function is safe to call 1228@section Determining whether a Function is Safe to Call
1190@cindex function safety 1229@cindex function safety
1191@cindex safety of functions 1230@cindex safety of functions
1192 1231