Stefan Kangas [Sat, 22 Feb 2025 03:16:21 +0000 (04:16 +0100)]
Don't document deleted xwidget functions
* doc/lispref/display.texi (Xwidgets): Don't document deleted function
xwidget-webkit-execute-script-rv. Fix name of deleted and then re-added
function xwidget-webkit-title.
Yuan Fu [Sun, 23 Feb 2025 07:24:38 +0000 (23:24 -0800)]
Use character position for ranges in treesit_sync_visible_region
* src/treesit.c (treesit_sync_visible_region): Use character position
instead of byte position when comparing to ranges, because the
ranges are in character position.
Yuan Fu [Fri, 28 Feb 2025 01:18:28 +0000 (17:18 -0800)]
Support alternative range function for tree-sitter range settings
Some embedded parser needs to exclude child nodes from the
range, like markdown-inline. So I added this keyword that
allows users to customize the range for the embedded parser.
This can also be potentially useful for markdown comments in
rust, for example, because we want to exclude the comment
starters (//) from the embedded markdown parser.
* lisp/treesit.el (treesit-query-range):
(treesit-query-range-by-language): Add new parameter RANGE-FN.
(treesit-range-settings): Add new field RANGE-FN.
(treesit-range-rules): Add new keyword RANGE-FN.
(treesit-range-fn-exclude-children): New function.
(treesit--update-ranges-non-local):
(treesit--update-ranges-local):
(treesit--update-range-1): Support the RANGE-FN field.
Yuan Fu [Thu, 27 Feb 2025 11:10:47 +0000 (03:10 -0800)]
Rework range facility in treesit.el to support arbitrary nesting
Make use of the newly added embed-level parser property, we now
iterativeLy create/update embedded parsers at each embed level,
allowing arbitrary levels of nesting.
At the beginning, we start with the primary parser. We query it
with each range settings, gets some ranges and their
corresponding language. Then we create the first level of
embedded parsers using the ranges and language we got. This is
one iteration. For the next iteration/level, we start with the
embedded parsers we create/updated in the previous
iteration/level, and query each of them with each of the range
settings, creating/updating the next level of embedded parsers.
And we keep doing this until we don't get more matches from the
queries.
We now also support the :embed keyword in 'treesit-range-rules'
to be a function that returns a language. This allows major
modes like markdown and org mode to support code blocks of which
the language isn't known ahead of time.
* lisp/treesit.el (treesit-primary-parser): Move to front.
(treesit-query-range-by-language): New function.
(treesit-range-rules): Allow :embed to be a function, update docstring.
(treesit-local-parsers-on): Update docstring.
(treesit--parser-at-level):
(treesit--update-ranges-non-local): New functions.
(treesit--update-ranges-local): Use the new logic, support
:embed being a function.
(treesit--update-range-1): New function, has the meat of
original treesit-update-ranges.
(treesit-update-ranges): Implements the iteration logic using
treesit--update-range-1 to do the actual work.
Yuan Fu [Thu, 27 Feb 2025 11:07:34 +0000 (03:07 -0800)]
Enable treesit-query-capture to return grouped captures
This is needed for creating embedded parsers for embedded code
blocks of which language cannot be known ahead of time. E.g.,
markdown and org mode's code block.
Yuan Fu [Thu, 27 Feb 2025 11:05:26 +0000 (03:05 -0800)]
Add tree-sitter-parser-embed-level and parent-node
Add parser properties embed-level and parent-node. They'll be
help us implement arbitrarily nested embeded parser, and
navigation across embedded and host parsers, respectively.
* src/treesit.c:
(Ftreesit_parser_embed_level):
(Ftreesit_parser_set_embed_level):
(Ftreesit_parser_parent_node):
(Ftreesit_parser_set_parent_node): New functions.
Philipp Stephani [Thu, 30 Jan 2025 15:12:49 +0000 (16:12 +0100)]
Don't overwrite non-local exit symbol and data (Bug#65796).
The previous approach would incorrectly invalidate the returned module
values if another non-local exit occurred while dealing with a non-local
exit. See Bug#65796. Instead, allocate the values from the usual
environment storage, and return statically-allocated objects if that
fails.
* src/emacs-module.c (struct emacs_env_private): Turn non-local exit
symbol and data into normal Lisp objects.
(initialize_environment): Initialize them.
(mark_module_environment): Prevent them from being garbage-collected.
(module_signal_or_throw, module_non_local_exit_signal_1)
(module_non_local_exit_throw_1): Adapt uses.
(value_to_lisp): No longer scan for them with module assertions enabled.
(module_out_of_memory_signal, module_out_of_memory_data): New
statically-allocated module values to return in case of allocation
failure.
(syms_of_module): Initialize them.
(module_non_local_exit_get): Allocate module values normally. If that
fails, return statically-allocated values.
* doc/lispref/internals.texi (Module Nonlocal): Document new behavior.
Visuwesh [Thu, 20 Feb 2025 14:49:32 +0000 (20:19 +0530)]
Recommend 'tab-bar-history-mode' over 'winner-mode'
* lisp/winner.el (winner-mode):
* lisp/tab-bar.el (tab-bar-mode): Update the docstring to
suggest 'tab-bar-history-mode' instead of 'winner-mode' when
using 'tab-bar-mode' instead. (Bug#76439)
Stephen Berman [Thu, 27 Feb 2025 11:13:26 +0000 (12:13 +0100)]
Prevent a todo-mode test from running with 'make check'
* test/lisp/calendar/todo-mode-tests.el
(todo-test-add-and-delete-file): Tag this test as unstable, since
it has been reported to fail unreproducibly (bug#58473) or
reproducibly only on the ZFS filesystem (bug#76381) and the causes
are still unknown.
Stephen Berman [Thu, 27 Feb 2025 11:03:24 +0000 (12:03 +0100)]
Prevent a todo-mode test from running with 'make check'
* test/lisp/calendar/todo-mode-tests.el
(todo-test-add-and-delete-file): Tag this test as unstable, since
it has been reported to fail unreproducibly (bug#58473) or
reproducibly only on the ZFS filesystem (bug#76381) and the causes
are still unknown.
Stephen Berman [Thu, 27 Feb 2025 10:51:22 +0000 (11:51 +0100)]
Prevent a todo-mode test from running with 'make check'
* test/lisp/calendar/todo-mode-tests.el
(todo-test-add-and-delete-file): Tag this test as unstable, since
it has been reported to fail unreproducibly (bug#58473) or
reproducibly only on the ZFS filesystem (bug#76381) and the causes
are still unknown.
Po Lu [Thu, 27 Feb 2025 01:53:41 +0000 (09:53 +0800)]
Fix drag-and-drop treatment of reused tooltip frames
* src/androidfns.c (Fx_show_tip): Set `tip_window' to that of
any reused tooltip frame.
* src/haikufns.c (unwind_create_frame): Return whether the frame
was destroyed, as on X.
(unwind_create_tip_frame, haiku_create_frame, Fx_show_tip):
Synchronize with X.
(do_unwind_create_frame): New function.
(tip_window): Remove unused variable.
* src/pgtkfns.c (pgtk_create_tip_frame): Rename to
pgtk_create_tip_frame.
(Fx_show_tip): Adjust accordingly. Set `tip_window' to that of
any reused tooltip frame.
* src/w32fns.c (Fx_show_tip):
* src/xfns.c (Fx_show_tip): Set `tip_window' to that of any
reused tooltip frame.
Stefan Monnier [Wed, 26 Feb 2025 14:13:04 +0000 (09:13 -0500)]
(define-ibuffer-op): Minor tweak to Shipmints's patch
* lisp/ibuf-macs.el (define-ibuffer-op): Evaluate `(active-)opstring`
args when defining the operation rather than every time the operation
is used. Move the `:autoload-end` marker back to the level of `progn`.
Mauro Aranda [Wed, 26 Feb 2025 11:06:14 +0000 (08:06 -0300)]
Avoid display bugs after editable-field widgets
* lisp/wid-edit.el (widget-specify-button): Don't add an
invisible space before the button to avoid bugs that surface
with the widget-field face. The Widget library is not
the one that puts a :box attribute for the button face, and we
can't control what library users put after editable-field
widgets.
(widget-specify-field): Rather, add the invisible space here,
after the newline. That way, we protect whatever comes after
the editable-field widget. (Bug#51550)
Eshel Yaron [Wed, 26 Feb 2025 19:41:09 +0000 (20:41 +0100)]
Add 'help-echo' hint to completion preview
* lisp/completion-preview.el
(completion-preview--propertize-for-mouse): New function.
* lisp/completion-preview.el (completion-preview--update)
(completion-preview--show)
(completion-preview-partial-insert)
(completion-preview-complete)
(completion-preview-next-candidate): Use it to propertize
completion preview text with mouse-related properties,
including a new 'help-echo' hint.
* lisp/completion-preview.el (completion-preview-insert)
(completion-preview-insert-word)
(completion-preview-insert-sexp)
(completion-preview-complete)
(completion-preview-prev-candidate)
(completion-preview-next-candidate): Use 'interactive' to
associate command with 'completion-preview-active-mode'
instead of using a bespoke 'completion-predicate' property.
(completion-preview-active-p): Declare obsolete.
Stefan Kangas [Wed, 26 Feb 2025 05:37:52 +0000 (06:37 +0100)]
Make define-global-minor-mode alias obsolete
* lisp/emacs-lisp/easy-mmode.el (define-global-minor-mode): Make alias
for old name obsolete, just in time for its 20th anniversary.
* test/lisp/emacs-lisp/lisp-mode-tests.el (test-font-lock-keywords):
* lisp/progmodes/subword.el (global-subword-mode)
(global-superword-mode): Don't use above obsolete name.
* lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression)
(lisp-fdefs): Remove syntax highlighting for obsolete name.
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--make-autoload):
Add comment mentioning the obsolete status of above alias.
* doc/lispref/loading.texi (Autoload): Don't document obsolete name.
Stefan Kangas [Wed, 26 Feb 2025 03:36:51 +0000 (04:36 +0100)]
Don't enable minor modes in diff-add-log-current-defuns
* lisp/vc/diff-mode.el (diff-add-log-current-defuns): Don't run mode
hooks when enabling major mode hooks. That fails if, for example,
paredit-mode is on emacs-lisp-mode-hook and it signaled due to
unbalanced parens.
* test/lisp/emacs-lisp/rmc-tests.el
(test-rmc--add-key-description)
(test-rmc--add-key-description/with-attributes)
(test-rmc--add-key-description/non-graphical-display)
(test-read-multiple-choice, test-read-multiple-choice-help):
Skip on Android in some wise or another.
Po Lu [Wed, 26 Feb 2025 02:35:00 +0000 (10:35 +0800)]
; Improve Android testing facilities
* test/infra/android/test-controller.el (ats-eval): Don't block
other processes.
(ats-run-test): Bind ert-remote-temporary-file-directory to nil
and always print messages into the output buffer.
(ats-upload-all-tests): New function.
(ats-run-all-tests): New argument SELECTOR. Only execute
already uploaded tests.
Po Lu [Wed, 26 Feb 2025 02:33:30 +0000 (10:33 +0800)]
Enable auto-revert-tests to pass on Android
* lisp/emacs-lisp/ert-x.el
(ert-remote-temporary-file-directory): Define to null-device on
Android.
* test/lisp/autorevert-tests.el
(auto-revert-test02-auto-revert-deleted-file): Provide for
situations where the watch descriptor is recreated by the
polling timer after a file notification is received.
Po Lu [Wed, 26 Feb 2025 01:56:46 +0000 (09:56 +0800)]
Guarantee delivery of inotify special events
* src/inotify.c (inotifyevent_to_event): Always match events
that are not encompassed by IN_ALL_EVENTS and which the
documentation implies are always delivered to callbacks.
* test/src/inotify-tests.el (inotify-file-watch-stop-delivery):
New test.
Po Lu [Tue, 25 Feb 2025 14:34:43 +0000 (22:34 +0800)]
Implement commands for executing all tests on connected Android devices
* test/infra/android/test-controller.el (ats-upload-test):
Correct minor encoding error. Transfer solitary files without
creating a tar archive, and handle `resources' directories.
(ats-list-tests-locally, ats-list-tests): Don't list files in
`resources' directories. Insert test header locally, and
redisplay after insertion.
(ats-run-all-tests): New function.
Po Lu [Tue, 25 Feb 2025 11:12:06 +0000 (19:12 +0800)]
; Improve Android regression test execution facilities
* test/infra/android/test-controller.el
(ats-associated-process): New variable.
(ats-start-server): Set coding system to `no-conversion'.
(ats-read-connection): If this buffer is associated with a
connection, return the same.
(ats-establish-connection): New arg INTERACTIVE. Interactively,
open a Lisp interaction buffer with this connection as its
associated process.
(ats-connect): Provide this argument if called interactively.
(ats-eval): New argument RAW. Request that encoded forms not be
decoded if specified, and decode results.
(ats-remote-eval-defuns, ats-remote-eval-print-sexp)
(ats-remote-eval-for-interaction)
(ats-remote-eval-print-last-sexp, ats-remote-eval-last-sexp)
(ats-remote-eval-defun, ats-remote-eval-region-or-buffer)
(ats-lisp-interaction-mode-map, ats-lisp-interaction-mode-menu)
(ats-lisp-interaction-mode, ats-open-lisp-interaction-buffer)
(ats-emacs-test-directory, ats-upload-test)
(ats-list-tests-locally, ats-list-tests, ats-run-test): New
functions and variables.
* test/infra/android/test-driver.el (ats-eval-do-decode): New
variable.
(ats-process-filter, ats-establish-connection)
(ats-initiate-connection): Adjust correspondingly.
* lisp/net/tramp-cmds.el:
(tramp-list-remote-buffer-connections): New function.
(tramp-cleanup-bufferless-connections): New command.
(tramp-list-remote-buffers): Account for 'buffer-file-name'.
Stefan Kangas [Mon, 24 Feb 2025 23:12:00 +0000 (00:12 +0100)]
Make cl-gensym obsolete in favor of built-in gensym
* lisp/emacs-lisp/cl-macs.el (cl-gensym): Declare function
obsolete in favor of gensym, added in Emacs 26.1. The only reason
for its existence is that it allows an integer argument, but
that's not really useful, so it's better to remove this complexity.
Ref: https://lists.gnu.org/r/emacs-devel/2017-09/msg00313.html
* doc/misc/cl.texi (Symbols, Creating Symbols, Efficiency Concerns)
(Obsolete Setf Customization): Don't document above obsolete function.
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause):
* lisp/emacs-lisp/edebug.el (edebug-make-form-wrapper):
* lisp/obsolete/cl.el (cl--function-convert, lexical-let):
* lisp/obsolete/thumbs.el (thumbs-temp-file):
* lisp/progmodes/eglot.el (eglot--lambda)
(eglot--when-live-buffer, eglot--when-buffer-window)
(eglot--collecting-xrefs, eglot--glob-parse):
* lisp/progmodes/flymake.el (flymake--run-backend):
* test/lisp/emacs-lisp/package-tests.el (with-package-test):
* test/lisp/progmodes/eglot-tests.el (eglot--guessing-contact):
* test/lisp/progmodes/elisp-mode-tests.el
(elisp-shorthand-read-buffer, elisp-shorthand-read-from-string): Prefer
plain gensym to cl-gensym in files that can depend on Emacs 26.1.
* lisp/jsonrpc.el (jsonrpc-lambda, jsonrpc-request): Prefer gensym to
cl-gensym only when defined, as this file supports Emacs 25.1
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-lib-test-gensym): Simplify
test as 'should' no longer uses cl-gensym.
João Távora [Sun, 16 Feb 2025 18:27:48 +0000 (18:27 +0000)]
Eglot: use eglot-advertise-cancellation in more situations
The async requests frequently issued by ElDoc are a significant
source of request pile-up on the server side (for some servers).
With this change, Eglot will issue additional LSP
$/cancelRequest notifications for in-flight requests of certain
kinds in the pre-command hook.
This required a small change to the 'jsonrpc-async-request'
entrypoint.
This feature is experimental.
* lisp/jsonrpc.el (jsonrpc-async-request): No longer returns nil.
* lisp/progmodes/eglot.el (eglot--inflight-async-requests): New variable.
(eglot--cancel-inflight-async-requests): New function.
(eglot--async-request): New function.
(eglot--pre-command-hook): Call eglot--cancel-inflight-async-requests.
(eglot-signature-eldoc-function, eglot-hover-eldoc-function)
(eglot-highlight-eldoc-function, eglot-code-action-suggestion):
Use eglot--async-request.
Mauro Aranda [Mon, 24 Feb 2025 22:39:43 +0000 (19:39 -0300)]
Fix bad fontification of inactive widgets
* lisp/wid-edit.el (widget-specify-inactive): When a widget is
already inactive, still move the overlay to the desired
positions. Improve docstring. (Bug#69941)
* doc/misc/widget.texi (default): Document the need to call the
:deactivate function when modifying an inactive widget.
* test/lisp/wid-edit-tests.el
(widget-test-modification-of-inactive-widget): New test
Stefan Kangas [Mon, 24 Feb 2025 17:54:23 +0000 (18:54 +0100)]
Support selecting buffer in ert-with-test-buffer
* lisp/emacs-lisp/ert-x.el (ert-with-test-buffer): Add new keyword
argument :selected to make the buffer current and selected.
(ert-with-test-buffer-selected): Make obsolete and redefine in
terms of ert-with-test-buffer.
* doc/misc/ert.texi (Helper Functions): Document above new
:selected keyword argument, and remove documentation of
ert-with-test-buffer-selected.
Juri Linkov [Mon, 24 Feb 2025 17:51:13 +0000 (19:51 +0200)]
Better support for nil enable-local-variables in vc-find-revision-no-save
* lisp/vc/diff-mode.el (diff-syntax-fontify-props):
* lisp/vc/vc.el (vc-find-revision-no-save):
Use enable-local-variables as is only when it's one of these values:
:safe, :all, or nil. Otherwise, for all remaining values that query,
use :safe. Also use non-nil 'find-file' arg of 'normal-mode'.
https://lists.gnu.org/archive/html/emacs-devel/2025-02/msg00897.html