aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorStefan Monnier2024-03-11 16:12:26 -0400
committerStefan Monnier2024-04-18 15:28:36 -0400
commit126be02077520a943252d0d219bb7677466d0168 (patch)
treef762237714f11b303c708f93f09a8dc72426bb2a /doc
parent7842af6095db4384898725fb4a14ebaa11379a34 (diff)
downloademacs-scratch/interpreted-function.tar.gz
emacs-scratch/interpreted-function.zip
Use a dedicated type to represent interpreted-function valuesscratch/interpreted-function
Change `function` so that when evaluating #'(lambda ...) we return an object of type `interpreted-function` rather than a list starting with one of `lambda` or `closure`. The new type reuses the existing PVEC_CLOSURE (nee PVEC_COMPILED) tag and tries to align the corresponding elements: - the arglist, the docstring, and the interactive-form go in the same slots as for byte-code functions. - the body of the function goes in the slot used for the bytecode string. - the lexical context goes in the slot used for the constants of bytecoded functions. The first point above means that `help-function-arglist`, `documentation`, and `interactive-form`s don't need to distinguish interpreted and bytecode functions any more. Main benefits of the change: - We can now reliably distinguish a list from a function value. - `cl-defmethod` can dispatch on `interactive-function` and `closure`. Dispatch on `function` also works now for interpreted functions but still won't work for functions represented as lists or as symbols, of course. - Function values are now self-evaluating. That was alrready the case when byte-compiled, but not when interpreted since (eval '(closure ...)) signals a void-function error. That also avoids false-positive warnings about "don't quote your lambdas" when doing things like `(mapcar ',func ...)`. * src/eval.c (Fmake_interpreted_closure): New function. (Ffunction): Use it and change calling convention of `Vinternal_make_interpreted_closure_function`. (FUNCTIONP, Fcommandp, eval_sub, funcall_general, funcall_lambda) (Ffunc_arity, lambda_arity): Simplify. (funcall_lambda): Adjust to new representation. (syms_of_eval): `defsubr` the new function. Remove definition of `Qclosure`. * lisp/emacs-lisp/cconv.el (cconv-make-interpreted-closure): Change calling convention and use `make-interpreted-closure`. * src/data.c (Fcl_type_of): Distinguish `byte-code-function`s from `interpreted-function`s. (Fclosurep, finterpreted_function_p): New functions. (Fbyte_code_function_p): Don't be confused by `interpreted-function`s. (Finteractive_form, Fcommand_modes): Simplify. (syms_of_data): Define new type symbols and `defsubr` the two new functions. * lisp/emacs-lisp/cl-print.el (cl-print-object) <interpreted-function>: New method. * lisp/emacs-lisp/oclosure.el (oclosure): Refine the parent to be `closure`. (oclosure--fix-type, oclosure-type): Simplify. (oclosure--copy, oclosure--get, oclosure--set): Adjust to new representation. * src/callint.c (Fcall_interactively): Adjust to new representation. * src/lread.c (bytecode_from_rev_list): * lisp/simple.el (function-documentation): * lisp/help.el (help-function-arglist): Remove the old `closure` case and adjust the byte-code case so it handles `interpreted-function`s. * lisp/emacs-lisp/cl-preloaded.el (closure): New type. (byte-code-function): Add it as a parent. (interpreted-function): Adjust parent (the type itself was already added earlier by accident). * lisp/emacs-lisp/bytecomp.el (byte-compile--reify-function): Adjust to new representation. (byte-compile): Use `interpreted-function-p`. * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): Adjust to new representation. (side-effect-free-fns): Add `interpreted-function-p` and `closurep`. * src/profiler.c (trace_hash, ffunction_equal): Simplify. * lisp/profiler.el (profiler-function-equal): Simplify. * lisp/emacs-lisp/nadvice.el (advice--interactive-form-1): Use `interpreted-function-p`; adjust to new representation; and take advantage of the fact that function values are now self-evaluating. * lisp/emacs-lisp/lisp-mode.el (closure): Remove `lisp-indent-function` property. * lisp/emacs-lisp/disass.el (disassemble-internal): Adjust to new representation. * lisp/emacs-lisp/edebug.el (edebug--strip-instrumentation): Use `interpreted-function-p`. * lisp/emacs-lisp/comp-common.el (comp-known-type-specifiers): Add `closurep` and `interpreted-function-p`. * test/lisp/help-fns-tests.el (help-fns-test-lisp-defun): Adjust to more precise type info in `describe-function`. * test/lisp/erc/resources/erc-d/erc-d-tests.el (erc-d--render-entries): Use `interpreted-function-p`. * test/lisp/emacs-lisp/macroexp-resources/vk.el (vk-f4, vk-f5): Don't hardcode function values. * doc/lispref/functions.texi (Anonymous Functions): Don't suggest that function values are lists. Reword "self-quoting" to reflect the fact that #' doesn't return the exact same object. Update examples with the new shape of the return value. * doc/lispref/variables.texi (Lexical Binding): * doc/lispref/lists.texi (Rearrangement): * doc/lispref/control.texi (Handling Errors): Update examples to reflect new representation of function values.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/compile.texi61
-rw-r--r--doc/lispref/control.texi2
-rw-r--r--doc/lispref/elisp.texi4
-rw-r--r--doc/lispref/functions.texi36
-rw-r--r--doc/lispref/lists.texi4
-rw-r--r--doc/lispref/objects.texi38
-rw-r--r--doc/lispref/sequences.texi2
-rw-r--r--doc/lispref/variables.texi2
8 files changed, 97 insertions, 52 deletions
diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi
index 00602198da5..3fbf39b349d 100644
--- a/doc/lispref/compile.texi
+++ b/doc/lispref/compile.texi
@@ -37,7 +37,7 @@ variable binding for @code{no-byte-compile} into it, like this:
37* Docs and Compilation:: Dynamic loading of documentation strings. 37* Docs and Compilation:: Dynamic loading of documentation strings.
38* Eval During Compile:: Code to be evaluated when you compile. 38* Eval During Compile:: Code to be evaluated when you compile.
39* Compiler Errors:: Handling compiler error messages. 39* Compiler Errors:: Handling compiler error messages.
40* Byte-Code Objects:: The data type used for byte-compiled functions. 40* Closure Objects:: The data type used for byte-compiled functions.
41* Disassembly:: Disassembling byte-code; how to read byte-code. 41* Disassembly:: Disassembling byte-code; how to read byte-code.
42@end menu 42@end menu
43 43
@@ -120,7 +120,7 @@ replacing the previous definition with the compiled one. The function
120definition of @var{symbol} must be the actual code for the function; 120definition of @var{symbol} must be the actual code for the function;
121@code{byte-compile} does not handle function indirection. The return 121@code{byte-compile} does not handle function indirection. The return
122value is the byte-code function object which is the compiled 122value is the byte-code function object which is the compiled
123definition of @var{symbol} (@pxref{Byte-Code Objects}). 123definition of @var{symbol} (@pxref{Closure Objects}).
124 124
125@example 125@example
126@group 126@group
@@ -487,21 +487,22 @@ string for details.
487using @code{error}. If so, set @code{byte-compile-error-on-warn} to a 487using @code{error}. If so, set @code{byte-compile-error-on-warn} to a
488non-@code{nil} value. 488non-@code{nil} value.
489 489
490@node Byte-Code Objects 490@node Closure Objects
491@section Byte-Code Function Objects 491@section Closure Function Objects
492@cindex compiled function 492@cindex compiled function
493@cindex byte-code function 493@cindex byte-code function
494@cindex byte-code object 494@cindex byte-code object
495 495
496 Byte-compiled functions have a special data type: they are 496 Byte-compiled functions use a special data type: they are closures.
497@dfn{byte-code function objects}. Whenever such an object appears as 497Closures are used both for byte-compiled Lisp functions as well as for
498a function to be called, Emacs uses the byte-code interpreter to 498interpreted Lisp functions. Whenever such an object appears as
499execute the byte-code. 499a function to be called, Emacs uses the appropriate interpreter to
500execute either the byte-code or the non-compiled Lisp code.
500 501
501 Internally, a byte-code function object is much like a vector; its 502 Internally, a closure is much like a vector; its
502elements can be accessed using @code{aref}. Its printed 503elements can be accessed using @code{aref}. Its printed
503representation is like that for a vector, with an additional @samp{#} 504representation is like that for a vector, with an additional @samp{#}
504before the opening @samp{[}. It must have at least four elements; 505before the opening @samp{[}. It must have at least three elements;
505there is no maximum number, but only the first six elements have any 506there is no maximum number, but only the first six elements have any
506normal use. They are: 507normal use. They are:
507 508
@@ -515,20 +516,28 @@ zero to 6, and the maximum number of arguments in bits 8 to 14. If
515the argument list uses @code{&rest}, then bit 7 is set; otherwise it's 516the argument list uses @code{&rest}, then bit 7 is set; otherwise it's
516cleared. 517cleared.
517 518
518If @var{argdesc} is a list, the arguments will be dynamically bound 519When the closure is a byte-code function,
520if @var{argdesc} is a list, the arguments will be dynamically bound
519before executing the byte code. If @var{argdesc} is an integer, the 521before executing the byte code. If @var{argdesc} is an integer, the
520arguments will be instead pushed onto the stack of the byte-code 522arguments will be instead pushed onto the stack of the byte-code
521interpreter, before executing the code. 523interpreter, before executing the code.
522 524
523@item byte-code 525@item code
524The string containing the byte-code instructions. 526For interpreted functions, this element is the (non-empty) list of Lisp
527forms that make up the function's body. For byte-compiled functions, it
528is the string containing the byte-code instructions.
525 529
526@item constants 530@item constants
527The vector of Lisp objects referenced by the byte code. These include 531For byte-compiled functions, this holds the vector of Lisp objects
528symbols used as function names and variable names. 532referenced by the byte code. These include symbols used as function
533names and variable names.
534For interpreted functions, this is @code{nil} if the function is using the old
535dynamically scoped dialect of Emacs Lisp, and otherwise it holds the
536function's lexical environment.
529 537
530@item stacksize 538@item stacksize
531The maximum stack size this function needs. 539The maximum stack size this function needs. This element is left unused
540for interpreted functions.
532 541
533@item docstring 542@item docstring
534The documentation string (if any); otherwise, @code{nil}. The value may 543The documentation string (if any); otherwise, @code{nil}. The value may
@@ -558,8 +567,8 @@ representation. It is the definition of the command
558@code{make-byte-code}: 567@code{make-byte-code}:
559 568
560@defun make-byte-code &rest elements 569@defun make-byte-code &rest elements
561This function constructs and returns a byte-code function object 570This function constructs and returns a closure which represents the
562with @var{elements} as its elements. 571byte-code function object with @var{elements} as its elements.
563@end defun 572@end defun
564 573
565 You should not try to come up with the elements for a byte-code 574 You should not try to come up with the elements for a byte-code
@@ -567,6 +576,20 @@ function yourself, because if they are inconsistent, Emacs may crash
567when you call the function. Always leave it to the byte compiler to 576when you call the function. Always leave it to the byte compiler to
568create these objects; it makes the elements consistent (we hope). 577create these objects; it makes the elements consistent (we hope).
569 578
579The primitive way to create an interpreted function is with
580@code{make-interpreted-closure}:
581
582@defun make-interpreted-closure args body env &optional docstring iform
583This function constructs and returns a closure representing the
584interpreted function with arguments @var{args} and whose body is made of
585@var{body} which must be a non-@code{nil} list of Lisp forms. @var{env} is the
586lexical environment in the same form as used with @code{eval}
587(@pxref{Eval}). The documentation @var{docstring} if non-@code{nil} should be
588a string, and the interactive form @var{iform} if non-@code{nil} should be of
589the form @w{@code{(interactive @var{arg-descriptor})}} (@pxref{Using
590Interactive}).
591@end defun
592
570@node Disassembly 593@node Disassembly
571@section Disassembled Byte-Code 594@section Disassembled Byte-Code
572@cindex disassembled byte-code 595@cindex disassembled byte-code
@@ -595,7 +618,7 @@ name of an existing buffer. Then the output goes there, at point, and
595point is left before the output. 618point is left before the output.
596 619
597The argument @var{object} can be a function name, a lambda expression 620The argument @var{object} can be a function name, a lambda expression
598(@pxref{Lambda Expressions}), or a byte-code object (@pxref{Byte-Code 621(@pxref{Lambda Expressions}), or a byte-code object (@pxref{Closure
599Objects}). If it is a lambda expression, @code{disassemble} compiles 622Objects}). If it is a lambda expression, @code{disassemble} compiles
600it and disassembles the resulting compiled code. 623it and disassembles the resulting compiled code.
601@end deffn 624@end deffn
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index f9f3389c398..46024e2fdee 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -2411,7 +2411,7 @@ point where we signaled the original error:
2411@group 2411@group
2412Debugger entered--Lisp error: (error "Oops") 2412Debugger entered--Lisp error: (error "Oops")
2413 signal(error ("Oops")) 2413 signal(error ("Oops"))
2414 (closure (t) (err) (signal 'error (cdr err)))((user-error "Oops")) 2414 #f(lambda (err) [t] (signal 'error (cdr err)))((user-error "Oops"))
2415 user-error("Oops") 2415 user-error("Oops")
2416 @dots{} 2416 @dots{}
2417 eval((handler-bind ((user-error (lambda (err) @dots{} 2417 eval((handler-bind ((user-error (lambda (err) @dots{}
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index ec93a0b9c8a..339272d1f05 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -323,7 +323,7 @@ Programming Types
323* Macro Type:: A method of expanding an expression into another 323* Macro Type:: A method of expanding an expression into another
324 expression, more fundamental but less pretty. 324 expression, more fundamental but less pretty.
325* Primitive Function Type:: A function written in C, callable from Lisp. 325* Primitive Function Type:: A function written in C, callable from Lisp.
326* Byte-Code Type:: A function written in Lisp, then compiled. 326* Closure Type:: A function written in Lisp, then compiled.
327* Record Type:: Compound objects with programmer-defined types. 327* Record Type:: Compound objects with programmer-defined types.
328* Type Descriptors:: Objects holding information about types. 328* Type Descriptors:: Objects holding information about types.
329* Autoload Type:: A type used for automatically loading seldom-used 329* Autoload Type:: A type used for automatically loading seldom-used
@@ -657,7 +657,7 @@ Byte Compilation
657* Docs and Compilation:: Dynamic loading of documentation strings. 657* Docs and Compilation:: Dynamic loading of documentation strings.
658* Eval During Compile:: Code to be evaluated when you compile. 658* Eval During Compile:: Code to be evaluated when you compile.
659* Compiler Errors:: Handling compiler error messages. 659* Compiler Errors:: Handling compiler error messages.
660* Byte-Code Objects:: The data type used for byte-compiled functions. 660* Closure Objects:: The data type used for byte-compiled functions.
661* Disassembly:: Disassembling byte-code; how to read byte-code. 661* Disassembly:: Disassembling byte-code; how to read byte-code.
662 662
663Native Compilation 663Native Compilation
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index ff635fc54b2..c57de08460f 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -130,7 +130,7 @@ it also encloses an environment of lexical variable bindings.
130 130
131@item byte-code function 131@item byte-code function
132A function that has been compiled by the byte compiler. 132A function that has been compiled by the byte compiler.
133@xref{Byte-Code Type}. 133@xref{Closure Type}.
134 134
135@item autoload object 135@item autoload object
136@cindex autoload object 136@cindex autoload object
@@ -227,6 +227,16 @@ Compilation}), or natively-compiled (@pxref{Native Compilation}), or
227a function loaded from a dynamic module (@pxref{Dynamic Modules}). 227a function loaded from a dynamic module (@pxref{Dynamic Modules}).
228@end defun 228@end defun
229 229
230@defun interpreted-function-p object
231This function returns @code{t} if @var{object} is an interpreted function.
232@end defun
233
234@defun closurep object
235This function returns @code{t} if @var{object} is a closure, which is
236a particular kind of function object. Currently closures are used
237for all byte-code functions and all interpreted functions.
238@end defun
239
230@defun subr-arity subr 240@defun subr-arity subr
231This works like @code{func-arity}, but only for built-in functions and 241This works like @code{func-arity}, but only for built-in functions and
232without symbol indirection. It signals an error for non-built-in 242without symbol indirection. It signals an error for non-built-in
@@ -1136,8 +1146,7 @@ Functions}). @xref{describe-symbols example}, for a realistic example
1136of this. 1146of this.
1137 1147
1138 When defining a lambda expression that is to be used as an anonymous 1148 When defining a lambda expression that is to be used as an anonymous
1139function, you can in principle use any method to construct the list. 1149function, you should use the @code{lambda} macro, or the
1140But typically you should use the @code{lambda} macro, or the
1141@code{function} special form, or the @code{#'} read syntax: 1150@code{function} special form, or the @code{#'} read syntax:
1142 1151
1143@defmac lambda args [doc] [interactive] body@dots{} 1152@defmac lambda args [doc] [interactive] body@dots{}
@@ -1145,17 +1154,18 @@ This macro returns an anonymous function with argument list
1145@var{args}, documentation string @var{doc} (if any), interactive spec 1154@var{args}, documentation string @var{doc} (if any), interactive spec
1146@var{interactive} (if any), and body forms given by @var{body}. 1155@var{interactive} (if any), and body forms given by @var{body}.
1147 1156
1148Under dynamic binding, this macro effectively makes @code{lambda} 1157For example, this macro makes @code{lambda} forms almost self-quoting:
1149forms self-quoting: evaluating a form whose @sc{car} is @code{lambda} 1158evaluating a form whose @sc{car} is @code{lambda} yields a value that is
1150yields the form itself: 1159almost like the form itself:
1151 1160
1152@example 1161@example
1153(lambda (x) (* x x)) 1162(lambda (x) (* x x))
1154 @result{} (lambda (x) (* x x)) 1163 @result{} #f(lambda (x) :dynbind (* x x))
1155@end example 1164@end example
1156 1165
1157Note that when evaluating under lexical binding the result is a 1166When evaluating under lexical binding the result is a similar
1158closure object (@pxref{Closures}). 1167closure object, where the @code{:dynbind} marker is replaced by the
1168captured variables (@pxref{Closures}).
1159 1169
1160The @code{lambda} form has one other effect: it tells the Emacs 1170The @code{lambda} form has one other effect: it tells the Emacs
1161evaluator and byte-compiler that its argument is a function, by using 1171evaluator and byte-compiler that its argument is a function, by using
@@ -1164,8 +1174,8 @@ evaluator and byte-compiler that its argument is a function, by using
1164 1174
1165@defspec function function-object 1175@defspec function function-object
1166@cindex function quoting 1176@cindex function quoting
1167This special form returns @var{function-object} without evaluating it. 1177This special form returns the function value of the @var{function-object}.
1168In this, it is similar to @code{quote} (@pxref{Quoting}). But unlike 1178In many ways, it is similar to @code{quote} (@pxref{Quoting}). But unlike
1169@code{quote}, it also serves as a note to the Emacs evaluator and 1179@code{quote}, it also serves as a note to the Emacs evaluator and
1170byte-compiler that @var{function-object} is intended to be used as a 1180byte-compiler that @var{function-object} is intended to be used as a
1171function. Assuming @var{function-object} is a valid lambda 1181function. Assuming @var{function-object} is a valid lambda
@@ -1495,7 +1505,7 @@ distinguish between a function cell that is void and one set to
1495@group 1505@group
1496(defun bar (n) (+ n 2)) 1506(defun bar (n) (+ n 2))
1497(symbol-function 'bar) 1507(symbol-function 'bar)
1498 @result{} (lambda (n) (+ n 2)) 1508 @result{} #f(lambda (n) [t] (+ n 2))
1499@end group 1509@end group
1500@group 1510@group
1501(fset 'baz 'bar) 1511(fset 'baz 'bar)
@@ -1608,7 +1618,7 @@ argument list and body forms as the remaining elements:
1608@example 1618@example
1609;; @r{lexical binding is enabled.} 1619;; @r{lexical binding is enabled.}
1610(lambda (x) (* x x)) 1620(lambda (x) (* x x))
1611 @result{} (closure (t) (x) (* x x)) 1621 @result{} #f(lambda (x) [t] (* x x))
1612@end example 1622@end example
1613 1623
1614@noindent 1624@noindent
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index 1409e51c0d4..06472539744 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -1249,7 +1249,7 @@ this is not guaranteed to happen):
1249 1249
1250@group 1250@group
1251(symbol-function 'add-foo) 1251(symbol-function 'add-foo)
1252 @result{} (lambda (x) (nconc '(foo) x)) 1252 @result{} #f(lambda (x) [t] (nconc '(foo) x))
1253@end group 1253@end group
1254 1254
1255@group 1255@group
@@ -1267,7 +1267,7 @@ this is not guaranteed to happen):
1267 1267
1268@group 1268@group
1269(symbol-function 'add-foo) 1269(symbol-function 'add-foo)
1270 @result{} (lambda (x) (nconc '(foo 1 2 3 4) x)) 1270 @result{} #f(lambda (x) [t] (nconc '(foo 1 2 3 4) x))
1271@end group 1271@end group
1272@end smallexample 1272@end smallexample
1273@end defun 1273@end defun
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi
index aa1e073042f..cf703aba9c8 100644
--- a/doc/lispref/objects.texi
+++ b/doc/lispref/objects.texi
@@ -244,7 +244,7 @@ latter are unique to Emacs Lisp.
244* Macro Type:: A method of expanding an expression into another 244* Macro Type:: A method of expanding an expression into another
245 expression, more fundamental but less pretty. 245 expression, more fundamental but less pretty.
246* Primitive Function Type:: A function written in C, callable from Lisp. 246* Primitive Function Type:: A function written in C, callable from Lisp.
247* Byte-Code Type:: A function written in Lisp, then compiled. 247* Closure Type:: A function written in Lisp.
248* Record Type:: Compound objects with programmer-defined types. 248* Record Type:: Compound objects with programmer-defined types.
249* Type Descriptors:: Objects holding information about types. 249* Type Descriptors:: Objects holding information about types.
250* Autoload Type:: A type used for automatically loading seldom-used 250* Autoload Type:: A type used for automatically loading seldom-used
@@ -1458,18 +1458,24 @@ with the name of the subroutine.
1458@end group 1458@end group
1459@end example 1459@end example
1460 1460
1461@node Byte-Code Type 1461@node Closure Type
1462@subsection Byte-Code Function Type 1462@subsection Closure Function Type
1463 1463
1464@dfn{Byte-code function objects} are produced by byte-compiling Lisp 1464@dfn{Closures} are function objects produced when turning a function
1465code (@pxref{Byte Compilation}). Internally, a byte-code function 1465definition into a function value. Closures are used both for
1466object is much like a vector; however, the evaluator handles this data 1466byte-compiled Lisp functions as well as for interpreted Lisp functions.
1467type specially when it appears in a function call. @xref{Byte-Code 1467Closures can be produced by byte-compiling Lisp code (@pxref{Byte
1468Objects}. 1468Compilation}) or simply by evaluating a lambda expression without
1469compiling it, resulting in an interpreted function. Internally,
1470a closure is much like a vector; however, the evaluator
1471handles this data type specially when it appears in a function call.
1472@xref{Closure Objects}.
1469 1473
1470The printed representation and read syntax for a byte-code function 1474The printed representation and read syntax for a byte-code function
1471object is like that for a vector, with an additional @samp{#} before the 1475object is like that for a vector, with an additional @samp{#} before the
1472opening @samp{[}. 1476opening @samp{[}. When printed for human consumption, it is printed as
1477a special kind of list with an additional @samp{#f} before the opening
1478@samp{(}.
1473 1479
1474@node Record Type 1480@node Record Type
1475@subsection Record Type 1481@subsection Record Type
@@ -2042,10 +2048,7 @@ with references to further information.
2042@xref{Buffer Basics, bufferp}. 2048@xref{Buffer Basics, bufferp}.
2043 2049
2044@item byte-code-function-p 2050@item byte-code-function-p
2045@xref{Byte-Code Type, byte-code-function-p}. 2051@xref{Closure Type, byte-code-function-p}.
2046
2047@item compiled-function-p
2048@xref{Byte-Code Type, compiled-function-p}.
2049 2052
2050@item case-table-p 2053@item case-table-p
2051@xref{Case Tables, case-table-p}. 2054@xref{Case Tables, case-table-p}.
@@ -2056,9 +2059,15 @@ with references to further information.
2056@item char-table-p 2059@item char-table-p
2057@xref{Char-Tables, char-table-p}. 2060@xref{Char-Tables, char-table-p}.
2058 2061
2062@item closurep
2063@xref{What Is a Function, closurep}.
2064
2059@item commandp 2065@item commandp
2060@xref{Interactive Call, commandp}. 2066@xref{Interactive Call, commandp}.
2061 2067
2068@item compiled-function-p
2069@xref{Closure Type, compiled-function-p}.
2070
2062@item condition-variable-p 2071@item condition-variable-p
2063@xref{Condition Variables, condition-variable-p}. 2072@xref{Condition Variables, condition-variable-p}.
2064 2073
@@ -2098,6 +2107,9 @@ with references to further information.
2098@item integerp 2107@item integerp
2099@xref{Predicates on Numbers, integerp}. 2108@xref{Predicates on Numbers, integerp}.
2100 2109
2110@item interpreted-function-p
2111@xref{What Is a Function, interpreted-function-p}.
2112
2101@item keymapp 2113@item keymapp
2102@xref{Creating Keymaps, keymapp}. 2114@xref{Creating Keymaps, keymapp}.
2103 2115
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index c9e47624878..4c5525f10c5 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -1583,7 +1583,7 @@ nonempty vector that is not @code{eq} to any existing vector.
1583 1583
1584The @code{vconcat} function also allows byte-code function objects as 1584The @code{vconcat} function also allows byte-code function objects as
1585arguments. This is a special feature to make it easy to access the entire 1585arguments. This is a special feature to make it easy to access the entire
1586contents of a byte-code function object. @xref{Byte-Code Objects}. 1586contents of a byte-code function object. @xref{Closure Objects}.
1587 1587
1588For other concatenation functions, see @code{mapconcat} in @ref{Mapping 1588For other concatenation functions, see @code{mapconcat} in @ref{Mapping
1589Functions}, @code{concat} in @ref{Creating Strings}, and @code{append} 1589Functions}, @code{concat} in @ref{Creating Strings}, and @code{append}
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index 4d61d461deb..16b6b52e5f1 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -1079,7 +1079,7 @@ Here is an example:
1079(let ((x 0)) ; @r{@code{x} is lexically bound.} 1079(let ((x 0)) ; @r{@code{x} is lexically bound.}
1080 (setq my-ticker (lambda () 1080 (setq my-ticker (lambda ()
1081 (setq x (1+ x))))) 1081 (setq x (1+ x)))))
1082 @result{} (closure ((x . 0)) () 1082 @result{} #f(lambda () [(x 0)]
1083 (setq x (1+ x))) 1083 (setq x (1+ x)))
1084 1084
1085(funcall my-ticker) 1085(funcall my-ticker)