<feed xmlns='http://www.w3.org/2005/Atom'>
<title>emacs/src, branch scratch/interpreted-function</title>
<subtitle>Emacs is the extensible, customizable, self-documenting real-time display editor. 
</subtitle>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/'/>
<entry>
<title>Use a dedicated type to represent interpreted-function values</title>
<updated>2024-04-18T19:28:36+00:00</updated>
<author>
<name>Stefan Monnier</name>
</author>
<published>2024-03-11T20:12:26+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=126be02077520a943252d0d219bb7677466d0168'/>
<id>126be02077520a943252d0d219bb7677466d0168</id>
<content type='text'>
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) &lt;interpreted-function&gt;:
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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) &lt;interpreted-function&gt;:
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>(COMPILED): Rename to CLOSURE</title>
<updated>2024-04-18T16:29:58+00:00</updated>
<author>
<name>Stefan Monnier</name>
</author>
<published>2024-03-24T22:32:25+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=7842af6095db4384898725fb4a14ebaa11379a34'/>
<id>7842af6095db4384898725fb4a14ebaa11379a34</id>
<content type='text'>
In preparation for the use of `PVEC_COMPILED` objects for
interpreted functions, rename them to use a more neutral name.

* src/lisp.h (enum pvec_type): Rename `PVEC_COMPILED` to `PVEC_CLOSURE`.
(enum Lisp_Compiled): Use `CLOSURE_` prefix i.s.o `COMPILED_`.
Also use `CODE` rather than `BYTECODE`.
(CLOSUREP): Rename from `COMPILEDP`.
(enum Lisp_Closure): Rename from `Lisp_Compiled`.

* src/alloc.c, src/bytecode.c, src/comp.c, src/data.c, src/eval.c,
* src/fns.c, src/lisp.h, src/lread.c, src/pdumper.c, src/print.c,
* src/profiler.c: Rename all uses accordingly.
* src/.gdbinit (xclosure): Rename from `xcompiled`.
(xcompiled): New obsolete alias.
(xpr): Adjust accordingly.  Also adjust to new PVEC_CLOSURE tag name.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In preparation for the use of `PVEC_COMPILED` objects for
interpreted functions, rename them to use a more neutral name.

* src/lisp.h (enum pvec_type): Rename `PVEC_COMPILED` to `PVEC_CLOSURE`.
(enum Lisp_Compiled): Use `CLOSURE_` prefix i.s.o `COMPILED_`.
Also use `CODE` rather than `BYTECODE`.
(CLOSUREP): Rename from `COMPILEDP`.
(enum Lisp_Closure): Rename from `Lisp_Compiled`.

* src/alloc.c, src/bytecode.c, src/comp.c, src/data.c, src/eval.c,
* src/fns.c, src/lisp.h, src/lread.c, src/pdumper.c, src/print.c,
* src/profiler.c: Rename all uses accordingly.
* src/.gdbinit (xclosure): Rename from `xcompiled`.
(xcompiled): New obsolete alias.
(xpr): Adjust accordingly.  Also adjust to new PVEC_CLOSURE tag name.
</pre>
</div>
</content>
</entry>
<entry>
<title>Ensure that specbind arg is always bare symbol, and drop check</title>
<updated>2024-04-18T11:55:47+00:00</updated>
<author>
<name>Mattias Engdegård</name>
</author>
<published>2024-04-18T10:59:35+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=0a57dfcff8d0abcf4427cfbfd886264bb3b8eaab'/>
<id>0a57dfcff8d0abcf4427cfbfd886264bb3b8eaab</id>
<content type='text'>
* src/eval.c (FletX, Flet, internal_lisp_condition_case)
(funcall_lambda): Ensure that the first argument to `specbind` is
a bare symbol in the few cases where this isn't statically guaranteed.
(specbind): Drop the symbol argument type check on the fast path.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/eval.c (FletX, Flet, internal_lisp_condition_case)
(funcall_lambda): Ensure that the first argument to `specbind` is
a bare symbol in the few cases where this isn't statically guaranteed.
(specbind): Drop the symbol argument type check on the fast path.
</pre>
</div>
</content>
</entry>
<entry>
<title>Drop unnecessary type check in varref and varset byte ops</title>
<updated>2024-04-18T11:55:47+00:00</updated>
<author>
<name>Mattias Engdegård</name>
</author>
<published>2024-04-18T10:26:10+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=dba115d6bcbc955858526740254bd9a169830d7e'/>
<id>dba115d6bcbc955858526740254bd9a169830d7e</id>
<content type='text'>
* src/bytecode.c (exec_byte_code):
We can safely assume that the immediate argument to varref and varset
is a bare symbol; the byte-compiler should guarantee that.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/bytecode.c (exec_byte_code):
We can safely assume that the immediate argument to varref and varset
is a bare symbol; the byte-compiler should guarantee that.
</pre>
</div>
</content>
</entry>
<entry>
<title>Another fix for bug#70385</title>
<updated>2024-04-17T11:50:38+00:00</updated>
<author>
<name>Eli Zaretskii</name>
</author>
<published>2024-04-17T11:50:38+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=42b3024ca8e2d844084d2e8c78f58f530e1b18b3'/>
<id>42b3024ca8e2d844084d2e8c78f58f530e1b18b3</id>
<content type='text'>
* src/xdisp.c (note_fringe_highlight): Check value of x_y_to_hpos_vpos.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/xdisp.c (note_fringe_highlight): Check value of x_y_to_hpos_vpos.
</pre>
</div>
</content>
</entry>
<entry>
<title>; * src/xdisp.c (redisplay_internal): Typo fix in comment</title>
<updated>2024-04-17T07:04:18+00:00</updated>
<author>
<name>Robert Pluim</name>
</author>
<published>2024-04-17T07:04:18+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=1606e14c6f1fb5c524dd21ac1b1187b5230f683e'/>
<id>1606e14c6f1fb5c524dd21ac1b1187b5230f683e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>* src/xdisp.c (note_fringe_highlight): Another attempt to fix bug#70385.</title>
<updated>2024-04-16T18:23:37+00:00</updated>
<author>
<name>Eli Zaretskii</name>
</author>
<published>2024-04-16T18:23:37+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=d39f0a165a7f87336990e3304f1a8fa455a61600'/>
<id>d39f0a165a7f87336990e3304f1a8fa455a61600</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Minor fix in detecting recursive redisplay invocations</title>
<updated>2024-04-16T12:12:42+00:00</updated>
<author>
<name>Eli Zaretskii</name>
</author>
<published>2024-04-16T12:12:42+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=1be21dd95388037cfb71474a1fbd2a7d3583a80a'/>
<id>1be21dd95388037cfb71474a1fbd2a7d3583a80a</id>
<content type='text'>
* src/xdisp.c (redisplay_internal): Detect recursive invocations
earlier.  (Bug#66416)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/xdisp.c (redisplay_internal): Detect recursive invocations
earlier.  (Bug#66416)
</pre>
</div>
</content>
</entry>
<entry>
<title>Another fix for bug#70385</title>
<updated>2024-04-16T07:40:13+00:00</updated>
<author>
<name>Po Lu</name>
</author>
<published>2024-04-16T06:54:32+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=c59e67a41c512467a54cc92ed0fdb6c3b9e9ace8'/>
<id>c59e67a41c512467a54cc92ed0fdb6c3b9e9ace8</id>
<content type='text'>
* src/xdisp.c (note_fringe_highlight): Test that vpos falls
within W-&gt;current_matrix.  (bug#70385)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/xdisp.c (note_fringe_highlight): Test that vpos falls
within W-&gt;current_matrix.  (bug#70385)
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix resetting the frame's 'frozen_window_starts' flag</title>
<updated>2024-04-15T13:50:59+00:00</updated>
<author>
<name>Eli Zaretskii</name>
</author>
<published>2024-04-15T13:50:59+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=9b755244bf0b9cd5f820ae45a4db14913a587c7b'/>
<id>9b755244bf0b9cd5f820ae45a4db14913a587c7b</id>
<content type='text'>
* src/window.c (grow_mini_window, shrink_mini_window): Reimplement
how the frame's 'frozen_window_starts' flag is set and reset, to
make sure it is always reset when the mini-window gets to its
normal one-line height.  Patch by Martin Rudalics
&lt;rudalics@gmx.at&gt; (Bug#70038)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/window.c (grow_mini_window, shrink_mini_window): Reimplement
how the frame's 'frozen_window_starts' flag is set and reset, to
make sure it is always reset when the mini-window gets to its
normal one-line height.  Patch by Martin Rudalics
&lt;rudalics@gmx.at&gt; (Bug#70038)
</pre>
</div>
</content>
</entry>
</feed>
