<feed xmlns='http://www.w3.org/2005/Atom'>
<title>emacs/lisp, branch scratch/handler-bind</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>(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>(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>
<entry>
<title>startup.el: Use `handler-bind` to implement `--debug-init`</title>
<updated>2023-12-28T05:59:54+00:00</updated>
<author>
<name>Stefan Monnier</name>
</author>
<published>2023-12-20T00:46:47+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=917596160c1c831b3a41b320a0e357e5161cb4c8'/>
<id>917596160c1c831b3a41b320a0e357e5161cb4c8</id>
<content type='text'>
This provides a more reliable fix for bug#65267 since we don't
touch `debug-on-error` nor `debug-ignore-errors` any more.

* lisp/startup.el (startup--debug): New function.
(startup--load-user-init-file): Use it and `handler-bind` instead of
let-binding `debug-on-error`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This provides a more reliable fix for bug#65267 since we don't
touch `debug-on-error` nor `debug-ignore-errors` any more.

* lisp/startup.el (startup--debug): New function.
(startup--load-user-init-file): Use it and `handler-bind` instead of
let-binding `debug-on-error`.
</pre>
</div>
</content>
</entry>
<entry>
<title>ert.el: Use `handler-bind` to record backtraces</title>
<updated>2023-12-28T05:59:45+00:00</updated>
<author>
<name>Stefan Monnier</name>
</author>
<published>2023-12-19T04:57:45+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=ae21819496a7f003c4d4e185204533660197daaa'/>
<id>ae21819496a7f003c4d4e185204533660197daaa</id>
<content type='text'>
* lisp/emacs-lisp/ert.el (ert--should-signal-hook): Delete function.
(ert--expand-should-1): Don't bind `signal-hook-function`.
(ert--test-execution-info): Remove `next-debugger` slot.
(ert--run-test-debugger): Adjust to new calling convention.
Pass the `:backtrace-base` info to the debugger.
(ert--run-test-internal): Use `handler-bind` rather than let-binding
`debugger` and `debug-on-error`.

* lisp/emacs-lisp/ert-x.el (ert-remote-temporary-file-directory): Don't
use `defconst` if it's not meant to stay constant (e.g. we let-bind it
in tramp-tests.el).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* lisp/emacs-lisp/ert.el (ert--should-signal-hook): Delete function.
(ert--expand-should-1): Don't bind `signal-hook-function`.
(ert--test-execution-info): Remove `next-debugger` slot.
(ert--run-test-debugger): Adjust to new calling convention.
Pass the `:backtrace-base` info to the debugger.
(ert--run-test-internal): Use `handler-bind` rather than let-binding
`debugger` and `debug-on-error`.

* lisp/emacs-lisp/ert-x.el (ert-remote-temporary-file-directory): Don't
use `defconst` if it's not meant to stay constant (e.g. we let-bind it
in tramp-tests.el).
</pre>
</div>
</content>
</entry>
<entry>
<title>(eval-expression): Fix bug#67196</title>
<updated>2023-12-28T04:45:51+00:00</updated>
<author>
<name>Stefan Monnier</name>
</author>
<published>2023-12-19T04:47:56+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=19f1d2a9f5111a2f06003f45f3af2a39c7029047'/>
<id>19f1d2a9f5111a2f06003f45f3af2a39c7029047</id>
<content type='text'>
* lisp/simple.el (eval-expression--debug): New function.
(eval-expression): Use it together with `handler-bind` instead of
let-binding `debug-on-error`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* lisp/simple.el (eval-expression--debug): New function.
(eval-expression): Use it together with `handler-bind` instead of
let-binding `debug-on-error`.
</pre>
</div>
</content>
</entry>
<entry>
<title>New special form `handler-bind`</title>
<updated>2023-12-28T04:45:51+00:00</updated>
<author>
<name>Stefan Monnier</name>
</author>
<published>2023-12-26T03:32:17+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=a4efbe4c499623b33882a770c896ebfd31459ce9'/>
<id>a4efbe4c499623b33882a770c896ebfd31459ce9</id>
<content type='text'>
AFAIK, this provides the same semantics as Common Lisp's `handler-bind`,
modulo the differences about how error objects and conditions are
represented.

* lisp/subr.el (handler-bind): New macro.

* src/eval.c (pop_handler): New function.
(Fhandler_Bind_1): New function.
(signal_or_quit): Handle new handlertypes `HANDLER` and `SKIP_CONDITIONS`.
(find_handler_clause): Simplify.
(syms_of_eval): Defsubr `Fhandler_bind_1`.

* doc/lispref/control.texi (Handling Errors): Add `handler-bind`.

* test/src/eval-tests.el (eval-tests--handler-bind): New test.

* lisp/emacs-lisp/lisp-mode.el (lisp-font-lock-keywords):
Move 'handler-bind' from CL-only to generic Lisp.
(handler-bind): Remove indentation setting, it now lives in the macro
definition.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
AFAIK, this provides the same semantics as Common Lisp's `handler-bind`,
modulo the differences about how error objects and conditions are
represented.

* lisp/subr.el (handler-bind): New macro.

* src/eval.c (pop_handler): New function.
(Fhandler_Bind_1): New function.
(signal_or_quit): Handle new handlertypes `HANDLER` and `SKIP_CONDITIONS`.
(find_handler_clause): Simplify.
(syms_of_eval): Defsubr `Fhandler_bind_1`.

* doc/lispref/control.texi (Handling Errors): Add `handler-bind`.

* test/src/eval-tests.el (eval-tests--handler-bind): New test.

* lisp/emacs-lisp/lisp-mode.el (lisp-font-lock-keywords):
Move 'handler-bind' from CL-only to generic Lisp.
(handler-bind): Remove indentation setting, it now lives in the macro
definition.
</pre>
</div>
</content>
</entry>
<entry>
<title>; Fix typos</title>
<updated>2023-12-28T00:20:32+00:00</updated>
<author>
<name>Stefan Kangas</name>
</author>
<published>2023-12-28T00:20:20+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=8f571769e155a214ae2f9f760dd179b687d9982e'/>
<id>8f571769e155a214ae2f9f760dd179b687d9982e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Abbreviate the VC revision in vc-annotate's buffer name</title>
<updated>2023-12-27T22:22:18+00:00</updated>
<author>
<name>Jim Porter</name>
</author>
<published>2023-12-14T19:31:27+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=ea4cbb3aae3c7f72ef04337bc2db7292909ca9a1'/>
<id>ea4cbb3aae3c7f72ef04337bc2db7292909ca9a1</id>
<content type='text'>
* lisp/vc/vc-hooks.el (vc-use-short-revision): New variable.
(vc-short-revision): New function.

* lisp/vc/vc-annotate.el (vc-annotate-use-short-revision): New
option...
(vc-annotate): ... use it.

* lisp/vc/vc-git.el (vc-git--rev-parse): Consult
'vc-use-short-revision'.

* etc/NEWS: Announce this change (bug#67062).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* lisp/vc/vc-hooks.el (vc-use-short-revision): New variable.
(vc-short-revision): New function.

* lisp/vc/vc-annotate.el (vc-annotate-use-short-revision): New
option...
(vc-annotate): ... use it.

* lisp/vc/vc-git.el (vc-git--rev-parse): Consult
'vc-use-short-revision'.

* etc/NEWS: Announce this change (bug#67062).
</pre>
</div>
</content>
</entry>
<entry>
<title>Eglot: experimental support for Eglot-only subprojects</title>
<updated>2023-12-27T15:19:01+00:00</updated>
<author>
<name>João Távora</name>
</author>
<published>2023-12-27T15:19:01+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=4f017f5f0e89e07757dd2d5e0971219420920b79'/>
<id>4f017f5f0e89e07757dd2d5e0971219420920b79</id>
<content type='text'>
* lisp/progmodes/eglot.el
(eglot-alternatives)
(eglot-server-programs): : Rework docstring.
(eglot--guess-contact): Pass project to eglot-server-programs function.
(project-root): Define for new experimental Eglot project type.

Github-reference: https://github.com/joaotavora/eglot/discussions/1337
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* lisp/progmodes/eglot.el
(eglot-alternatives)
(eglot-server-programs): : Rework docstring.
(eglot--guess-contact): Pass project to eglot-server-programs function.
(project-root): Define for new experimental Eglot project type.

Github-reference: https://github.com/joaotavora/eglot/discussions/1337
</pre>
</div>
</content>
</entry>
</feed>
