After a week of intense testing, found out there were various insidious
bugs related to out-of-date requests that rear their heads in different
typing patterns. One way to sort this out and still minimize the number
of requests is to have Eglot's semtok code be aware of the states a
request for tokens can be in: inexistent/invalid, unsent, sent, valid.
The needs and optimization opportunities for servers that support "full"
and "full/delta" requests are considerably different from the ones of
servers which only support "full" and "range". The latter seem to be in
the minority, so for now I've removed the range requests. These servers
should still work with "full" requests.
In a further bug, at least two servers (clangd and lean) were found to
plainly abuse the semanticTokens/refresh server request. This confuses
the state logic. The solution is to simply no-op this request handler,
it doesn't seem to do anything useful.
Finally, when auto-reverting with preserve-modes (as done by vc-revert
and auto-revert-mode), the font-lock state needs to be reinitialized.
Fixed this in eglot--after-revert-hook.
* lisp/progmodes/eglot.el (eglot-client-capabilities): Don't announce
ranged request support.
(eglot--docver): Rename from eglot--versioned-identifier.
(eglot--diagnostics)
(eglot--flymake-diagnostics)
(eglot-handle-notification)
(eglot--signal-textDocument/didOpen)
(eglot--report-to-flymake)
(eglot--apply-text-edits)
(eglot--VersionedTextDocumentIdentifier): Use eglot--docver.
(eglot--send-changes-hook): Rename from eglot--document-changed-hook.
(eglot--after-change): Don't run eglot--send-changes-hook here.
(eglot--signal-textDocument/didChange): Run it here.
(eglot--semtok-state): Rename from eglot--semtok-cache.
(eglot--semtok-inflight): Delete.
(eglot--handle-request semanticTokens/refresh): Nullify.
(eglot-semantic-tokens-mode): Tweak.
(eglot--semtok-after-send-changes): New hook.
(eglot--semtok-request)
(eglot--semtok-font-lock): Rewrite.
(eglot--after-revert-hook): Reinitialize semtok state.
Co-authored-by: Lua Viana Reis <me@lua.blog.br>
According to the commit msg of:
commit 0816da8e78
Author: João Távora <joaotavora@gmail.com>
Date: Mon Oct 21 16:07:38 2019 +0100
This is needed because M-x vc-revert preserves (or used to
preserve) major modes on revert.
* lisp/progmodes/eglot.el (eglot--after-revert-hook): Remove FIXME
comment.
Problem reported by David Caldwell (bug#79879).
* configure.ac: When configuring for GNUstep and the
Objective C compiler does not support even C99 features,
use the first flag of -std=gnu23, -std=gnu17, -std=gnu11, -std=gnu99
that works, instead of insisting on -std=c99 which (a) is too
strict and (b) can override another -std= option in an
undesirable way.
* lisp/treesit.el (treesit-auto-install-grammar): Add the value 'ask-dir'.
(treesit-ensure-installed): When 'treesit-auto-install-grammar' is
'ask' or 'ask-dir', ask for the directory to install the grammar library
using the first writable directory of 'treesit-extra-load-path' as default.
Also add the provided directory to 'treesit-extra-load-path' afterwards.
* src/treesit.c (treesit-extra-load-path): In the docstring
mention the fact that the first directory is special (bug#79862).
Problem reported by John Paul Adrian Glaubitz (bug#79876).
* src/data.c (Fash): Don’t assume stdc_leading_zeros, which
returns an unsigned integer of unspecified width, returns
a value narrower than EMACS_INT. Also, don’t munge the code to
worry about stdc_leading_zeros (0); unlike GCC’s __builtin_clz,
stdc_leading_zeros works fine on 0. And use a temporary to
avoid a cast.
Make completing-read-multiple do eager display of *Completions*
when the table requests it.
As a side-effect of the implementation, we now check again if
eager-display is enabled if we have to retry doing eager-display
due to being interrupted by user input. This is mildly nicer
since it gives the completion table a little more control: for
example, maybe the table only wants to do eager-display if the
minibuffer is empty; this change makes that work better.
* lisp/minibuffer.el (completions--start-eager-display)
(completing-read-default): Move the code for checking whether to
do eager-display into completions--start-eager-display.
* lisp/emacs-lisp/crm.el (completing-read-multiple): Call
completions--start-eager-display (bug#79858).
This patch adds tests for the following scenarios:
- Every element is handled (basic functionality)
- Result specified in SPEC is returned
- Bindings named "tail" are not shadowed by 'dolist'
* test/lisp/subr-tests.el (subr-tests--dolist--every-element-is-handled)
(subr-tests--dolist--returns-spec-result)
(subr-tests--dolist--does-not-shadow-tail-binding): New tests.
(Bug#79778)
Problem reported by Helmut Eller (bug#79886).
* src/lisp.h (USE_LSB_TAG): Adjust to alignas changes.
(alignas): For GCC and Clang, prefer __attribute__ ((__aligned__ (A)))
to alignas (A) even if the compiler claims to support the latter.
This works around a bug in GCC 14 i386 C23 alignas.
No need to worry about whether __alignas_is_defined is defined.
We dropped support for MSVC long ago, and nowadays only support
MinGW for the MS-Windows builds of Emacs.
* src/w32term.h:
* src/w32fns.c:
* src/w32.c:
* nt/inc/sys/socket.h:
* nt/inc/stdalign.h:
* nt/inc/ms-w32.h: Remove MSVC-specific code and preprocessor
conditions.
* nt/inc/ms-w32.h: Don't redirect Posix functions to MS _FOO
equivalents, as MinGW headers do that nowadays better, not
necessarily via functions, and do not disable that when __STDC__
is defined.
The core of the problem is that `completion-pcm--prepare-delim-re`
is designed to match a "delimiter" in the pattern but was misused
to match a sequence of delimiter chars in the completions.
* lisp/minibuffer.el (completion-pcm--delim-re): Rename from
`completion-pcm--prepare-delim-re` and change its calling convention.
(completion-pcm--segments->regex): Use it.
(completion-pcm-word-delimiters): Adjust accordingly.
* test/lisp/minibuffer-tests.el (completion-pcm--test-zerowidth-delim):
New test.
Port to planned glibc 2.43 (scheduled for February 2026),
which will support qualifier-generic standard functions; see:
https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690
For example, strchr (P, C) will return pointer to const if P is
pointer to const. The idea is to catch dumb programming errors when a
program mistakenly uses strchr to convert a pointer to const
to an unrestricted pointer. This feature is required by C23,
and will be enabled by default in GCC 15.
* src/callint.c (Fcall_interactively):
Respect constness of pointer when calling memchr.
* src/gtkutil.c (xg_get_font):
2nd arg is char *, not const char *.
* src/xfaces.c (parse_float_color_comp): Return bool, not double.
New arg DST. All callers changed. This makes it easier for
callers to use char const *.
(parse_color_spec): Respect constness of pointer when calling strchr.
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Check for ':' and
'=>' as previous tokens, and handle symbols ending with ':' to
properly indent keyword argument arrays and hashes when
ruby-bracketed-args-indent is nil.
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--parent-call-or-bol):
Handle arrays/hashes that are children of 'pair' nodes (keyword
arguments) to ensure consistent indentation.
* test/lisp/progmodes/ruby-mode-resources/ruby-bracketed-args-indent.rb:
Add test cases for keyword argument arrays and hashes with both
symbol-colon and hash-rocket syntax.
When ruby-bracketed-args-indent is nil, arrays and hashes used as
keyword argument values now indent by ruby-indent-level from the
line start, matching the documented behavior and fixing inconsistent
indentation (bug#74517).
(https://lists.gnu.org/archive/html/emacs-devel/2025-11/msg00939.html)
* lisp/cus-start.el: Make 'abbrev-mode' customizable.
* doc/emacs/abbrevs.texi (Abbrev Concepts):
* etc/NEWS:
* src/buffer.c (syms_of_buffer): <abbrev-mode>: Document
enabling Abbrev mode by default in all buffers by customizing
'abbrev-mode' to a non-nil value.
* lisp/vc/vc-dir.el (vc-dir-mark-file): Prompt before unmarking
all subitems. Use y-or-n-p and user-error instead of
yes-or-no-p and error.
(vc-dir-unmark-file): Use y-or-n-p instead of yes-or-no-p.
(vc-dir-allow-mass-mark-changes): Update docs.
* lisp/vc/diff-mode.el (diff-revert-and-kill-hunk): When the
region is active, operate on all hunks it overlaps.
* doc/emacs/files.texi (Diff Mode):
* etc/NEWS: Document the change.
* lisp/vc/diff-mode.el (diff-apply-buffer): New 'no-save'
meaning for fourth optional argument. Reserve other non-nil
values for this argument. Use ngettext for one message.
(diff-apply-hunk): If the region is active, apply all hunks that
the region overlaps, like diff-apply-buffer.
* doc/emacs/files.texi (Diff Mode):
* etc/NEWS: Document the change to diff-apply-hunk.
* lisp/progmodes/cc-defs.el (c-version): Add a comment
encouraging maintainers to keep cc-mode.el's Version: header
the same.
* lisp/progmodes/cc-mode.el (top level): Update the Version:
header to 5.35.2.
* lisp/mouse.el (mouse-position-for-drag-line): New function;
return position of active touch screen tool if a sequence is
being translated into mouse movement events, and the last mouse
position otherwise.
(mouse-drag-line): Invoke `mouse-position-for-drag-line' rather
than reading the mouse position manually.
* lisp/touch-screen.el (touch-screen-current-tool): New 10th
field holding the frame-relative last attested position of this
tool.
(touch-screen-relative-xy): Clarify doc string.
(touch-screen-handle-point-update): Update the said field with
POSN's position relative to its frame.
(touch-screen-handle-touch): Initialize the 10th field of new
tool lists with such a position.
(touch-screen-last-drag-position): New function.
* lisp/emacs-lisp/package.el (package-dir-info, package-unpack):
Force Dired to return list of packages explicitly marked for
installation. Without the optional argument, Dired will return
the file under the current point if no files are selected.
* lisp/emacs-lisp/cond-star.el (cond*-convert-condition): Bind
unused values to fresh symbols, to avoid the compiler warning
that a symbol starting with an underscore is accessed later on.
This mirrors the behaviour of `if-let*' and family.
* lisp/replace.el (replace--push-stack): Add new args
'next-replacement' and 'match-again' and push them to the stack.
(perform-replace): Restore the previous already calculated values
of 'next-replacement' and 'match-again' from the stack for the
'backup' ('^') key (bug#79811).
* test/lisp/replace-tests.el (query-replace-tests): Add tests.
See https://github.com/editorconfig/editorconfig-emacs/issues/380
* lisp/editorconfig-core-handle.el (editorconfig-core-handle--parse-file):
Fix regexp to not inadvertently match LF. Remove an O(N²) complexity.
Use `line-number-at-pos`.
* lisp/editorconfig.el (editorconfig--get-coding-system): Don't let
errors propagate.
* java/org/gnu/emacs/EmacsNative.java (setEmacsParams): New arg
UIMODE.
(sendConfigurationChanged): New args DETAIL and UI_MODE.
* java/org/gnu/emacs/EmacsNoninteractive.java (main1): Provide
an undefined UI mode.
* java/org/gnu/emacs/EmacsService.java (EmacsService): New field
uiMode.
(onCreate): Initialize this field at start-up and provide the
same to setEmacsParams.
(onConfigurationChanged): If the UI mode has been altered,
generate a configuration changed event to match.
* src/android.c (android_ui_mode): New variable.
(setEmacsParams): New argument UI_MODE. Initialize the same
from this variable.
* src/androidgui.h (enum android_configuration_changed): New
enum.
(struct android_configuration_changed_event): New field
`DETAIL'. Convert fields providing specifics into a union of
display density information and a UI mode integer.
* src/androidterm.c (handle_one_android_event): Handle both
manners of configuration change events.
(android_term_init): Initialize Vtoolkit_theme from UI mode
provided at start-up.
* src/frame.c (syms_of_frame): Always define Vtoolkit_theme.
Define Qtoolkit_theme_set_functions.
* src/gtkutil.c (xg_update_dark_mode_for_all_displays):
* src/w32term.c (w32_read_socket): Generate special toolkit
theme events, rather than executing hooks directly within the
read_socket callback.
* src/keyboard.c (kbd_buffer_get_event)
<TOOLKIT_THEME_CHANGED_EVENT>: Run Qtoolkit_theme_set_functions
and set Vtoolkit_theme from event->ie.arg.
* src/termhooks.h (enum event_kind): New event
TOOLKIT_THEME_CHANGED_EVENT.