1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-07 15:21:46 +00:00
Commit Graph

164681 Commits

Author SHA1 Message Date
João Távora
647e40f4a0 ; And yet another fix to eglot-current-linepos-function's docstring
bug#61726

* lisp/progmodes/eglot.el (eglot-current-linepos-function):
Another fix.
2023-02-27 11:36:22 +00:00
Eli Zaretskii
9d0f856a16 Fix description of 'desktop-save-mode'
* doc/emacs/misc.texi (Saving Emacs Sessions): Adjust to changes
in 'desktop-path'.  Reported by Petteri Hintsanen <petterih@iki.fi>.
2023-02-27 13:31:47 +02:00
Yuan Fu
aee10ca1cb
Adjust tree-sitter defun navigation (bug#61617)
Before this change, when you use a tree-sitter navigation function to
move to the next beginning of a thing, it jumps over the immediate
next thing and lands you at the beginning of the next-next thing.

Eg, when point is at the "|", and we evaluate
(treesit--navigate-thing pos 1 'beg), we go from

|  (thing) (thing)

to

   (thing) |(thing)

But some might expect point to go to

   |(thing) (thing)

instead, which makes sense.  Also, that's how Emacs expect defun
navigation functions to work.  The discrepancy in expectation causes
bug#61617.

In this change I made tree-sitter navigation functions to work as what
Emacs expects.  And what I described for moving to the next beginning
of thing is similarly applicable to moving to the end of previous end
of thing.

* lisp/treesit.el (treesit-beginning-of-defun)
(treesit-end-of-defun): Handle the case where defun-skipper moves
point back to where we started, by adding a retry.

(treesit--navigate-thing): Add a single condition checking for
progress to the condition form responsible for checking whether to
skip the next defun.  Namely (eq pos (funcall advance next)))).

* test/src/treesit-tests.el:
(treesit--ert-defun-navigation-nested-master)
(treesit--ert-defun-navigation-top-level-master): Change tests to
reflect the new expectation.
2023-02-27 00:14:32 -08:00
Yuan Fu
edf5b97686
Simplify c-ts-mode--top-level-label-matcher
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--top-level-label-matcher): Make more assumptions and remove
the loop, so it's faster in large files.
2023-02-26 21:38:22 -08:00
Yuan Fu
0f15286c53
New tree-sitter indent anchor standalone-parent used by c-ts-mode
When writing c-ts-mode Theo used parent-bol which works well except
one case:

1 for (int i=0;
2      i < 5;
3      i++) {
4   func(i);
5 }

In this case, when indenting "func(i)", parent-bol returns the start
of "i++" on line 3, instead of the "correct" anchor, the start of
"for" on line 1.  parent-bol would have worked if the "for (...) {"
part is in one line.

To support this case I tried numerous things and added a bunch of
stuff, culminating in c-ts-common-statement-offset.  It's complicated,
requires extra setup, and slow.

Not anymore! I think the new anchor standalone-parent really captures
the logic behind how people expect indentation to work. It's simple
and fast, and requires no setup.

* doc/lispref/modes.texi (Parser-based Indentation): Update manual.

* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--standalone-grandparent): New anchor.
(c-ts-mode--indent-styles): Replace c-ts-common-statement-offset with
standalone-parent.
(c-ts-base-mode): Add comment.

* lisp/treesit.el:
(treesit-simple-indent-presets): New anchor standalone-parent.
2023-02-26 21:38:22 -08:00
Dmitry Gutov
267fc6d00c ruby-smie-rules: Fix misindentation of a method call after assignment
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Fix indentation of a
method call after assignment with ruby-after-operator-indent=nil
(bug#61822).

* test/lisp/progmodes/ruby-mode-resources/ruby-after-operator-indent.rb:
Add corresponding example.
2023-02-27 02:06:20 +02:00
Eli Zaretskii
0fde314f6f * lib-src/etags.c (process_file_name): Free malloc'ed vars (bug#61819). 2023-02-26 20:03:20 +02:00
Eli Zaretskii
dde9d149af ; Improve documentation of loading *.eln files
* doc/lispref/loading.texi (How Programs Do Loading):
* doc/emacs/building.texi (Lisp Libraries): Some additional
details about what happens with natively-compiled files.
2023-02-26 19:51:59 +02:00
Eli Zaretskii
7c552be89d ; Another doc fix in eglot.el
* lisp/progmodes/eglot.el (eglot-current-linepos-function):
Another doc fix.
2023-02-26 16:48:07 +02:00
João Távora
75c65fcc98 ; Fix last change
bug#61726

* lisp/progmodes/eglot.el (eglot-current-linepos-function): Fix docstring.
2023-02-26 14:05:47 +00:00
Eli Zaretskii
a3d15c1f74 ; Fix last change
* lisp/progmodes/eglot.el (eglot-current-linepos-function)
(eglot-utf-8-linepos, eglot-utf-16-linepos)
(eglot-utf-32-linepos, eglot-move-to-linepos-function)
(eglot-move-to-utf-8-linepos, eglot-move-to-utf-32-linepos): Doc
fixes.  (Bug#61726)
2023-02-26 15:24:11 +02:00
João Távora
ca79b138d4 Eglot: rename and redocument encoding-related functions (bug#61726)
* lisp/progmodes/eglot.el (eglot-current-column): Obsolete.
(eglot-lsp-abiding-column): Obsolete.
(eglot-current-column-function): Obsolete.
(eglot-current-linepos-function): Rename from eglot-current-column-function.
(eglot-utf-8-linepos): Rename from eglot-bytewise-column.
(eglot-utf-16-linepos): Rename from eglot-lsp-abiding-column.
(eglot-utf-32-linepos): Rename from eglot-current-column.
(eglot-move-to-current-column): Obsolete.
(eglot-move-to-lsp-abiding-column): Obsolete.
(eglot-move-to-column-function): Obsolete.
(eglot-move-to-linepos-function): Rename from eglot-move-to-column-function.
(eglot-move-to-utf-8-linepos): Rename from eglot-move-to-bytewise-column.
(eglot-move-to-utf-16-linepos): Rename from eglot-move-to-lsp-abiding-column.
(eglot-move-to-utf-32-linepos): Rename from eglot-move-to-current-column.
(eglot--managed-mode): Adjust.
(eglot-client-capabilities): Trim whitespace.

* test/lisp/progmodes/eglot-tests.el (eglot-test-lsp-abiding-column)
(eglot-test-lsp-abiding-column-1): Use new function/variable names.
2023-02-26 13:00:24 +00:00
Augusto Stoffel
3e3e6d71be Eglot: support positionEncoding LSP capability (bug#61726)
* lisp/progmodes/eglot.el(eglot-client-capabilities):  Announce the
new capability.
(eglot-bytewise-column, eglot-move-to-bytewise-column): New functions.
(eglot--managed-mode): Set 'eglot-current-column-function' and
'eglot-move-to-bytewise-column' appropriately.
2023-02-26 12:53:09 +00:00
Eli Zaretskii
b0e87e930e Eglot: use faster strategy for moving to LSP positions (bug#61726)
Turns out we don't need encode-coding-region after all.

* lisp/progmodes/eglot.el (eglot-move-to-lsp-abiding-column): Rewrite.

Co-authored-by: Augusto Stoffel <arstoffel@gmail.com>
2023-02-26 10:29:14 +00:00
Eli Zaretskii
5b174b9683 Fix mule-tests in UTF-8 locales
* test/lisp/international/mule-tests.el
(sgml-html-meta-no-post-less-than-10lines): Fix test condition.
2023-02-26 11:46:20 +02:00
Eli Zaretskii
5256392a7e Fix 'vertical-motion' when display strings are around
* src/indent.c (Fvertical_motion): Correct bidi-related condition
for character position, when we didn't move vertically.  (Bug#61636)
2023-02-26 11:34:14 +02:00
Yuan Fu
0db88d625a
; * src/treesit.c (treesit_predicate_match): Fix typo. 2023-02-26 01:12:33 -08:00
Dmitry Gutov
3cae0e3d96 python-ts-mode: Fix single-quote string fontification
* lisp/progmodes/python.el (python--treesit-fontify-string):
Look for ', not just ", as opening delimiter (bug#61796).
2023-02-26 03:12:34 +02:00
Michael Albinus
68d753e371 ; * etc/NEWS: Fix typos. 2023-02-25 18:45:14 +01:00
Eli Zaretskii
ab0cc4e781 Fix infloop in bidi.c
* src/bidi.c (bidi_set_paragraph_end): Reset the isolate_level to
zero.  Whenever stack_idx is reset to zero, the isolate_level must
also be reset, since there cannot be any isolate status outside of
embeddings.  Failure to reset isolate_level will cause us infloop
when we see a PDI.  Reported by Matt Beshara <m@mfa.pw>.
2023-02-25 17:19:15 +02:00
Eli Zaretskii
3b8b23f66d ; Fix doc string of 'emacs-lisp-byte-compile'
* lisp/progmodes/elisp-mode.el (emacs-lisp-byte-compile): Doc
fix.  (Bug#61784)
2023-02-25 15:51:04 +02:00
Daniel Martín
5cf50d6004
Check the anchor along with the offset in treesit-indent-region
* lisp/treesit.el (treesit-indent-region): To compute a valid column,
having a non-nil offset is not enough, we need a non-nil anchor as
well.
2023-02-24 21:12:47 -08:00
Daniel Martín
497018dd5c
; Fix typos in docstrings in c-ts-common.el
* lisp/progmodes/c-ts-common.el:
(c-ts-common-statement-offset): Fix typo.
2023-02-24 20:50:04 -08:00
Yuan Fu
03072bbdd3
; Set indent-tabs-mode to nil in c-ts-mode indent preproc test
* test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts: Set
indent-tabs-mode to nil.
2023-02-24 19:51:43 -08:00
Yuan Fu
4a25fa4586
Align to prev sibling for c-ts-mode indentation
As requested by a discussion on emacs-devel.

* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--anchor-prev-sibling): New function.
(c-ts-mode--indent-styles): Indent first child as before, indent the
rest to their previous sibling.  Remove bracketless statement rules
that I forgot to remove previously.
2023-02-24 19:51:43 -08:00
Yuan Fu
d25f24fe57
Fix c-ts-common-statement-offset and c-ts-common--node-is
* lisp/progmodes/c-ts-common.el:
(c-ts-common--node-is): Guard against case where the node has no field
name.
(c-ts-common-statement-offset): Do indent a level if the "if" in the
"else if" is on an independent line.
2023-02-24 19:51:43 -08:00
Dmitry Gutov
c92360c7a3 typescript-ts-mode: Highlight non-shorthand destructuring bindings
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--font-lock-settings): Highlight non-shorthand
variable bindings in object destructuring.
2023-02-25 03:54:31 +02:00
Dmitry Gutov
a795c51f60 Add more/finer faces for tree-sitter
* doc/lispref/modes.texi (Faces for Font Lock):
Update the list of faces (bug#61655).

* etc/NEWS: Update the list of new faces.

* lisp/cus-theme.el (custom-theme--listed-faces): Update.

* lisp/font-lock.el (font-lock-function-call-face)
(font-lock-variable-ref-face, font-lock-property-ref-face):
New faces.
(font-lock-property-name-face):
Rename from 'font-lock-property-face'.

* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings):
Use new faces.  More 'enumerator' query to 'definition' feature.
(c-ts-mode--fontify-declarator, c-ts-mode--fontify-variable):
Use new faces.

* lisp/progmodes/cmake-ts-mode.el
(cmake-ts-mode--font-lock-settings): Use new faces.

* lisp/progmodes/csharp-mode.el
(csharp-ts-mode--font-lock-settings): Use new faces.

* lisp/progmodes/go-ts-mode.el (go-ts-mode--font-lock-settings):
Use new faces.

* lisp/progmodes/java-ts-mode.el
(java-ts-mode--font-lock-settings): Use new faces.

* lisp/progmodes/js.el (js--treesit-fontify-assignment-lhs)
(js--treesit-font-lock-settings): Use new faces.  Highlight
variable definitions inside array and object destructuring
patterns.

* lisp/progmodes/python.el (python--treesit-variable-p):
Exclude identifiers in parameters.
(python--treesit-settings): Use new faces.  Highlight function
parameters.  Move 'keyword' up to still highlight 'self' as
keyword.

* lisp/progmodes/ruby-ts-mode.el (ruby-ts--font-lock-settings):
Use new faces.

* lisp/progmodes/rust-ts-mode.el
(rust-ts-mode--font-lock-settings): Use new faces.

* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--font-lock-settings): Use new faces.

* lisp/textmodes/css-mode.el (css--treesit-settings):
Use font-lock-property-ref-face.

* lisp/textmodes/toml-ts-mode.el
(toml-ts-mode--font-lock-settings):
Use font-lock-property-ref-face.

* lisp/textmodes/yaml-ts-mode.el
(yaml-ts-mode--font-lock-settings): Same.
2023-02-25 03:35:08 +02:00
Eli Zaretskii
146bce4932 Avoid crashes in batch mode due to lack of frame face cache
* src/xfaces.c (Finternal_merge_in_global_face): Handle frames
with no face cache.
2023-02-24 22:46:05 +02:00
Michael Albinus
244a73cd72 Add Tramp version integrated in Emacs 28.3
* lisp/net/trampver.el (customize-package-emacs-version-alist):
Add Tramp version integrated in Emacs 28.3.
2023-02-24 19:47:15 +01:00
Philip Kaludercic
b2ae4e77c7 Avoid reusing :lisp-dir twice in 'package-vc--main-file'
* lisp/emacs-lisp/package-vc.el (package-vc--main-file): Just use
:lisp-dir from 'package-desc-extras', not 'pkg-spec'.

This avoid appending the contents of :lisp-dir twice, in case it is
specified both in pkg-spec and pkg-desc.
2023-02-24 17:14:19 +01:00
Philip Kaludercic
068f8fa303 Ensure right package-desc-type before installing package
* lisp/emacs-lisp/package-vc.el (package-vc--unpack): Move copying
code from 'package-vc-install'.
(package-vc-install): Remove copying.  (Bug#61669)
2023-02-24 17:14:19 +01:00
Stephen Berman
925724a4b5 Restore invisibility of symlink target on exiting wdired-mode
* lisp/wdired.el (wdired-change-to-dired-mode): Invoke
dired-hide-details-update-invisibility-spec (bug#61510).

* test/lisp/wdired-tests.el (wdired-test-bug61510): New test.
2023-02-24 16:43:35 +01:00
João Távora
55d29c9bac Eglot: fix jit-lock inlay hint bugs
One of the bugs was straightforward.  The timer function of
eglot--update-hints must set the correct buffer.

The other is much more odd.  When using Eglot on Emacs's own
src/coding.c, the jit-lock code starts calling its jit-functions over
and over again with the same sequence of arguments, like so:

======================================================================
1 -> (eglot--update-hints 63551 65051)
1 <- eglot--update-hints: [nil 25592 52026 4
======================================================================
1 -> (eglot--update-hints 65051 66551)
1 <- eglot--update-hints: [nil 25592 52026 4
======================================================================
1 -> (eglot--update-hints-1 63551 66551)
1 <- eglot--update-hints-1: nil
======================================================================
1 -> (eglot--update-hints 63551 65051)
1 <- eglot--update-hints: [nil 25592 52026 4
======================================================================
1 -> (eglot--update-hints 65051 66551)
1 <- eglot--update-hints: [nil 25592 52026 5
======================================================================
1 -> (eglot--update-hints-1 63551 66551)
1 <- eglot--update-hints-1: nil

This continues forever at a very fast rate and saturates the LSP
channel.

At first I thought that it was because eglot--update-hints-1 is
actually causing the buffer to be modified with overlays sometime in
the future, but it is not so!  It seems that merely calling

   (goto-char (eglot--lsp-position-to-point position))

(from the LSP request handler in eglot--update-hints-1) will cause
this bug.

* lisp/progmodes/eglot.el (eglot--update-hints): Fix bugs.
2023-02-24 14:48:01 +00:00
João Távora
5db75ec7d3 Eglot: fix inlay hint with label collection instead of string
Reported by Chinmay Dalal <dalal.chinmay.0101@gmail.com>

* lisp/progmodes/eglot.el (eglot--update-hints-1): Fix bug when
inlay hint contains collection of labels.
2023-02-24 10:47:45 +00:00
Robert Pluim
573d9675fd Fix insertion of keyboard macro containing named keys
* lisp/kmacro.el: Autoload `macro--string-to-vector'.
(kmacro-ring-head): Convert `last-kbd-macro' to a vector if it's a
string, since `kmacro' uses `key-parse' on it.
(kmacro-lambda-form): Remove require for 'macros
* test/lisp/kmacro-tests.el
(kmacro-tests-name-last-macro-key-parse-syntax):
Test that insertion of macros that contain strings that look
like named keys works correctly.

(Bug#61700)
2023-02-24 11:43:08 +01:00
João Távora
b0cbd5590b Eglot: simplify inlay hints implementation with jit-lock
This implementation is much simpler than the one based on
windows-scroll-functions.  It's also supposedly safer, as long as
jit-lock guarantees refontification of affected regions.

It's not _trivially_ simple though, as simply adding
'eglot--update-hints-1' to jit-lock-functions, while possible, is
going to request inlay hints from the LSP server for many small
regions of the buffer, depending on what jit-lock thinks is best.  So
we keep coalescing these into a larger region until the time is
suitable for a more bandwidth-efficient request.

To do this, we use a jit-lock implementation detail,
jit-lock-context-unfontify-pos, which is a proxy for knowing that the
jit-lock-context-timer has run.  Not sure how brittle it is, but it
seems to work reasonably.

We also get rid of the previous "get hints for entire buffer"
implementation.

* doc/misc/eglot.texi (Eglot Variables): Remove mention
to deleted eglot-lazy-inlay-hints.

* lisp/progmodes/eglot.el (eglot-lazy-inlay-hints)
(eglot--inlay-hints-after-scroll)
(eglot--inlay-hints-fully)
(eglot--inlay-hints-lazily): Remove.
(eglot--update-hints): Add function.
(eglot-inlay-hints-mode): Simplify.
2023-02-24 02:14:44 +00:00
João Távora
91e24c5b5a Eglot: update inlay hints on window configuration changes
* lisp/progmodes/eglot.el
(eglot--inlay-hints-after-window-config-change): New helper.
(eglot-inlay-hints-mode): Use it.
2023-02-23 19:20:34 +00:00
Daniel Martín
79fead1709 ; Fix a typo in a doc string in c-ts-common.el (bug#61736). 2023-02-23 19:50:52 +02:00
Eli Zaretskii
a0b273ef30 ; Clarify documentation of 'file-modes-number-to-symbolic'
* doc/lispref/files.texi (Changing Files):
* lisp/files.el (file-modes-number-to-symbolic): Clarify the
confusion with "symbolic" forms of file modes.  (Bug#61709)
2023-02-23 17:45:52 +02:00
Eli Zaretskii
5c2be6a263 ; Fix recently-added doc strings in eglot.el
* lisp/progmodes/eglot.el (eglot-lazy-inlay-hints)
(eglot-inlay-hints-mode): Doc fixes.
2023-02-23 17:18:28 +02:00
João Távora
e3be0dbf85 Eglot: display completion label when safe
Originally reported in
https://github.com/joaotavora/eglot/discussions/1141 by "Mintsoup".

Eglot doesn't always show the LSP :label property of a CompletionItem
in the completion candidates.  That is because label is sometimes not
what should be inserted in the buffer in the end, the :insertText
property supercedes it.

But the label is usually more suitable for display nevertheless and if
the LSP CompletionItem contains either a snippet or a textEdit, it's
safe to display the label, since :exit-function will guarantee that a
suitable buffer insertion is performed.

This change reflects that awareness that when a textEdit is available,
it's acceptable to show the label.

* lisp/progmodes/eglot.el (eglot-completion-at-point): Adjust.
2023-02-23 13:58:54 +00:00
Eli Zaretskii
5286111ea1 Improve documentation of VC commands, including in Dired
* doc/emacs/dired.texi (Operating on Files):
* doc/emacs/maintaining.texi (VC Change Log, VC Directory Mode)
(Version Control, Basic VC Editing): Document VC command
invocation from Dired buffers.  Improve documentation of vc-log
commands.

* lisp/dired-aux.el (dired-vc-next-action):
* lisp/vc/vc.el (vc-print-log, vc-log-search, vc-log-mergebase)
(vc-log-view-type, vc-print-root-log, vc-next-action): Doc fixes.
2023-02-23 14:26:06 +02:00
Juri Linkov
990f402713 * doc/emacs/maintaining.texi: More mentions of marked files in Dired.
(Basic VC Editing, Old Revisions, VC Change Log): Add more mentions of
ability to include the marked files to the VC fileset in Dired (bug#61712).
2023-02-23 10:23:41 +02:00
Yuan Fu
94e70ed426
; * lisp/emacs-lisp/eldoc.el (eldoc-display-in-echo-area): Fix typo. 2023-02-22 17:55:30 -08:00
João Távora
1841299a11 Eglot: implement inlay hints (bug#61412, bug#61066)
Inlay hints are small text annotations to specific parts of the whole
buffer, not unlike diagnostics, but designed to help readability
instead of indicating problems.  For example, a C++ LSP server can
serve hints about positional parameter names in function calls and a
variable's automatically deduced type.  Emacs can display these hints
in many little 0-length overlays with an 'before-string property, thus
helping the user remember those types and parameter names.

Since inlay hints are potentially a large amount of data to request
from the LSP server, the implementation strives to be as parsimonious
as possible with these requests.

So, by default, inlay hints are only requested for the visible
portions of the buffer across windows showing this buffer.  This is
done by leveraging the 'window-scroll-functions' variable, making for
a reasonably complex implementation involving per-window timers.  When
scrolling a window, it may take a short amount of time for inlay hints
to "pop in".  The new user variable 'eglot-lazy-inlay-hints' can be
used to exert some control over this.

Specifically, if the variable's value is set to 'nil', then inlay
hints are greedily fetched for the whole buffer every time a change
occurs.  This is a much simpler mode of operation which may avoid
problems, but is also likely much slower in large buffers.

Also, because the inlay feature is probably visually suprising to
some, it is turned OFF by default, which is not the usual practice of
Eglot (at least not when the necessary infrastructure is present).
This decision may be changed soon.  Here's a good one-liner for
enabling it by default in every Eglot-managed buffer:

   (add-hook 'eglot-managed-mode-hook #'eglot-inlay-hints-mode)

I haven't tested inlay hints extensively across many LSP servers, so I
would appreciate any testing, both for functional edge cases and
regarding performance.  There are possibly more optimization
oportunities in the "lazy" mode of operation, like more aggressively
deleting buffer overlays that are not in visible parts of the buffer.

Though I ended up writing this one from scratch, I want to thank
Dimitry Bolopopsky <dimitri@belopopsky.com> and Chinmay Dala
<dalal.chinmay.0101@gmail.com> for suggestions and early patches.

* lisp/progmodes/eglot.el (eglot--lsp-interface-alist): Define
InlayHint.
(eglot-client-capabilities): Announce 'inlayHint' capability.
(eglot-ignored-server-capabilities): Add :inlayHintProvider.
(eglot--document-changed-hook): New helper hook.
(eglot--after-change): Use it.
(eglot-inlay-hint-face, eglot-type-hint-face)
(eglot-parameter-hint-face): New faces.
(eglot--update-hints-1, eglot--inlay-hints-after-scroll)
(eglot--inlay-hints-fully, eglot--inlay-hints-lazily): New helpers.
(eglot-lazy-inlay-hints): New user variable.
(eglot-inlay-hints-mode): New minor mode.
(eglot--maybe-activate-editing-mode): Try to activate
eglot-inlay-hints-mode.
(eglot--before-change): Remove overlays immediately in the
area being changed.
(eglot--managed-mode-off): Remove overlays.

* doc/misc/eglot.texi (Eglot Features): Mention inlay hints.
(Eglot Variables): Mention eglot-lazy-inlay-hints.
2023-02-22 19:19:12 +00:00
João Távora
28ed0d1840 Eglot: run eglot-managed-mode-hook after LSP didOpen
This allows using the hook for interacting with the LSP server using
the current buffer as the subject of that interaction ("document" in
LSP parlance).

* lisp/progmodes/eglot.el (eglot--maybe-activate-editing-mode):
Run eglot-managed-mode-hook here.
(eglot--managed-mode): Not here.
2023-02-22 18:52:00 +00:00
João Távora
7ad5d9babe Eglot: restore eldoc-documentation-functions on shutdown
* lisp/progmodes/eglot.el (eglot--managed-mode): Restore
eldoc-documentation-functions when shutting down eglot.
2023-02-22 18:50:58 +00:00
João Távora
711a775ba7 Eglot: simplify capability-checking code
* lisp/progmodes/eglot.el (eglot--server-capable-or-lose): New helper.
(eglot--signal-textDocument/willSave)
(eglot--signal-textDocument/didSave): Tweak docstring.
(eglot--workspace-symbols, xref-backend-identifier-at-point)
(eglot-format, eglot-completion-at-point, eglot-rename)
(eglot-code-actions): Use new eglot--server-capable-or-lose.
2023-02-22 18:32:35 +00:00
João Távora
ea7251ad6d Eglot: go back to setting eldoc-documentation-strategy again
This commits reverts part of

   commit e83c78b8c7
   Author: João Távora <joaotavora@gmail.com>
   Date:   Mon Feb 20 22:43:50 2023 +0000

       Eglot: respect user's Eldoc configuration by default

In that commit, I did what many longstanding issues and users were
suggesting and removed Eglot's override of two Eldoc user
configuration varibles.

I verified that Eglot's behaviour would stay mostly unaltered but my
tests were very incomplete.  In short there is no way that Eglot can
work acceptably with the default setting of
'eldoc-documentation-strategy', which is
'eldoc-documentation-default'.  So it must be changed, either globally
or locally in Eglot's minor mode.

This is true for any situation where both synchronous and asynchronous
documentation sources are present.  In Eglot's case there are two
asynchronous sources which have more importance than the synchronous
source.  So any other strategy except the
'eldoc-documentation-default' makes sense.

* lisp/progmodes/eglot.el (eglot--managed-mode): Set
eldoc-documentation-strategy to eldoc-documentation-compose.
2023-02-22 18:25:11 +00:00