Commit graph

13071 commits

Author SHA1 Message Date
João Távora
ec5479f0b5 Eglot: fix thinko in eglot--async-request
Just because a specific request of a specific "hint" is
cancelled doesn't mean we can cancel the other's too.  Also
eglot-advertise-cancellation = nil was subtly broken.

This manifested itself mostly in Eglot semantic tokens.

* lisp/progmodes/eglot.el (eglot--async-request): Fix thinkos.
2026-02-05 22:39:19 +00:00
Mattias Engdegård
ac07913bd8 ; * lisp/progmodes/elisp-mode.el: slightly better rescanning point
Suggested by Stefan Monnier.
2026-02-01 13:25:28 +01:00
Mattias Engdegård
385bcc6117 Fix lazy doc string fontify bug in elisp-byte-code-mode (bug#80292)
* lisp/progmodes/elisp-mode.el (elisp-byte-code-syntax-propertize):
Reset point to just after the start of the previous match so that we
don't skip past the end of the lazy string, which can happen if it's
zero-length; that could lead to an infinite loop.
2026-01-31 18:58:29 +01:00
João Távora
d0daaead22 Eglot: recall diagnostics froms unopened files on session start
This is exclusively for the benefit of rust-analyzer, which
sends publishDiagnostics for all project files upfront, and
never republishes them on 'didOpen'.

See https://github.com/joaotavora/eglot/issues/1531.

* lisp/progmodes/eglot.el (eglot--flymake-handle-push): Simplify.
Don't flymake-list-only-diagnostics here.
Save original diagnostic in flymake-list-only-diagnostics setting.
(eglot--on-shutdown): Cleanup flymake-list-only-diagnostics.
(eglot--flymake-report-push+pulled): Hack in data from
flymake-list-only-diagnostics.
2026-01-30 12:55:32 +00:00
Juri Linkov
077b33ef7d * lisp/progmodes/eglot.el (eglot-server-programs): Use "elp" for erlang-mode.
erlang_ls has been archived in favour of erlang-language-platform.
Suggested by Alan & Kim Zimmerman <alan.zimm@gmail.com> (bug#79943).
2026-01-30 09:53:30 +02:00
Dmitry Gutov
3937833fff xref-find-backend: Error instead of returning nil
* lisp/progmodes/xref.el (xref-find-backend):
Signal error when we can't find a backend to use (bug#80246).
2026-01-29 17:11:45 +02:00
Dmitry Gutov
dfc2a66ad8 xref-matches-in-directory and xref-matches-in-files: More consistency
* lisp/progmodes/xref.el (xref--parse-hits, xref--sort-hits):
Extract from xref-matches-in-directory and xref-matches-in-files.
Use in both for better consistency between these functions.
2026-01-28 23:48:04 +02:00
Dmitry Gutov
d44b855b0c xref-matches-in-directory: Don't error on "Binary file ... matches"
* lisp/progmodes/xref.el (xref-matches-in-directory):
Consider the "Binary file ... matches" message (bug#80246).
2026-01-28 22:10:34 +02:00
Daniel Mendler
32cffe1707 Customizable xref-references-in-directory backend
Optionally use find and grep directly instead of going through the
Semantic framework (bug#80246).

* lisp/progmodes/project.el (project--vc-ignores): Require 'vc' to
ensure that vc-default-ignore-completion-table is available.

* lisp/progmodes/xref.el (xref-references-in-directory-function):
New user option.
(xref-references-in-directory): Call it.
(xref-references-in-directory-grep): Implementation based on find/grep.
(xref-references-in-directory-semantic): Implementation using Semantic.
(xref-matches-in-directory): Add new argument DELIMITED.

Co-authored-by: Dmitry Gutov <dmitry@gutov.dev>
2026-01-28 04:38:58 +02:00
Philip Kaludercic
bff916d7f9
Have default 'compile-command' run make in parallel
* lisp/progmodes/compile.el (compile-command): Change default
value.

(Bug#80065)
2026-01-25 12:26:19 +01:00
Dmitry Gutov
3573116d3e ; Fix indentation in project.el 2026-01-24 06:48:29 +02:00
Dmitry Gutov
b7d4681908 Stop project-query-replace-regexp failing on directory symlinks
* lisp/progmodes/project.el (project--files-safe): New function.
(project-search, project-query-replace-regexp): Use it (bug#78209).
2026-01-24 06:45:32 +02:00
João Távora
f2250ba244 Eglot: simplify Imenu setup again
See https://github.com/joaotavora/eglot/issues/1569.

* lisp/progmodes/eglot.el (eglot--managed-mode): Tweak.

* etc/EGLOT-NEWS: Tweak.
2026-01-21 23:09:19 +00:00
João Távora
10b132006e Eglot: display more readable server-originated messages
* lisp/progmodes/eglot.el (eglot--format-server-message): New helper.
(eglot-handle-notification<window/showMessage>)
(eglot-handle-request<window/showMessageRequest>): Use it.
2026-01-21 23:08:39 +00:00
Juri Linkov
8063921808 Fix down-list navigation in python-ts-mode
* lisp/progmodes/python.el (python-ts-mode):
Set 'treesit-sexp-thing-down-list' to 'list' to override
sexp navigation with list navigation (bug#72478).

* lisp/emacs-lisp/lisp.el (up-list): Mention 'up-list-function' in docstring.
2026-01-21 20:02:56 +02:00
Binbin Ye
8ea6f6da77 Add JSON path utility command to json-ts-mode
* lisp/progmodes/json-ts-mode.el (json-ts--get-path-at-node)
(json-ts--path-to-jq, json-ts--path-to-python): New functions.
(json-ts-jq-path-at-point): New command for getting JSON path at point.

* test/lisp/progmodes/json-ts-mode-tests.el: New file.
Add tests for the utility command.

* etc/NEWS: Announce new command 'json-ts-jq-path-at-point' (bug#80190).
2026-01-21 19:27:03 +02:00
João Távora
9d8e1af6f4 Eglot: fix textDocument/prepareRename support
Can't send prepareRename requests willy-nilly.

See https://github.com/joaotavora/eglot/issues/1554.

* lisp/progmodes/eglot.el (eglot--rename-interactive): Fix.
(eglot-client-capabilities): Advertise "prepareSupport".

* etc/EGLOT-NEWS: Mention change.
2026-01-21 12:26:24 +00:00
João Távora
f643ad53c7 Eglot: set imenu-create-index-function without advice
See https://github.com/joaotavora/eglot/issues/1569.

* lisp/progmodes/eglot.el (eglot--managed-mode): Stomp on
imenu-create-index-function conditionally.
(eglot-imenu): Don't check eglot-server-capable here.

* etc/EGLOT-NEWS: Mention change.
2026-01-21 12:26:24 +00:00
João Távora
d3548aea96 Eglot: limit the number of file watches
Some language servers request file watching for a very large number of
directories (e.g. Python virtualenvs), which can exhaust system
resources and cause slow startup.

https://github.com/joaotavora/eglot/issues/1568

* lisp/progmodes/eglot.el (eglot-max-file-watches): New variable.
(eglot--count-file-watches): New function.
(eglot--watch-globs): Use them to limit watches.  Signal jsonrpc-error
when limit is reached.
(eglot-watch-files-outside-project-root): Fix docstring punctuation.

* etc/EGLOT-NEWS: Mention change.
2026-01-21 12:26:24 +00:00
João Távora
a3ea65a984 Eglot: support more complex workspace edits (create/rename/delete)
Advertise support for file resource operations in workspace edits.
Implement create, rename, and delete file operations.  Rework
confirmation UI to handle mixed operation types.

* lisp/progmodes/eglot.el (eglot--lsp-interface-alist): Add
CreateFile, RenameFile, DeleteFile interfaces.
(eglot-client-capabilities): Advertise resourceOperations and
failureHandling.
(eglot-handle-request<workspace/applyEdit>): Return failureReason.
(eglot--apply-text-edits): Tweak error message.
(eglot--propose-changes-as-diff): Adjust for new prepared format.
Return buffer.
(eglot--apply-workspace-edit): Rework.  Handle file operations.

* etc/EGLOT-NEWS: Mention change.
2026-01-21 12:26:24 +00:00
João Távora
f02a120f18 Eglot: overhaul eglot-confirm-server-edits defcustom
Now also accepts file operation kinds as keys in the alist form.

* lisp/progmodes/eglot.el (eglot-confirm-server-edits): Rework
default value, docstring and defcustom type.
(eglot--confirm-server-edits): Also check for operation-kind-based
entries.
2026-01-21 12:26:24 +00:00
João Távora
b40e89e523 Eglot: default eglot-advertise-cancellation to t
The current 2026 landscape suggests servers (especially gopls
and ocamllsp) take advantage of this, so let's give it to them
by default.

* lisp/progmodes/eglot.el (eglot-advertise-cancellation):
Default to t.

* etc/EGLOT-NEWS: Mention change.
2026-01-21 12:26:24 +00:00
João Távora
155f524f03 Eglot: handle user quits when applying server-initiated edits
If the user simply C-g's signal a 'jsonrpc-error' with code 32000 to
mean "no error", provide an LSP :failureReason and keep server chill.

* lisp/progmodes/eglot.el (eglot-handle-request<workspace/applyEdit>>):
2026-01-21 12:26:24 +00:00
João Távora
7216d7ff87 Eglot: ensure no timeout on remote command executions
Else, if the server asks us a question, the user has just 10
seconds to ponder, which is a bit silly.

* lisp/progmodes/eglot.el (eglot-execute): Pass timeout=nil to
eglot--request.
2026-01-21 12:26:24 +00:00
João Távora
0917169782 Eglot: slightly friendlier UI for server window/showMessageRequest
Previously, the default answer pre-filled in the minibuffer was
obscuring the other possible answers.

* lisp/progmodes/eglot.el
(eglot-handle-request<window/showMessageRequest>): Rework.
2026-01-21 12:26:24 +00:00
João Távora
ff5bab9552 Eglot: advertise cancellation on eglot--request quits
* lisp/progmodes/eglot.el (eglot--request): Pass CANCEL-ON-QUIT
to jsonrpc-request.
2026-01-21 12:26:24 +00:00
João Távora
81b7e8e927 Eglot: fix async request cancellation
It was completely broken, with a cancel being set for every sent (and
probably already received) async request, and no actual discarding
of the response of a cancelled request.

* lisp/progmodes/eglot.el (eglot--async-request): Fix cancellation
of async requests.
(eglot--semtok-request): Don't need 'buf' &aux anymore.
2026-01-21 12:26:24 +00:00
João Távora
977e354709 Eglot: treat code=0 JSONRPC errors as benign
* lisp/progmodes/eglot.el (eglot--request): Shoosh code=0 errors.
(eglot-mode-line-error): Check for code=0.
2026-01-21 12:26:24 +00:00
Elías Gabriel Pérez
ff64470139 hideshow: Use 'message' instead of 'user-error'. (Bug#80201)
Using 'user-error' in 'hs-minor-mode', prevents the major-mode
from initializing correctly when hideshow is not supported in
that mode, using 'message' instead fixes this.

* lisp/progmodes/hideshow.el (hs-minor-mode): Tweak.
2026-01-21 09:46:23 +02:00
Wilson Snyder
72a34eceb9 verilog-mode.el: Fix parameter replacements in AUTOINST.
* lisp/progmodes/verilog-mode.el (verilog-auto-inst-port): Fix
parameter replacements in AUTOINST (#1903).
2026-01-18 09:59:17 -05:00
kobarity
83b4f1ba26 Performance improvement of 'python-shell-get-process'
'python-shell-get-process' is frequently called from
'python-eldoc--get-doc-at-point' and etc., invoking
'project-current' unless there is a buffer-specific Inferior
Python process.  When the buffer is a remote buffer not
belonging to any project and has significant latency,
'project-current' may take a long time.  To avoid this,
implement a process cache in 'python-shell-get-process'.

* lisp/progmodes/python.el (python-shell--process-cache)
(python-shell--process-cache-valid): New variables.
(python-shell--invalidate-process-cache): New function.
(python-shell-make-comint): Add a call to the above function.
(python-shell-get-process): Add process cache.  (Bug#80045)
2026-01-17 18:09:03 +02:00
Jostein Kjønigsen
83f4e48106 csharp-mode.el: Fix indentation after preprocessor statements
* lisp/progmodes/csharp-mode.el (csharp-ts-mode--indent-rules):
Add rules for preprocessor statements.  (Bug#80202)
2026-01-17 17:34:16 +02:00
Pig Fang
023bf05816 Eglot: support 'wat-mode'
* lisp/progmodes/eglot.el (eglot-server-programs): Add wat_server.
(Bug#80188)

Copyright-paperwork-exempt: yes
2026-01-17 17:02:19 +02:00
USAMI Kenta
c68c5fbe14 ; Remove redundant cl-lib runtime dependencies across lisp/
* lisp/editorconfig-tools.el:
* lisp/emacs-lisp/shorthands.el:
* lisp/info-xref.el:
* lisp/international/quail.el:
* lisp/international/rfc1843.el:
* lisp/mail/ietf-drums.el:
* lisp/mail/rfc2047.el:
* lisp/mail/yenc.el:
* lisp/net/pop3.el:
* lisp/net/sasl-scram-sha256.el:
* lisp/net/shr-color.el:
* lisp/progmodes/grep.el:
* lisp/scroll-bar.el:
* lisp/textmodes/emacs-news-mode.el:
* lisp/textmodes/reftex-auc.el:
* lisp/textmodes/reftex-dcr.el:
* lisp/textmodes/reftex-global.el:
* lisp/textmodes/reftex-sel.el:
* lisp/url/url-dav.el:
* lisp/vc/vc-src.el:
* lisp/xwidget.el:
* lisp/yank-media.el: Remove redundant (require 'cl-lib).
(Bug#80129)
2026-01-17 15:32:15 +02:00
kobarity
c97b8e6650 Improve non-native completion in Python mode
Previously, both the definition of __PYTHON_EL_get_completions
and the call to __PYTHON_EL_get_completions were sent to the
inferior Python each time
'python-shell-completion-get-completions' was executed.
However, there is no need to send the definition every time as
long as the definition remains unchanged.  We improved this so
that the definition of __PYTHON_EL_get_completions is only sent
during the inferior Python initialization; it is no longer sent
during 'python-shell-completion-get-completions' execution.
* lisp/progmodes/python.el
(python-shell-completion-send-setup-code): New function.
(python-shell-first-prompt-hook): Add the above new function.
(python-shell-completion-get-completions): Omit sending
'python-shell-completion-setup-code'.  (Bug#80182)
2026-01-17 15:05:33 +02:00
Rudolf Adamkovič
c86067778b Update SQLite font-lock rules
* lisp/progmodes/sql.el (sql-mode-sqlite-font-lock-keywords):
Synchronize all SQLite keywords with the official documentation.
2026-01-15 10:56:45 +00:00
Eli Zaretskii
18f9f0bdc9 ; Update Project documentation due to recent changes
* etc/NEWS:
* doc/emacs/maintaining.texi (Projects):
* lisp/progmodes/project.el (project-mode-line): Update
documentation due to changes in bug#78545.
2026-01-15 08:52:20 +02:00
Juri Linkov
1e6d8e6750 * lisp/progmodes/project.el: Improve performance of 'project-mode-line'.
(project-name-cache-timeout): New variable.
(project-name-cached): New function (bug#78545).
(project-mode-line): New value 'non-remote'.
(project-mode-line-format): Don't show the remote project's name
when 'project-mode-line' is 'non-remote'.  Use 'project-name-cached'.
2026-01-14 20:07:23 +02:00
Stefan Monnier
9dcf0bc428 Fix recent test suite regression (bug#80177)
* lisp/emacs-lisp/cl-generic.el (cl--generic-make-function):
Preserve advertised-calling-convention info.

* test/lisp/emacs-lisp/pcase-tests.el (pcase-tests-quote-optimization):
Require `byte-opt` to fix the test when the compiler is not loaded yet.

* lisp/progmodes/elisp-mode.el: Fix some >80column problems.
(elisp--xref-format-extra)
(elisp--xref-format): Make them constant, now that we don't have
the purespace.  Also, use %S since some of the elements
don't necessarily have names and even if they do, we'd want to
escape any funny characters in them to avoid ambiguities.
(elisp--xref-find-definitions): Fix uses of
`elisp--xref-format-extra` accordingly.
Improve heuristic to distinguish proper `cl-defgeneric` from
implicit ones.
(elisp-eldoc-docstring-length-limit)
(elisp-eldoc-funcall-with-docstring-length): Remove redundant `:group`.
* lisp/cedet/mode-local.el (xref-mode-local-overload): Pass the
override symbol rather than its name through `elisp--xref-format-extra`.
* test/lisp/progmodes/elisp-mode-tests.el (find-defs-constructor):
Adjust test to new text.
2026-01-11 18:26:53 -05:00
João Távora
990ef36510 Eglot: support textDocument/prepareRename for more accurate eglot-rename
See https://github.com/joaotavora/eglot/issues/1554.

* lisp/progmodes/eglot.el (eglot--rename-interactive): New helper.
(eglot-rename): Use it.
2026-01-11 18:28:25 +00:00
Eli Zaretskii
588d95e91d Fix Emacs responsiveness when debugging many thread-exit events
* lisp/progmodes/gdb-mi.el (gdb-start-wait-for-pending): New
function.
(gdb-thread-exited): Call 'gdb-start-wait-for-pending' to make
sure the timer which waits for pending GDB commands is launched
just once, even if many =thread-exited notifications are received
at a high rate.  Suggested by Neil Roberts <bpeeluk@yahoo.co.uk>.
(Bug#80157)
2026-01-11 17:19:49 +02:00
João Távora
12730179ac Eglot: release version 1.21
* lisp/progmodes/eglot.el (Version): Bump to 1.21.

* etc/EGLOT-NEWS: Announce new version.
2026-01-11 13:15:27 +00:00
João Távora
d33ef0c5ca Eglot: properly announce semantic tokens support to servers
* lisp/progmodes/eglot.el (eglot-client-capabilities): Property
annouce semantic tokens.
2026-01-11 13:15:27 +00:00
João Távora
67dd97a4f7 Eglot: solve misc Elisp compatibility problems on Emacs 26.3
* lisp/progmodes/eglot.el (eglot--semtok-request)
(eglot--semtok-after-send-changes): Unbreak for 26.3.

* test/lisp/progmodes/eglot-tests.el (eglot--tests-connect): Use
  split-string.
  (eglot-test-rust-completion-exit-function): Use skip-unless.
2026-01-11 13:15:27 +00:00
João Távora
a59fafde75 Eglot: don't use text-property-search-forward unavailable on 26.3
* lisp/progmodes/eglot.el (eglot--format-markup)
(eglot--semtok-font-lock-2): Rewrite.

* test/lisp/progmodes/eglot-tests.el (eglot--semtok-wait): Rewrite.
2026-01-11 13:15:27 +00:00
João Távora
25a6f28ad5 Eglot: release version 1.20
* lisp/progmodes/eglot.el (Version): Bump to 1.20.

* etc/EGLOT-NEWS: Announce new version.
2026-01-11 03:42:01 +00:00
João Távora
4e6a81da6c Eglot: add new command 'eglot-momentary-inlay-hints'
* doc/misc/eglot.texi (Eglot Commands)
(Customization Variables): Advertise eglot-momentary-inlay-hints.

* etc/EGLOT-NEWS: Advertise new command.

* lisp/progmodes/eglot.el (eglot--momentary-hints-data): New variable.
(eglot-momentary-inlay-hints): New command.
2026-01-11 03:42:01 +00:00
João Távora
fde1a5ebeb Eglot: de-spam eglot-mode-line-progress
Too spammy when many progress reporters are created by servers
such as rust-analyzer.

* lisp/progmodes/eglot.el (eglot-mode-line-progress): Tweak.
2026-01-11 03:42:01 +00:00
João Távora
fefd6526e2 Eglot: enhance eglot-list-connections-mode
* lisp/progmodes/eglot.el (eglot-list-connections-mode)
(eglot-list-connections): Tweak.
2026-01-11 03:42:01 +00:00
João Távora
7e13073c3c Eglot: don't notify server of in-disk changes for managed files
Not only is this notification strictly redundant for files
managed by Eglot (since didSave, didClose and didChange are
scrupulously sent), but it also confuses some serers which end
up posting a bunch of useless textDocument/publishDiagnostics,
for example.
2026-01-11 03:42:01 +00:00