Paul Eggert [Mon, 3 Mar 2025 17:32:08 +0000 (09:32 -0800)]
Avoid some union buffered_input_event uses
Simplify by using separate local vars for struct input_event and
struct selection_input_event, rather than a single local var that
is the union of the two. This makes the code easier to follow by
the human reader, and should help avoid GCC bug 117423
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117423> and
therefore work around Emacs bug 76559 <https://bugs.gnu.org/76559>.
* src/androidterm.c (handle_one_android_event):
* src/gtkutil.c (xg_widget_key_press_event_cb):
* src/pgtkterm.c (evq_flush):
* src/xterm.c (handle_one_xevent): Use struct input_event and
kbd_buffer_store_event_hold, or struct selection_input_event and
kbd_buffer_store_selection_event_hold, rather than union
buffered_input_event and union buffered_input_event.
* src/keyboard.c (beware_long_paste, maybe_quit_while_no_input):
New functions, broken out from kbd_buffer_store_buffered_event.
(kbd_buffer_store_event_hold): Define here, with a simplified
version of the body of the old kbd_buffer_store_buffered_event,
rather than defining in keyboard.h. Specialize to struct
input_event.
(kbd_buffer_store_selection_event_hold): New function; it is
a simplified version of the old kbd_buffer_store_buffered_event,
specialized to struct selection_input_event.
(is_ignored_event_kind): Accept enum event_kind instead of
union buffered_input_event. All callers changed.
* src/keyboard.h (kbd_buffer_store_event_hold):
Remove definition, as keyboard.c now defines it.
* src/pgtkterm.c (evq_grow_if_needed): New function.
(evq_enqueue, evq_selection_enqueue): Two functions now,
not one. Args are now struct input_event const * or
struct selection_input_event const *, not
union buffered_input_event *. All callers changed.
This lets us simplify the callers so that they need
not use the union.
Yuan Fu [Mon, 3 Mar 2025 04:26:28 +0000 (20:26 -0800)]
Don't process function range settings in treesit--update-range-1
This fixes a bug where we call treesit-query-language on a
function, which happens before the QUERY in a range setting can
be either a function or a query, but we call it with
treesit-query-language before knowing whether it's a query or
function.
* lisp/treesit.el:
(treesit--update-range-1): Skip function range settings.
(treesit-update-ranges): Handle function range settings here.
* lisp/progmodes/eglot.el (eglot-client-capabilities): Set
window/showMessage/messageActionItem/additionalPropertiesSupport to t.
(eglot-handle-request window/showMessageRequest): Return the whole
selected MessageActionItem, not just its title.
* test/lisp/term-tests.el (term-line-wrap-no-auto-margins): add test
* lisp/term.el (term-auto-margins): new variable
(term-mode): documentation
(term-termcap-format): mention auto-margins flag
(term-emulate-terminal): support it
(term-reset-terminal): reset it
(term-handle-ansi-escape): notice it
* etc/e/eterm-color.ti: add auto margin capability
Juri Linkov [Sun, 2 Mar 2025 18:44:40 +0000 (20:44 +0200)]
Adapt recent css-ts-mode changes to mhtml-ts-mode
* lisp/textmodes/css-mode.el (css--treesit-thing-settings):
(css-ts-mode--outline-predicate): New variables.
(css-ts-mode): Set treesit-outline-predicate.
* lisp/textmodes/mhtml-ts-mode.el (mhtml-ts-mode--treesit-thing-settings):
Use css--treesit-thing-settings and css--treesit-defun-type-regexp.
(mhtml-ts-mode): Use 'css-ts-mode--outline-predicate' for
'treesit-aggregated-outline-predicate'.
Juri Linkov [Sun, 2 Mar 2025 18:07:21 +0000 (20:07 +0200)]
Improve treesit settings for css-ts-mode (bug#73404)
* lisp/textmodes/css-mode.el (css--treesit-settings): Add
"@supports" and '(at_keyword)' to 'keyword', 'keyframe_block' to
'selector', 'keyframes_name' to 'query'.
(css--treesit-defun-name): Support "keyframe_block",
"keyframes_statement" and "supports_statement" as well.
(css--treesit-simple-imenu-settings): Add "keyframes_statement",
"keyframe_block", "supports_statement".
(css--treesit-defun-type-regexp): Add "keyframe_block".
(css-ts-mode): Add 'treesit-thing-settings'.
Stefan Kangas [Sun, 2 Mar 2025 17:04:32 +0000 (18:04 +0100)]
Don't warn when calling hl-lock-mode from init file
This was a compatibility kluge introduced in Emacs 22.1, twenty years
ago. It's fair to assume that any former Emacs 21 user have seen this
warning already, and will have updated their init file. So remove it.
* lisp/hi-lock.el (hi-lock-mode): Don't warn when calling plain
hi-lock-mode from init file.
(hi-lock-archaic-interface-message-used)
(hi-lock-archaic-interface-deduce): Remove associated variables.
Po Lu [Sun, 2 Mar 2025 12:54:36 +0000 (20:54 +0800)]
Specifically report attempts to exit Emacs during test execution
* test/infra/android/test-driver.el (ats-in-eval): Fix typo in
doc string.
(ats-eval-as-printed, ats-eval-serial, ats-eval-do-decode):
Render buffer-local.
(ats-executing-form): New variable.
(ats-process-filter): Bind the same around `eval'.
(ats-kill-emacs-function): New function; register it to execute
when Emacs exits.
Stefan Kangas [Sun, 2 Mar 2025 12:26:43 +0000 (13:26 +0100)]
Fix a vc test for Breezy by setting $HOME
* test/lisp/vc/vc-tests.el (vc--fix-home-for-bzr): New macro.
(vc-test--create-repo, vc-test--register, vc-test--working-revision)
(vc-test--checkout-model, vc-test--rename-file)
(vc-test--version-diff): Fix test for Breezy by setting HOME to a
temporary directory. (Bug#70195)
Po Lu [Sun, 2 Mar 2025 08:02:46 +0000 (16:02 +0800)]
Run Android tests in the initial frame
* test/infra/android/early-init.el: New file.
* test/infra/android/test-controller.el (ats-connect): Upload
`early-init.el' to the staging directory and configure that
directory as the Emacs instance's initialization directory.
(ats-run-test): Always append to the test buffer. Execute tests
within terminal-frame.
(ats-run-all-tests): Gracefully respond to errors.
(ats-cmd-error): New function.
(ats-execute-tests-batch): Accept a number of command line
arguments.
Po Lu [Sun, 2 Mar 2025 08:00:33 +0000 (16:00 +0800)]
Enable kmacro-call-macro to function in some circumstances
* lisp/kmacro.el (kmacro-call-macro): Enable to function when
the selected frame's terminal is different from that most
recently consulted by the event loop.
Eshel Yaron [Sun, 2 Mar 2025 07:03:04 +0000 (08:03 +0100)]
; (completion-preview--try-table): Propagate extra properties.
* lisp/completion-preview.el
(completion-preview--try-table): Let-bind
'completion-extra-properties' to completion properties
that the completion backend (capf) provides, so that these
properties take effect when querying the completion table.
* test/lisp/completion-preview-tests.el
(completion-preview-propagates-properties): Add test.
Dmitry Gutov [Sun, 2 Mar 2025 03:22:56 +0000 (05:22 +0200)]
Fix the use of xref-window-local-history together with Xref buffer
* lisp/progmodes/xref.el (xref--push-markers): Temporarily
restore the selected window as well, using the value from the
new argument (bug#76565). Update both callers.
Eli Zaretskii [Sat, 1 Mar 2025 14:04:52 +0000 (16:04 +0200)]
Fix 'M-q' in 'makefile-mode'
* lisp/progmodes/make-mode.el (makefile-mode-map): Bind 'M-q' to
'fill-paragraph', as 'prog-mode's default binding is not
appropriate for Makefile's syntax. (Bug#76641)
Eli Zaretskii [Sat, 1 Mar 2025 13:45:57 +0000 (15:45 +0200)]
; Improve documentation of 'rmail-movemail-program'
* lisp/mail/rmail.el (rmail-movemail-program):
* doc/emacs/rmail.texi (Movemail): Document how to change the
value of 'rmail-movemail-program' safely. (Bug#76595)
Tassilo Horn [Sun, 23 Feb 2025 08:46:54 +0000 (09:46 +0100)]
doc-view: Fix error during revert in editing mode
When in editing mode in a doc-view buffer and then reverting (which can
happen automatically when editing OpenDocument contents), we errored in
the advide function doc-view--revert-buffer because the local
doc-view--buffer-file-name has been killed when switching to the editing
mode.
Also restore doc-view-minor-mode after reverting during being in the
editing mode.
* lisp/doc-view.el (doc-view--revert-buffer): Check that
'doc-view--buffer-file-name' is non-nil.
(doc-view-minor-mode): Add re-enabling function to
'revert-buffer-restore-functions'.
Trevor Murphy [Wed, 12 Feb 2025 01:26:55 +0000 (17:26 -0800)]
Ignore dedicated windows in 'display-buffer-reuse-mode-window'
Ignore the dedicated windows unless the dedicated window is
already displaying the buffer-to-be-displayed. In that case,
the window may be reused, according to the setting of
'inhibit-same-window'.
* lisp/window.el (display-buffer-reuse-mode-window): Check
'window-dedicated-p' before pushing the candidate window onto
the stack. (Bug#76216)
Eli Zaretskii [Sat, 1 Mar 2025 10:59:32 +0000 (12:59 +0200)]
; Document what happens when 'display' and 'invisible' props clash
* doc/lispref/display.texi (Replacing Specs, Overlay Properties)
(Invisible Text): Document that 'invisible' is ignored when
'display' property covers the same text. (Bug#76658)
Eli Zaretskii [Sat, 1 Mar 2025 08:27:17 +0000 (10:27 +0200)]
Save IELM input history on "C-c C-c"
* lisp/ielm.el (ielm--write-history-on-interrupt): New function.
(inferior-emacs-lisp-mode): Install it as buffer-local value of
the 'interrupt-process-functions' hook. (Bug#76585)
Łukasz Stelmach [Wed, 7 Feb 2024 13:37:39 +0000 (14:37 +0100)]
Fix handling of delta values with negative month field
* lisp/calendar/time-date.el (decoded-time-add): If the new
variable is less then zero, the year needs to be decremented
by quotient of new and 12 increased by one.
* test/lisp/calendar/time-date-tests.el (test-decoded-add):
Add applicable test cases. (Bug#68969)
Stefan Kangas [Sat, 1 Mar 2025 02:22:30 +0000 (03:22 +0100)]
grep: Signal error if unable to access directory
* lisp/progmodes/grep.el (lgrep, rgrep): grep: Signal error if unable to
access directory, instead of just trying to use default-directory,
because that level of DWIMishness is confusing. (Bug#71078)
Stefan Kangas [Fri, 28 Feb 2025 18:59:12 +0000 (19:59 +0100)]
; Grammar fixes for "native-compiled"
1. Prefer "native-compiled" to "native compiled".
The adjective "native-compiled" with the hyphen is generally more
consistent with the typical pattern in English, especially when the
compound modifies a noun (e.g., "native-compiled code").
2. Prefer "natively compiled" to "natively-compiled".
The adverb "natively" modifies "compiled", and it is standard not
to hyphenate an adverb + adjective combination when the adverb ends
in -ly (e.g., "code that is natively compiled").
For example, note that we say "high-speed internet" but "highly
performant code".
Stefan Kangas [Fri, 28 Feb 2025 17:28:58 +0000 (18:28 +0100)]
Lift widget functions from C to Lisp
In the mid-1990s, these functions were moved from Lisp to C to
"improve performance". However, Moore's Law, and perhaps other
improvements too, has made this rationale irrelevant.
On this machine, with --native-compilation=no, I observed only a
slight ~4% performance difference. For example, displaying a buffer
full of widgets (e.g., 'M-x customize RET browse-url RET') takes 4ms
here, meaning the performance gap is under 0.1ms. Even on less
powerful machines, this difference would remain imperceptible. Given
this, let's lift these functions back to to Lisp, which offers the
usual benefits.
We already have solid test coverage, but let's add a more focused test
for 'widget-get' and 'widget-put' to be thorough.
* lisp/wid-edit.el (widget-put, widget-get, widget-apply): Move to
Lisp from...
* src/fns.c (Fwidget_put, Fwidget_get, Fwidget_apply): ...here.
(syms_of_fns): Remove defsubrs for the above functions.
* test/lisp/wid-edit-tests.el
(widget-test-editable-field-widget-get/put): New test.
Eli Zaretskii [Fri, 28 Feb 2025 12:45:39 +0000 (14:45 +0200)]
Fix 'internal--c-header-file-path'
* lisp/subr.el (internal--c-header-file-path): Fix for MS-Windows:
don't prepend the (usually non-existent) "/usr/include", and run
each directory through 'expand-file-name' to remove the many ".."
elements and mirror any backslashes. Invoke "clang" if "gcc" is
not available or is actually clang.
* test/lisp/subr-tests.el
(subr-tests-internal--c-header-file-path): Fix for MS-Windows:
test the path by looking for stdio.h, and expand all directory
names to compare to expected results.
Po Lu [Fri, 28 Feb 2025 11:49:34 +0000 (19:49 +0800)]
Fully support Lisp threads on Android
* src/android.c (struct android_thread_event_queue): New
structure. Move global pselect arguments, mutexes, and
semaphores, and pipes here.
(struct android_event_queue) <select_mutex, select_thread>:
Remove to the above-named struct.
(android_init_thread_events, android_finalize_thread_events)
(android_get_poll_thread): New functions.
(android_run_select_thread): Accept a set of mutexes and
thread-local data as the first argument, and operate with them
rather than globals.
(android_handle_sigusr1): Rename to
`android_handle_poll_signal'. Set thread-specific cancellation
indicator.
(android_init_events): Properly abort after a fatal condition.
Enable interruptible polling on Android 5.1 and later, not 4.2.
(android_select): Never check for queries here, but in
thread_select, if threads are enabled. Adapt to per-thread
polling threads and only enable interruptible polling on Android
5.1 and later.
(android_before_select): New function.
* src/android.h (android_before_select): New declaration.
* src/thread.c (thread_select): Call `android_before_select'
before the global lock is released.
Paul Eggert [Thu, 27 Feb 2025 18:57:19 +0000 (10:57 -0800)]
Fix fns-tests-collate-strings failure with musl
* test/src/fns-tests.el (fns-tests-collate-strings):
Don’t assume "en_XY.UTF-8", or any particular string,
is an invalid locale, as they all seem to be valid in musl.
Instead, simply test that a non-string is invalid.
(Bug#76550)
Eshel Yaron [Thu, 27 Feb 2025 14:34:24 +0000 (15:34 +0100)]
; (completion-preview-complete): Fix bug#76606
* lisp/completion-preview.el (completion-preview-complete):
Dismiss completion preview before calling ':exit-function'.
This eliminates potential flicker with slow exit functions
and avoids the broken preview update reported in bug#76606.
Stefan Kangas [Wed, 26 Feb 2025 02:31:57 +0000 (03:31 +0100)]
; Fix up emacs-lisp-mode docstring
* lisp/progmodes/elisp-mode.el (emacs-lisp-mode, lisp-interaction-mode):
Fix up docstring slightly by removing redundant and misplaced word
"Commands", and prefix list with dashes.