diff options
Diffstat (limited to 'doc/lispref/objects.texi')
| -rw-r--r-- | doc/lispref/objects.texi | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index ba28b63f0de..b28b3b00898 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi | |||
| @@ -156,6 +156,8 @@ latter are unique to Emacs Lisp. | |||
| 156 | * Byte-Code Type:: A function written in Lisp, then compiled. | 156 | * Byte-Code Type:: A function written in Lisp, then compiled. |
| 157 | * Autoload Type:: A type used for automatically loading seldom-used | 157 | * Autoload Type:: A type used for automatically loading seldom-used |
| 158 | functions. | 158 | functions. |
| 159 | * Finalizer Type:: Runs code when no longer reachable. | ||
| 160 | |||
| 159 | @end menu | 161 | @end menu |
| 160 | 162 | ||
| 161 | @node Integer Type | 163 | @node Integer Type |
| @@ -1361,6 +1363,31 @@ in the loaded file. | |||
| 1361 | @code{autoload}, which stores the object in the function cell of a | 1363 | @code{autoload}, which stores the object in the function cell of a |
| 1362 | symbol. @xref{Autoload}, for more details. | 1364 | symbol. @xref{Autoload}, for more details. |
| 1363 | 1365 | ||
| 1366 | @node Finalizer Type | ||
| 1367 | @subsection Finalizer Type | ||
| 1368 | |||
| 1369 | A @dfn{finalizer object} helps Lisp code clean up after objects that | ||
| 1370 | are no longer needed. A finalizer holds a Lisp function object. | ||
| 1371 | When a finalizer object becomes unreachable after a garbage collection | ||
| 1372 | pass, Emacs calls the finalizer's associated function object. | ||
| 1373 | When deciding whether a finalizer is reachable, Emacs does not count | ||
| 1374 | references from finalizer objects themselves, allowing you to use | ||
| 1375 | finalizers without having to worry about accidentally capturing | ||
| 1376 | references to finalized objects themselves. | ||
| 1377 | |||
| 1378 | Errors in finalizers are printed to @code{*Messages*}. Emacs runs | ||
| 1379 | a given finalizer object's associated function exactly once, even | ||
| 1380 | if that function fails. | ||
| 1381 | |||
| 1382 | @defun make-finalizer function | ||
| 1383 | Make a finalizer that will run @var{function}. @var{function} will be | ||
| 1384 | called after garbage collection when the returned finalizer object | ||
| 1385 | becomes unreachable. If the finalizer object is reachable only | ||
| 1386 | through references from finalizer objects, it does not count as | ||
| 1387 | reachable for the purpose of deciding whether to run @var{function}. | ||
| 1388 | @var{function} will be run once per finalizer object. | ||
| 1389 | @end defun | ||
| 1390 | |||
| 1364 | @node Editing Types | 1391 | @node Editing Types |
| 1365 | @section Editing Types | 1392 | @section Editing Types |
| 1366 | @cindex editing types | 1393 | @cindex editing types |
| @@ -1907,11 +1934,11 @@ types. In most cases, it is more convenient to use type predicates than | |||
| 1907 | This function returns a symbol naming the primitive type of | 1934 | This function returns a symbol naming the primitive type of |
| 1908 | @var{object}. The value is one of the symbols @code{bool-vector}, | 1935 | @var{object}. The value is one of the symbols @code{bool-vector}, |
| 1909 | @code{buffer}, @code{char-table}, @code{compiled-function}, | 1936 | @code{buffer}, @code{char-table}, @code{compiled-function}, |
| 1910 | @code{cons}, @code{float}, @code{font-entity}, @code{font-object}, | 1937 | @code{cons}, @code{finalizer}, @code{float}, @code{font-entity}, |
| 1911 | @code{font-spec}, @code{frame}, @code{hash-table}, @code{integer}, | 1938 | @code{font-object}, @code{font-spec}, @code{frame}, @code{hash-table}, |
| 1912 | @code{marker}, @code{overlay}, @code{process}, @code{string}, | 1939 | @code{integer}, @code{marker}, @code{overlay}, @code{process}, |
| 1913 | @code{subr}, @code{symbol}, @code{vector}, @code{window}, or | 1940 | @code{string}, @code{subr}, @code{symbol}, @code{vector}, |
| 1914 | @code{window-configuration}. | 1941 | @code{window}, or @code{window-configuration}. |
| 1915 | 1942 | ||
| 1916 | @example | 1943 | @example |
| 1917 | (type-of 1) | 1944 | (type-of 1) |