Commit graph

13194 commits

Author SHA1 Message Date
João Távora
13b29eebc1 Eglot: use standard face for completion annotations (bug#81088)
* lisp/progmodes/eglot.el (eglot-completion-at-point): Use
completions-annotations face, not font-lock-function-name-face.
2026-05-21 10:33:37 +01:00
João Távora
8f31ccbf82 Eglot: announce markdown support for completion docs
No reason not to.  Tested with gfm-view-mode and markdown-ts-mode

* lisp/progmodes/eglot.el (eglot-client-capabilities): Annouce
markdown support for completion docs.
2026-05-20 00:51:57 +01:00
Lin Sun
7d84e69a34 hideshow: Menu entry for 'hs-toggle-all'
* lisp/progmodes/hideshow.el: Menu entry for hs-toggle-all (bug#81045).
2026-05-19 18:30:57 +03:00
João Távora
9436d92c5d Eglot: fix eglot--format-makrup when MARKUP just a string
* lisp/progmodes/eglot.el (eglot--format-markup): Fix case where
markup is string.
2026-05-18 23:14:49 +01:00
João Távora
389874c533 Eglot: unbreak for treesit-less builds
* lisp/progmodes/eglot.el
(eglot--builtin-mdown-p): New helper.
(eglot--accepted-formats)
(eglot--format-markup): Use it.
2026-05-18 20:53:15 +01:00
João Távora
eb90c528f3 ; * lisp/progmodes/eglot.el (eglot-code-action-indications): Tweak. 2026-05-18 16:27:35 +01:00
Brian Leung
6c1829bf4c Eglot: fix thinko in recent markdown-related commit (bug#81063)
* lisp/progmodes/eglot.el (eglot--format-markup): Correct return value
for gfm-view-mode.
2026-05-17 19:28:16 +01:00
João Távora
0977d5915d Eglot: add left-fringe code action indicator (bug#80326)
The fringe indicator uses a custom lightning-bolt bitmap, an alternative
to the margin indicator on GUI frames.  It is non-interactive, however.

* lisp/progmodes/eglot.el (eglot--fringe-action): New fringe bitmap.

(eglot-code-action-indications): Add 'left-fringe' to default value
and to docstring.  Update incompatibility note.

(eglot-code-action-suggestion): Handle 'left-fringe' indication.
2026-05-17 19:24:53 +01:00
Eli Zaretskii
f68e7a0a41 ; Improve documentation of commands that move by compilation errors
* lisp/simple.el (next-error):
* lisp/progmodes/compile.el (compilation-next-error)
(compilation-previous-error): Doc fixes.
2026-05-17 09:05:13 +03:00
Eli Zaretskii
cf96e9cb5a ; Fix byte-compilation warnings in non-Tree-Sitter builds
* lisp/progmodes/eglot.el (treesit-grammar-location):
* lisp/treesit.el (treesit-grammar-location): Declare.
2026-05-16 14:13:56 +03:00
João Távora
aba60ad0c5 Eglot: prefer markdown-ts-view-mode for markup rendering (bug#80127)
Eglot previously needed gfm-view-mode from markdown-mode.el to render
Markdown from LSP servers.  It now prefers markdown-ts-view-mode when
available.

* lisp/progmodes/eglot.el (eglot--accepted-formats): Recognize
markdown-ts-view-mode as a Markdown renderer.
(eglot--format-markup): Rework with cl-labels; prefer
markdown-ts-view-mode over gfm-view-mode.

* doc/misc/eglot.texi (Eglot Features): Don't mention
markdown-mode directly.

* etc/EGLOT-NEWS: Mention change
2026-05-14 11:05:30 +01:00
Elias Gabriel Perez
3630baae72 hideshow: Support new 'margin' face for margin indicators. (Bug#80693)
* lisp/progmodes/hideshow.el (hs-indicator-hide): Remove 'default' face.
(hs--make-indicators-overlays): Rework.
2026-05-12 18:45:28 +03:00
Juri Linkov
20d17df3f4 Use the new 'margin' face in Flymake (bug#80693)
* lisp/progmodes/flymake.el (flymake--bs-display):
Use the 'margin' face when it's available.
2026-05-12 18:42:42 +03:00
Elias Gabriel Perez
0e7a24d931 * lisp/progmodes/hideshow.el (hs--set-variable): Use 'set-local' (bug#80999) 2026-05-11 20:35:14 +03:00
João Távora
56f27dd9f0 Eglot: fix eglot--sig-info with non-UTF-32 positionEncoding
Github-reference: https://github.com/joaotavora/eglot/discussions/1588

When the server negotiates positionEncoding utf-8 or utf-16,
ParameterInformation.label vector offsets are byte/code-unit counts
into the signature label, not character counts.  Using them raw caused
wrong highlights and crashes on Unicode-rich signatures.

* lisp/progmodes/eglot.el (eglot--sig-info): Mostly rewrite.
(eglot-move-to-utf-8-linepos-function): Tweak docstring.
(eglot-move-to-utf-8-linepos, eglot-move-to-utf-16-linepos): Return
position moved to.
2026-05-09 02:52:18 +01:00
Sean Whitton
2d496b842d ; Fix Gregor Schmid's attribution for lua-mode.el. 2026-05-08 13:47:52 +01:00
Sean Whitton
3c6c3f5a69 ; Fix two file headers misunderstood by authors.el. 2026-05-07 20:04:04 +01:00
Eshel Yaron
39e1505683
; Expand 'elisp-fontify-symbol' and 'elisp-scope-analyze-form' docs
See discussion at
https://yhetil.org/emacs/868q9wag3h.fsf@gnu.org/

* lisp/progmodes/elisp-mode.el (elisp-fontify-symbol):
* lisp/emacs-lisp/elisp-scope.el (elisp-scope-analyze-form):
Expand docstring.
2026-05-06 16:10:33 +02:00
Eli Zaretskii
a3f79f9da1 ; * lisp/progmodes/elisp-mode.el (elisp-fontify-semantically): Fix typo. 2026-05-05 21:40:48 +03:00
Eshel Yaron
b57124b747
; More 'elisp-scope' and 'elisp-fontify-semantically' doc improvements
See discussion at
https://yhetil.org/emacs/86y0hy9e6g.fsf@gnu.org/

* lisp/emacs-lisp/elisp-scope.el (elisp-scope-analyze-form):
Add example in docstring.
* lisp/progmodes/elisp-mode.el (elisp-fontify-semantically):
Clarify use of 'cursor-sensor-mode'.
2026-05-05 19:10:45 +02:00
Eshel Yaron
5789621632
elisp-mode: Cache 'help-echo' function results (bug#80948)
This ensures we only compute the 'help-echo' string once per
symbol in a certain position.

* lisp/progmodes/elisp-mode.el
(elisp--annotate-symbol-with-help-echo): Add caching for
when the symbol role's :help property is a function.
2026-05-05 11:19:30 +02:00
Eshel Yaron
288f8d0b05
; (elisp-fontify-symbol): Improve docstring. 2026-05-05 11:19:30 +02:00
Eli Zaretskii
151ea29a8e ; Fix doc string of 'elisp-fontify-semantically' (bug#80948)
* lisp/progmodes/elisp-mode.el (elisp-fontify-semantically): Doc fix.
2026-05-05 10:05:28 +03:00
João Távora
2207a58899 Eglot: find well behaved UTF char for code actions (bug#80326)
* lisp/progmodes/eglot.el (eglot-code-action-indicator): No lighbulb, no
fancy lightning bolt, just use zigzags which seem to display well on
typical fonts and typically have a width of 1.
2026-05-02 09:56:41 +01:00
Sean Whitton
4795e83a69 Project prompters always default to current project, if any
* lisp/progmodes/project.el (project-prompter)
(project-prompt-project-dir, project-prompt-project-name):
Delete ALLOW-EMPTY parameter.  Default to the current project if
there is one.
* lisp/vc/vc.el (project-root): Declare.
(vc--prompt-other-working-tree): Replace ALLOW-EMPTY parameter
with new ALLOW-CURRENT parameter.
(vc-working-tree-switch-project): Allow selecting the current
working tree, for symmetry with project-switch-project.
* etc/NEWS: Update.
2026-05-02 09:38:04 +01:00
Sean Whitton
d80c9e534d ; project.el: Use when-let* not if-let* where appropriate. 2026-05-01 10:46:16 +01:00
Yuan Fu
19696dbc24
; Add comment thing for c-ts-mode
* lisp/progmodes/c-ts-mode.el (c-ts-mode--thing-settings): Add
comment thing.
2026-04-30 21:30:28 -07:00
Jonas Bernoulli
800a272b62
Fix defining a few faces as empty
e72afa9dbf replaced nil, which is invalid as a face definition,
with ((t (:inherit default))), but that does not actually result in
an "empty" face, which doesn't set any attributes.  Instead it doubles
down on all attributes set for the default face.  Replace that with
((t)), which accomplishes what appears to have been the intention.

* lisp/net/shr.el (shr-h4, shr-h5, shr-h6):
* lisp/nxml/nxml-mode.el (nxml-text):
* lisp/progmodes/make-mode.el (makefile-shell): Use empty face
definition ((t)), instead of ((t (:inherit default))).
2026-04-27 21:35:44 +02:00
Sean Whitton
df6fb6fafb ; Fix & improve last change. 2026-04-26 12:21:05 +01:00
Kai Ma
9a7bc6b930 New user option compilation-search-extra-path
* lisp/progmodes/compile.el (compilation-search-extra-path): New
option (bug#80279).
(compilation-start): Use it.
(compilation-search-path):
* doc/emacs/building.texi:
* etc/NEWS: Document it, and also compilation-search-path.
2026-04-26 12:20:58 +01:00
João Távora
cd1a372ccf Eglot: add eglot--server-buffer-name and use it consistently
* lisp/progmodes/eglot.el (eglot--server-buffer-name): New function.

(eglot--connect): Rename events and stderr buffers after serverInfo
arrives to include the server's self-reported name.

(eglot-show-workspace-configuration, eglot-describe-connection)
(eglot--define-hierarchy-command): Use eglot--server-buffer-name.

(eglot--propose-changes-as-diff): Add SERVER argument; use
eglot--server-buffer-name.

(eglot--apply-workspace-edit): Add SERVER argument; pass server to
eglot--propose-changes-as-diff.

(eglot-handle-request workspace/applyEdit, eglot-execute)
(eglot-rename): Pass server to eglot--apply-workspace-edit.
2026-04-22 09:08:36 +01:00
João Távora
ca816386e7 Eglot: add eglot--server-name helper
* lisp/progmodes/eglot.el (eglot--server-name): New function.
(eglot--list-connections-entries, eglot-describe-connection): Use it.
2026-04-22 09:08:36 +01:00
john muhl
c6ec2c6ce1 ; Cleanup defcustoms in 'lua-mode'
* lisp/progmodes/lua-mode.el (lua-always-show)
(lua-documentation-url): Add :version, remove :group.  (Bug#80840)
2026-04-21 16:36:41 +03:00
João Távora
28ead74772 Eglot: handle visited file name changes (typically C-x C-w)
When the user renames a buffer's file via set-visited-file-name,
notify the server with didClose (old URI) and didOpen (new URI).
The TextDocumentIdentifier cache still holds the old URI when
after-set-visited-file-name-hook fires, so didClose uses it
correctly; didOpen then clears and rebuilds it from the new name.

* lisp/progmodes/eglot.el (eglot--managed-mode): Hook and unhook
eglot--after-set-visited-file-name-hook.
(eglot--after-set-visited-file-name-hook): New function.
2026-04-21 11:03:50 +01:00
João Távora
baf7e6a44f Eglot: use Unicode box-drawing chars in hierarchy buffers
Use box-drawing characters for the tree guides in hierarchy
buffers when the display supports them.

* lisp/progmodes/eglot.el (eglot--hierarchy-2): Rework.
2026-04-21 11:03:49 +01:00
João Távora
1b2a8de314 Eglot: unbreak diagnostics in symlinked projects
Now that 'eglot-uri-to-path' tries to return
"project-root-familiar" paths, unresolving the absolute path
name, it's important to update 'eglot--find-buffer-visiting' to
consider the two alternative ways to refer to a file.  IOW, this
was already a bug, but the latest changes to 'eglot-uri-to-path'
made it more evident.

* lisp/progmodes/eglot.el (eglot--find-buffer-visiting): Also
consider buffer-file-name.
2026-04-20 16:13:57 +01:00
Stefan Monnier
e6873462ce (js-jsx--detect-after-change): Fix test regression
Commit 6942d508f0 made js-mode-regexp-syntax-bug-25529 fail,
because it changes the moment and place in which
`syntax-propertize` gets called, uncovering a bug where
`js-jsx--detect-after-change` narrows the buffer, then calls
`re-search-forward` which calls `syntax-propertize`, so we end
up doing `syntax-propertize` while narrowed which can fail in
all kinds of ways.

* lisp/progmodes/js.el (js-jsx--detect-and-enable): Change optional arg
to BEG and END.
(js-jsx--detect-after-change): Use them to avoid narrowing.

* lisp/emacs-lisp/syntax.el (syntax-propertize): Emit a message
when called narrowed and the narrowing starts later than the
nearest already propertized position.
2026-04-19 00:01:22 -04:00
Yuan Fu
1b8512d676
Fix c-ts-mode-set-style when STYLE is a function (bug#80777)
* lisp/progmodes/c-ts-mode.el (c-ts-mode-set-style): Prepend the
language symbol in front of the styles.
2026-04-17 18:25:28 -07:00
João Távora
cbbe2b5f55 Eglot: add M-x eglot-describe-connection
Also add more bindings to M-x eglot-list-connections

* lisp/progmodes/eglot.el (eglot-list-connections-mode-map): Add
bindings for e, w, RET.
(eglot-events-buffer-of-listed-connection)
(eglot-show-workspace-configuration-of-listed-connection)
(eglot-describe-listed-connection): New commands.
(eglot-describe-connection): New command.

* doc/misc/eglot.texi: Document new keys and eglot-describe-connection.

* etc/EGLOT-NEWS: Announce.
2026-04-17 00:19:51 +01:00
João Távora
ce06e8cdef Eglot: adjust previous change to eglot-uri-to-path
* lisp/progmodes/eglot.el (eglot-uri-to-path): Tweak.
2026-04-16 18:20:23 +01:00
João Távora
1c4c9d759a Eglot: add shutdown/reconnect bindings to eglot-list-connections buffer
* lisp/progmodes/eglot.el (eglot-list-connections-mode-map): New
defvar.

* lisp/progmodes/eglot.el (eglot--list-connections-entries): New
function, extracted from eglot-list-connections.

* lisp/progmodes/eglot.el (eglot--list-connections-cmd): New macro.

* lisp/progmodes/eglot.el (eglot-shutdown-listed-connection)
(eglot-reconnect-listed-connection): New commands.

* lisp/progmodes/eglot.el (eglot-list-connections): Use
eglot--list-connections-entries.

* doc/misc/eglot.texi: Document eglot-list-connections and new keys.

* etc/EGLOT-NEWS: Announce.
2026-04-16 09:28:21 +01:00
João Távora
213b8e0b97 Eglot: un-canonicalize server URIs to project's root
Some LSP servers prefer to canonicalize all document URIs to
their "true name", chasing all fs symbolic links.  If the user
is visiting a project under a symlink, say ~/myprojects/foo
which points to /data/true/projects/foo.  When visiting a
~/myprojects/foo/f.c and trying to jump to a nearby file f.h via
LSP 'xref-find-definitions', the path should probably be
~/myproject/foo/f.h, not /data/true/projects/foo/f.h.

Even though Emacs can recognize that the two files are the same,
'buffer-file-name' is not.  This confuses tools like C-x C-f,
ibuffer, and ultimately the users themselves who probably
oblivious to the true place of the project.  After all they
started Eglot under a syminked file.

* lisp/progmodes/eglot.el (eglot-lsp-server): Add trueroot slot.
(eglot-uri-to-path): Rework to consider trueroot and project root.
2026-04-16 08:05:13 +01:00
Toby Dylan Hocking
eb4835e521 Make | optional for 'gnu' regexp in compilation-mode (bug#80681)
* lisp/progmodes/compile.el
(compilation-error-regexp-alist-alist): Make leading '|'
optional when there are leading spaces (bug#80681).
* etc/compilation.txt (GNU style): New error with two leading
spaces.
* test/lisp/progmodes/compile-tests.el
(compile-test-error-regexps): Increment expected
compilation-num-errors-found.
(compile-tests--test-regexps-data): New error test case for
'gnu' with two leading spaces.  Change expected match for
'cucumber' to match again 'gnu'.

Copyright-paperwork-exempt: yes
2026-04-15 18:11:00 -04:00
Elias Gabriel Perez
d835775d9b hideshow: New function 'hs-add-cycle-binding' (Bug#80657)
https://lists.gnu.org/archive/html/emacs-devel/2026-02/msg00153.html

* lisp/progmodes/hideshow.el (hs-cycle-filter)
(hs-minor-mode-map): Update.
(hs--filter-function, hs-add-cycle-binding): New functions.
(hs-cycle): Minor rework.
2026-04-12 20:45:34 +03:00
Stefan Monnier
7d00565fee (elisp--font-lock-flush-elisp-buffers): Avoid eager font-locking
When jit-lock is not in use, `font-lock-flush` is too costly to
justify using it just to maybe update the highlighting of a few macro calls.

* lisp/progmodes/elisp-mode.el (elisp--font-lock-flush-elisp-buffers):
Skip buffers that use jit-lock, like the `*ielm*-comint-indirect` buffer.
2026-04-09 17:55:16 -04:00
Stefan Monnier
fc128826b5 (elisp--local-variables): Restore point earlier
* lisp/progmodes/elisp-mode.el (elisp--local-variables): Restore
point before calling `elisp--safe-macroexpand-all` in case this
triggers a temporary redisplay.
2026-04-09 14:32:15 -04:00
Stefan Monnier
0b30f7aa9d lisp/progmodes/project.el (generator): Don't require at run-time 2026-04-07 14:34:59 -04:00
Diep Pham
8205f39b6c Eglot: improve safety spec of eglot-workspace-configuration
* lisp/progmodes/eglot.el (eglot-workspace-configuration): Improve
safety spec.

Copyright-paperwork-exempt: Yes
2026-04-06 12:54:39 +01:00
Dmitry Gutov
9d5a24cfac grep-edit--prepare-buffer: Fix allowed insertion positions
* lisp/progmodes/grep.el (grep-edit--prepare-buffer): Fix allowed
insertion positions, like previously in xref-edit--prepare-buffer.
2026-04-03 04:38:59 +03:00
Dmitry Gutov
02c95dd92c xref-edit--prepare-buffer: Prohibit insertion before group headers too
* lisp/progmodes/xref.el (xref-edit--prepare-buffer): Do the
previous change for group headers as well (no insertion in front).
2026-04-03 04:33:14 +03:00