<feed xmlns='http://www.w3.org/2005/Atom'>
<title>emacs, branch scratch/handler-bind-2</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 new error representaiton in ERT</title>
<updated>2024-01-02T15:33:12+00:00</updated>
<author>
<name>João Távora</name>
</author>
<published>2024-01-02T15:33:12+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=4ab7a95b24b733a7ae6eec90fc296e66b053d87d'/>
<id>4ab7a95b24b733a7ae6eec90fc296e66b053d87d</id>
<content type='text'>
* lisp/emacs-lisp/ert.el (ert--run-test-debugger): Use new error
representation.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* lisp/emacs-lisp/ert.el (ert--run-test-debugger): Use new error
representation.
</pre>
</div>
</content>
</entry>
<entry>
<title>Call debug-early with new error representation</title>
<updated>2024-01-02T13:08:02+00:00</updated>
<author>
<name>João Távora</name>
</author>
<published>2024-01-02T13:00:53+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=ca7fd891476c27b2cf96bacb0e0963e64babc218'/>
<id>ca7fd891476c27b2cf96bacb0e0963e64babc218</id>
<content type='text'>
* lisp/emacs-lisp/debug-early.el (debug--early): Let debug--early
called from C know about the new representation.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* lisp/emacs-lisp/debug-early.el (debug--early): Let debug--early
called from C know about the new representation.
</pre>
</div>
</content>
</entry>
<entry>
<title>Better .clangd</title>
<updated>2024-01-02T11:48:04+00:00</updated>
<author>
<name>João Távora</name>
</author>
<published>2024-01-02T11:48:04+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=2986854bc09c5de8e28e18f8c009731efbd476d4'/>
<id>2986854bc09c5de8e28e18f8c009731efbd476d4</id>
<content type='text'>
* .clangd (CompileFlags): Always remove -fstruct-flex-*
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* .clangd (CompileFlags): Always remove -fstruct-flex-*
</pre>
</div>
</content>
</entry>
<entry>
<title>Introduce handler-case (bug#68075)</title>
<updated>2024-01-01T23:54:39+00:00</updated>
<author>
<name>João Távora</name>
</author>
<published>2023-12-31T14:22:10+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=15305a8f4d50ec48f0d1a0783f89760104ca0911'/>
<id>15305a8f4d50ec48f0d1a0783f89760104ca0911</id>
<content type='text'>
* lisp/subr.el (handler-case): New macro.

* lisp/emacs-lisp/bytecomp.el (bytecomp--displaying-warnings): Use
handler-case.

* test/src/eval-tests.el (eval-tests--handler-bind): Use
handler-case, not condition-case.

* lisp/subr.el (handler-case): Don't use pcase-lambda
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* lisp/subr.el (handler-case): New macro.

* lisp/emacs-lisp/bytecomp.el (bytecomp--displaying-warnings): Use
handler-case.

* test/src/eval-tests.el (eval-tests--handler-bind): Use
handler-case, not condition-case.

* lisp/subr.el (handler-case): Don't use pcase-lambda
</pre>
</div>
</content>
</entry>
<entry>
<title>Experimental record type for all conditions (bug#68075)</title>
<updated>2024-01-01T23:43:35+00:00</updated>
<author>
<name>João Távora</name>
</author>
<published>2024-01-01T22:23:38+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=20098915febff7577d6923ce78b4dce014ca879f'/>
<id>20098915febff7577d6923ce78b4dce014ca879f</id>
<content type='text'>
* src/print.c (Ferror_message_string): Work with cons or with
records.
(print_error_message): Still work with cons errors, but rename
parameter.

* src/eval.c (signal_or_quit): Make a record, not a cons.  Except
in the sub-case of CONDITION_CASE, where a fresh cons is given.
Name this object 'condition', not 'error'.
(skip_debugger): Rename parameter 'data' to 'condition'
(signal_quit_p)
(maybe_call_debugger): Expect record, not cons.
(syms_of_eval): Define symbol Qcondition.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/print.c (Ferror_message_string): Work with cons or with
records.
(print_error_message): Still work with cons errors, but rename
parameter.

* src/eval.c (signal_or_quit): Make a record, not a cons.  Except
in the sub-case of CONDITION_CASE, where a fresh cons is given.
Name this object 'condition', not 'error'.
(skip_debugger): Rename parameter 'data' to 'condition'
(signal_quit_p)
(maybe_call_debugger): Expect record, not cons.
(syms_of_eval): Define symbol Qcondition.
</pre>
</div>
</content>
</entry>
<entry>
<title>(backtrace-on-redisplay-error): Use `handler-bind`</title>
<updated>2023-12-28T06:17:21+00:00</updated>
<author>
<name>Stefan Monnier</name>
</author>
<published>2023-12-26T02:41:08+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=26b7078705ae5b9226c99e370740ab9a4063f20f'/>
<id>26b7078705ae5b9226c99e370740ab9a4063f20f</id>
<content type='text'>
Reimplement `backtrace-on-redisplay-error` using `push_handler_bind`.
This moves the code from `signal_or_quit` to `xdisp.c` and
`debug-early.el`.

* lisp/emacs-lisp/debug-early.el (debug-early-backtrace):
Add `base` arg to strip "internal" frames.
(debug--early): New function, extracted from `debug-early`.
(debug-early, debug-early--handler): Use it.
(debug-early--muted): New function, extracted (translated) from
`signal_or_quit`; trim the buffer to a max of 10 backtraces.

* src/xdisp.c (funcall_with_backtraces): New function.
(dsafe_calln): Use it.
(syms_of_xdisp): Defsym `Qdebug_early__muted`.

* src/eval.c (redisplay_deep_handler): Delete var.
(init_eval, internal_condition_case_n): Don't set it any more.
(backtrace_yet): Delete var.
(signal_or_quit): Remove special case for `backtrace_on_redisplay_error`.
* src/keyboard.c (command_loop_1): Don't set `backtrace_yet` any more.
* src/lisp.h (backtrace_yet): Don't declare.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reimplement `backtrace-on-redisplay-error` using `push_handler_bind`.
This moves the code from `signal_or_quit` to `xdisp.c` and
`debug-early.el`.

* lisp/emacs-lisp/debug-early.el (debug-early-backtrace):
Add `base` arg to strip "internal" frames.
(debug--early): New function, extracted from `debug-early`.
(debug-early, debug-early--handler): Use it.
(debug-early--muted): New function, extracted (translated) from
`signal_or_quit`; trim the buffer to a max of 10 backtraces.

* src/xdisp.c (funcall_with_backtraces): New function.
(dsafe_calln): Use it.
(syms_of_xdisp): Defsym `Qdebug_early__muted`.

* src/eval.c (redisplay_deep_handler): Delete var.
(init_eval, internal_condition_case_n): Don't set it any more.
(backtrace_yet): Delete var.
(signal_or_quit): Remove special case for `backtrace_on_redisplay_error`.
* src/keyboard.c (command_loop_1): Don't set `backtrace_yet` any more.
* src/lisp.h (backtrace_yet): Don't declare.
</pre>
</div>
</content>
</entry>
<entry>
<title>(signal_or_quit): Preserve error object identity</title>
<updated>2023-12-28T06:17:21+00:00</updated>
<author>
<name>Stefan Monnier</name>
</author>
<published>2023-12-27T20:06:32+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=b925152bffce30abbd48361af6858cd45b785d84'/>
<id>b925152bffce30abbd48361af6858cd45b785d84</id>
<content type='text'>
Make sure we build the (ERROR-SYMBOL . ERROR-DATA) object only once
when signaling an error, so that its `eq` identity can be used.
It also gets us a tiny bit closer to having real "error objects"
like in most other current programming languages.

* src/eval.c (maybe_call_debugger): Change arglist to receive the error
object instead of receiving the signal and the data separately.
(signal_or_quit): Build the error object right at the beginning so it
stays `eq` to itself.
Rename the `keyboard_quit` arg to `continuable` so say what it does
rather than what it's used for.
(signal_quit_p): Change arg to be the error object rather than just the
error-symbol.

* src/keyboard.c (cmd_error_internal, menu_item_eval_property_1):
Adjust calls to `signal_quit_p` accordingly.

* test/src/eval-tests.el (eval-tests--error-id): New test.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make sure we build the (ERROR-SYMBOL . ERROR-DATA) object only once
when signaling an error, so that its `eq` identity can be used.
It also gets us a tiny bit closer to having real "error objects"
like in most other current programming languages.

* src/eval.c (maybe_call_debugger): Change arglist to receive the error
object instead of receiving the signal and the data separately.
(signal_or_quit): Build the error object right at the beginning so it
stays `eq` to itself.
Rename the `keyboard_quit` arg to `continuable` so say what it does
rather than what it's used for.
(signal_quit_p): Change arg to be the error object rather than just the
error-symbol.

* src/keyboard.c (cmd_error_internal, menu_item_eval_property_1):
Adjust calls to `signal_quit_p` accordingly.

* test/src/eval-tests.el (eval-tests--error-id): New test.
</pre>
</div>
</content>
</entry>
<entry>
<title>eval.c: Add new var `lisp-eval-depth-reserve`</title>
<updated>2023-12-28T06:16:37+00:00</updated>
<author>
<name>Stefan Monnier</name>
</author>
<published>2023-12-27T04:56:09+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=c89b234405f8fa6c52f83104a46a4a2c3121198f'/>
<id>c89b234405f8fa6c52f83104a46a4a2c3121198f</id>
<content type='text'>
Rather than blindly increase `max-lisp-eval-depth` when entering the
debugger or running `signal-hook-function`, use this new "reserve"
to keep track of how much we have grown the stack for "debugger"
purposes so that for example recursive calls to `signal-hook-function`
can't eat up the whole C stack.

* src/eval.c (max_ensure_room): Rewrite.
(restore_stack_limits): Move before `max_ensure_room`.  Rewrite.
(call_debugger, signal_or_quit): Adjust calls accordingly.
Also grow `max-lisp-eval-depth` for `hander-bind` handlers.
(init_eval_once): Don't initialize `max_lisp_eval_depth` here.
(syms_of_eval): Initialize it here instead.
Add new var `lisp-eval-depth-reserve`.

* doc/lispref/eval.texi (Eval): Add `lisp-eval-depth-reserve`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Rather than blindly increase `max-lisp-eval-depth` when entering the
debugger or running `signal-hook-function`, use this new "reserve"
to keep track of how much we have grown the stack for "debugger"
purposes so that for example recursive calls to `signal-hook-function`
can't eat up the whole C stack.

* src/eval.c (max_ensure_room): Rewrite.
(restore_stack_limits): Move before `max_ensure_room`.  Rewrite.
(call_debugger, signal_or_quit): Adjust calls accordingly.
Also grow `max-lisp-eval-depth` for `hander-bind` handlers.
(init_eval_once): Don't initialize `max_lisp_eval_depth` here.
(syms_of_eval): Initialize it here instead.
Add new var `lisp-eval-depth-reserve`.

* doc/lispref/eval.texi (Eval): Add `lisp-eval-depth-reserve`.
</pre>
</div>
</content>
</entry>
<entry>
<title>(macroexp--with-extended-form-stack): Use plain `let`</title>
<updated>2023-12-28T05:59:54+00:00</updated>
<author>
<name>Stefan Monnier</name>
</author>
<published>2023-12-26T04:55:53+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=634bf61947606d1b8344ba090fdd0fc098fb5eb6'/>
<id>634bf61947606d1b8344ba090fdd0fc098fb5eb6</id>
<content type='text'>
`macroexp--with-extended-form-stack` used manual push/pop so that upon
non-local exits the "deeper" value is kept, so the error handler gets
to know what was the deeper value, so as to be able to compute more
precise error locations.
Replace this with a `handler-bind` which catches that "deeper" value
more explicitly.

* lisp/emacs-lisp/bytecomp.el (bytecomp--displaying-warnings):
Use `handler-bind` to catch the value of `byte-compile-form-stack`
at the time of the error.  Also consolidate the duplicated code.

* lisp/emacs-lisp/macroexp.el (macroexp--with-extended-form-stack):
Use a plain dynbound let-rebinding.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`macroexp--with-extended-form-stack` used manual push/pop so that upon
non-local exits the "deeper" value is kept, so the error handler gets
to know what was the deeper value, so as to be able to compute more
precise error locations.
Replace this with a `handler-bind` which catches that "deeper" value
more explicitly.

* lisp/emacs-lisp/bytecomp.el (bytecomp--displaying-warnings):
Use `handler-bind` to catch the value of `byte-compile-form-stack`
at the time of the error.  Also consolidate the duplicated code.

* lisp/emacs-lisp/macroexp.el (macroexp--with-extended-form-stack):
Use a plain dynbound let-rebinding.
</pre>
</div>
</content>
</entry>
<entry>
<title>Move batch backtrace code to `top_level_2`</title>
<updated>2023-12-28T05:59:54+00:00</updated>
<author>
<name>Stefan Monnier</name>
</author>
<published>2023-12-21T04:31:39+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=6a57b9151b149a445daecc211d8f58010e605768'/>
<id>6a57b9151b149a445daecc211d8f58010e605768</id>
<content type='text'>
Move ad-hoc code meant to ease debugging of bootstrap (and batch mode)
to `top_level_2` so it doesn't pollute `signal_or_quit`.

* src/lisp.h (pop_handler, push_handler_bind): Declare.
* src/keyboard.c (top_level_2): Setup an error handler to call
`debug-early` when noninteractive.
* src/eval.c (pop_handler): Not static any more.
(signal_or_quit): Remove special case for noninteractive use.
(push_handler_bind): New function, extracted from `Fhandler_bind_1`.
(Fhandler_bind_1): Use it.
(syms_of_eval): Declare `Qdebug_early__handler`.
* lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Weed out
frames below `debug-early`.
(debug-early--handler): New function.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move ad-hoc code meant to ease debugging of bootstrap (and batch mode)
to `top_level_2` so it doesn't pollute `signal_or_quit`.

* src/lisp.h (pop_handler, push_handler_bind): Declare.
* src/keyboard.c (top_level_2): Setup an error handler to call
`debug-early` when noninteractive.
* src/eval.c (pop_handler): Not static any more.
(signal_or_quit): Remove special case for noninteractive use.
(push_handler_bind): New function, extracted from `Fhandler_bind_1`.
(Fhandler_bind_1): Use it.
(syms_of_eval): Declare `Qdebug_early__handler`.
* lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Weed out
frames below `debug-early`.
(debug-early--handler): New function.
</pre>
</div>
</content>
</entry>
</feed>
