]> git.eshelyaron.com Git - emacs.git/log
emacs.git
20 months agoFix go-ts-mode multi-line string indentation (bug#61923)
Yuan Fu [Sat, 4 Mar 2023 08:37:03 +0000 (00:37 -0800)]
Fix go-ts-mode multi-line string indentation (bug#61923)

* lisp/progmodes/go-ts-mode.el:
(go-ts-mode--indent-rules): Add indent rule for multi-line sting.

20 months ago; More accurate doc strings for 'window-at' and 'window-at-x-y'.
Eli Zaretskii [Sat, 4 Mar 2023 08:43:25 +0000 (10:43 +0200)]
; More accurate doc strings for 'window-at' and 'window-at-x-y'.

* lisp/window.el (window-at-x-y):
* src/window.c (Fwindow_at): Doc fix.  (Bug#61948)

20 months agoRemove Eglot activation check from find-file-hook
João Távora [Sat, 4 Mar 2023 00:09:32 +0000 (00:09 +0000)]
Remove Eglot activation check from find-file-hook

Adding eglot--maybe-activate-editing-mode to find-file-hook isn't
really necessary, since it is already in
'after-change-major-mode-hook', and that also runs every time we find
a file.

This reduces the number of project.el logic that runs every time the
user visits a file.

* lisp/progmodes/eglot.el (find-file-hook): No need to add
eglot--maybe-activate-editing-mode here.

20 months ago* src/intervals.c (set_intervals_multibyte_1): Fix bug#61887
Stefan Monnier [Sat, 4 Mar 2023 00:13:03 +0000 (19:13 -0500)]
* src/intervals.c (set_intervals_multibyte_1): Fix bug#61887

When `total_length` is 0 there should be no subtree at all, but
`delete_interval` only deletes one interval, so make sure we don't end
up with some stale child of `i`.

20 months agoRevert inadvertent change to lisp/icomplete.el in previous commit
João Távora [Fri, 3 Mar 2023 23:36:26 +0000 (23:36 +0000)]
Revert inadvertent change to lisp/icomplete.el in previous commit

The change

   commit 3a651773d29afb48ac4229cd19e532bd57a4ee2d
   Author: João Távora <joaotavora@gmail.com>
   Date:   Fri Mar 3 13:13:35 2023 +0000

       Eglot: pay better attention to hints' paddingLeft/Right (bug#61924)

Inadvertently added a line to this file, which shouldn't (yet) bet
added.

* lisp/icomplete.el (icomplete--vertical-minibuffer-setup): Remove
truncate-lines.

20 months agoRevert previous change in go-ts-mode.el
Yuan Fu [Fri, 3 Mar 2023 21:59:54 +0000 (13:59 -0800)]
Revert previous change in go-ts-mode.el

Reverts 59365f928565f1be551b1697b9246b00cb87a9b7 and
56cd810b9d1a4d537bee5a2fd954d6e0d346631a.

Reverting because the use of treesit-ready-p is very much intentional.

* lisp/progmodes/go-ts-mode.el (treesit-ready-p): Revert change.

20 months agoRelease ERC 5.5
F. Jason Park [Tue, 14 Feb 2023 07:27:50 +0000 (23:27 -0800)]
Release ERC 5.5

* doc/misc/erc.texi: Update ERCVER to 5.5.
* lisp/erc/erc.el: Increment main version header to 5.5.  Update
Compat version in package-requires header to 29.1.3.4.  Update
`customize-package-emacs-version-alist' entry by mapping ERC 5.5 to
Emacs 29.1.
(erc-version): Update value to 5.5.

20 months ago; More doc improvements for OClosures
Eli Zaretskii [Fri, 3 Mar 2023 19:44:54 +0000 (21:44 +0200)]
; More doc improvements for OClosures

* doc/lispref/functions.texi (OClosures):
* doc/lispref/commands.texi (Using Interactive):
* etc/NEWS: Some more docs improvements for OClosures.

20 months agoDon't create GUI frames in batch sessions
Jim Porter [Tue, 28 Feb 2023 19:35:21 +0000 (11:35 -0800)]
Don't create GUI frames in batch sessions

This resolves an issue with running test/lisp/server-tests.el when
'DISPLAY' is set: the tests would start the Emacs server in a batch
session, and then request a new GUI frame.  However, that caused the
tests to terminate with SIGIO, since a batch Emacs doesn't set a SIGIO
handler.

Ref: <https://lists.gnu.org/archive/html/emacs-devel/2023-02/msg00879.html>

* lisp/frame.el (make-frame): Always create a terminal frame in batch
sessions.

20 months ago; Fix wrong error name in erc-server-908 doc string.
F. Jason Park [Fri, 3 Mar 2023 07:37:06 +0000 (23:37 -0800)]
; Fix wrong error name in erc-server-908 doc string.

* lisp/erc/erc-sasl.el (erc-server-908): Correct well-known name for
908 numeric in doc string.
(erc--register-connection): Fold overlong line.

20 months ago; * etc/ERC-NEWS: Mention more deprecations.
F. Jason Park [Fri, 3 Mar 2023 07:33:28 +0000 (23:33 -0800)]
; * etc/ERC-NEWS: Mention more deprecations.

20 months agoMinor copyedits of documentation of OClosures
Eli Zaretskii [Fri, 3 Mar 2023 13:23:22 +0000 (15:23 +0200)]
Minor copyedits of documentation of OClosures

* doc/lispref/functions.texi (OClosures): Improve wording,
indexing, and markup; add details.

20 months agoEglot: pay better attention to hints' paddingLeft/Right (bug#61924)
João Távora [Fri, 3 Mar 2023 13:13:35 +0000 (13:13 +0000)]
Eglot: pay better attention to hints' paddingLeft/Right (bug#61924)

* lisp/progmodes/eglot.el (eglot--update-hints-1): Consider
:json-false, which is a non-nil value.

20 months agoFix c-ts-mode indentation for statement after preproc (bug#61893)
Yuan Fu [Fri, 3 Mar 2023 03:59:11 +0000 (19:59 -0800)]
Fix c-ts-mode indentation for statement after preproc (bug#61893)

Originally our c-ts-mode--anchor-prev-sibling only specially handled
labeled_statements, now we add special case for preproc in the similar
fasion: instead of using the preproc directive as anchor, use the last
statement in that preproc as the anchor. Thus effectively ignore the
preproc.

There should be an accompanying test, but there are some problem in
the elif preproc directive indent so it would pass, we'll add the test
when that is fixed.

* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--anchor-prev-sibling): Add special case for preproc
directives.

20 months agoFix c/c++-ts-mode's mode lighter
Eli Zaretskii [Thu, 2 Mar 2023 19:34:22 +0000 (21:34 +0200)]
Fix c/c++-ts-mode's mode lighter

* lisp/progmodes/c-ts-mode.el (c-ts-mode-set-modeline): Remove
trailing blank from comment-start when indicating the comment
style on the mode line.

20 months agoEglot: use shell-file-name in eglot--cmd (bug#61748)
João Távora [Thu, 2 Mar 2023 13:27:14 +0000 (13:27 +0000)]
Eglot: use shell-file-name in eglot--cmd (bug#61748)

* lisp/progmodes/eglot.el (eglot--cmd): Use shell-file-name.

20 months agoAvoid signaling errors in url-basic-auth when password is nil
Eli Zaretskii [Thu, 2 Mar 2023 12:35:15 +0000 (14:35 +0200)]
Avoid signaling errors in url-basic-auth when password is nil

* lisp/url/url-auth.el (url-basic-auth): Handle nil PASS.
Suggested by Ellis Kenyo <me@elken.dev>.  (Bug#61411)

20 months agoFix wdired-tests on MS-Windows
Eli Zaretskii [Thu, 2 Mar 2023 12:21:33 +0000 (14:21 +0200)]
Fix wdired-tests on MS-Windows

* test/lisp/wdired-tests.el (wdired-test-bug32173-01)
(wdired-test-bug32173-02, wdired-test-unfinished-edit-01)
(wdired-test-bug39280): Run test-dir through file-truename, to
avoid failures due to MS-Windows "numeric tails" (mis)feature and
similar issues, which make file names fail to compare 'equal'.
(wdired-test-bug34915, wdired-test-bug61510): Skip if symlinks
fail.

20 months agoImprovements to xwidget on macOS (bug#60703)
Andrew De Angelis [Fri, 24 Feb 2023 03:47:41 +0000 (22:47 -0500)]
Improvements to xwidget on macOS (bug#60703)

* src/nsxwidget.m ()
([XwWebView initWithFrame:configuration:xwidget:])
(nsxwidget_init):  Fixed memory leaks: when sending an alloc
message to an object, send an autorelease message to any objects
we won't explictly release.
([XwWebView webView:didFinishNavigation:]): Second string to
store in 'store_xwidget_event_string' is "load finished" rather
than empty string.
([XwWebView webView:didStartProvisionalNavigation:])
([XwWebView webView:didReceiveServerRedirectForProvisionalNavigation:])
([XwWebView webView:didCommitNavigation:]): New functions.
(nsxwidget_webkit_estimated_load_progress): New function.
(nsxwidget_webkit_stop_loading): New function.
* src/xwidget.c (Fxwidget_webkit_estimated_load_progress): Call
'nsxwidget_webkit_estimated_load_progress' if we're on MacOS.
(Fxwidget_webkit_stop_loading): Call 'nsxwidget_webkit_stop_loading'
if we're on MacOS.
(syms_of_xwidget): Define symbol for function.
'xwidget_webkit_estimated_load_progress' if we're on MacOS.
* src/nsxwidget.h: Signature for functions
'nsxwidget_webkit_estimated_load_progress' and
'nsxwidget_webkit_stop_loading'.
* lisp/xwidget.el (xwidget-webkit-current-url): Message URL rather
than return value of 'kill-new' (which is always nil).

20 months ago; Avoid byte-compilation warning in c-ts-mode.el
Eli Zaretskii [Thu, 2 Mar 2023 07:33:04 +0000 (09:33 +0200)]
; Avoid byte-compilation warning in c-ts-mode.el

* lisp/progmodes/c-ts-mode.el (treesit-node-first-child-for-pos):
Declare.

20 months ago* lisp/progmodes/go-ts-mode.el: Use treesit-language-available-p.
Yuan Fu [Wed, 1 Mar 2023 22:38:22 +0000 (14:38 -0800)]
* lisp/progmodes/go-ts-mode.el: Use treesit-language-available-p.

treesit-ready-p does more checks than language grammar availability.

20 months agoDon’t signal warning when loading go-ts-mode.el without grammar
Yuan Fu [Wed, 1 Mar 2023 22:34:56 +0000 (14:34 -0800)]
Don’t signal warning when loading go-ts-mode.el without grammar

* lisp/progmodes/go-ts-mode.el: Add a QUIET flag to the call of
treesit-ready-p, so that it doesn't signal a warning if
go-mod (tree-sitter grammar) is not available.

20 months agoFix c-ts-mode empty line indentation (bug#61893)
Yuan Fu [Wed, 1 Mar 2023 22:01:47 +0000 (14:01 -0800)]
Fix c-ts-mode empty line indentation (bug#61893)

* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Make the
"rest sibling" matchers catch the case where NODE is nil, when
indenting an empty line.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test.

20 months agoImprove tree-sitter's prev-sibling indent anchor
Yuan Fu [Wed, 1 Mar 2023 21:55:53 +0000 (13:55 -0800)]
Improve tree-sitter's prev-sibling indent anchor

Now it handles the case where NODE is nil when indenting an empty
line: it tries to get the previous sibling nonetheless.

* lisp/progmodes/c-ts-mode.el (c-ts-mode--anchor-prev-sibling):
* lisp/treesit.el (treesit-simple-indent-presets): Add an or form to
handle more cases.

20 months ago* lisp/icomplete.el (fido-mode): Enable in-buffer completion (bug#45763).
João Távora [Mon, 27 Feb 2023 18:40:48 +0000 (20:40 +0200)]
* lisp/icomplete.el (fido-mode): Enable in-buffer completion (bug#45763).

Backport:
(cherry picked from commit b5c13032538377b0037c745715613693a1580f81)

20 months ago* lisp/icomplete.el: Fix in-buffer completion.
Juri Linkov [Mon, 27 Feb 2023 18:32:53 +0000 (20:32 +0200)]
* lisp/icomplete.el: Fix in-buffer completion.

(icomplete-force-complete-and-exit, icomplete-force-complete): Use
'icomplete--field-beg/end' when not in the minibuffer to not erase
the current buffer.  Also disable 'completion-in-region-mode' instead
of calling 'exit-minibuffer' (bug#45764, bug#51575, bug#61479).

Backport:
(cherry picked from commit a7a984c0ebebb891e2052d8416544f0bd7002007)

20 months ago* src/profiler.c (malloc_probe): Make it safe for GC (bug#60237)
Stefan Monnier [Wed, 1 Mar 2023 17:36:58 +0000 (12:36 -0500)]
* src/profiler.c (malloc_probe): Make it safe for GC (bug#60237)

20 months ago* lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Fix bug#61847
Stefan Monnier [Wed, 1 Mar 2023 17:31:09 +0000 (12:31 -0500)]
* lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Fix bug#61847

The `noerror` arg of `require` doesn't do what Stefan naively thought
when he wrote this code, so use `condition-case` instead.
Also check for `cl-defmethod` since `cl-prin1` can't be loaded before
that anyway.

20 months agoRevert "Don't disable eldoc when doing edebug"
Eli Zaretskii [Wed, 1 Mar 2023 15:35:51 +0000 (17:35 +0200)]
Revert "Don't disable eldoc when doing edebug"

This reverts commit 6fd1fb8a6837acde8e1c9ab26618ec0f36121c72.
It turns out ElDoc does show messages inside Edebug, if you
are (un)lucky enough to have point where ElDoc has something
to show.  Bug#56459 needs to be fixed in some more complex
way.

20 months ago; Eglot: improve bug-reference-url-format/bug-reference-url-regexp
João Távora [Wed, 1 Mar 2023 13:24:07 +0000 (13:24 +0000)]
; Eglot: improve bug-reference-url-format/bug-reference-url-regexp

* lisp/progmodes/eglot.el (eglot--debbugs-or-github-bug-uri): New helper.

20 months agoEglot: work around Tramp instability bug#61350
João Távora [Wed, 1 Mar 2023 11:12:51 +0000 (11:12 +0000)]
Eglot: work around Tramp instability bug#61350

Unconditionally disable ControlMaster for the Eglot's Tramp
connection.

* lisp/progmodes/eglot.el (tramp-ssh-controlmaster-options)
(use-tramp-ssh-controlmaster-options): Forward declare
(eglot--connect): Set variables to unconditionally disable ControlMaster.

20 months agoFix treesit-indent-region
Yuan Fu [Wed, 1 Mar 2023 07:51:06 +0000 (23:51 -0800)]
Fix treesit-indent-region

Fix it for the case where there is no suitable rule for the line.
Right now treesit-indent-region would indent the line to column 0.
After the change the indentation is not altered.

* lisp/treesit.el (treesit-indent-region): Handle the case where
ANCHOR or OFFSET is nil specially.

20 months agoReplace C++ comments with C style equivalents
Po Lu [Wed, 1 Mar 2023 06:28:04 +0000 (14:28 +0800)]
Replace C++ comments with C style equivalents

* src/alloc.c (Fmake_byte_code, purecopy):
* src/bytecode.c (exec_byte_code):
* src/xdisp.c (face_at_pos): Do not use C++-style comments!

20 months ago; Auto-commit of loaddefs files.
Stefan Kangas [Wed, 1 Mar 2023 04:07:53 +0000 (05:07 +0100)]
; Auto-commit of loaddefs files.

20 months agoEglot: fix M-x eglot-show-workspace-configuration (bug#61866)
João Távora [Wed, 1 Mar 2023 01:22:15 +0000 (01:22 +0000)]
Eglot: fix M-x eglot-show-workspace-configuration (bug#61866)

Now consult .dir-locals.el every time the workspace configuration is
needed:

- workspace/configuration server request
- workspace/didChangeConfiguration signal
- M-x eglot-show-workspace-configuration

The major-mode/hack-dir-local-variables-non-file-buffer trick is used.
When there is more than one, the server connection's "main" major mode
is used to find the relevant .dir-locals.el section.

* lisp/progmodes/eglot.el (eglot--lookup-mode): Fix docstring.
(eglot--connect): Simplify.
(eglot-show-workspace-configuration): Fix.
(eglot--workspace-configuration): Remove.
(eglot--workspace-configuration-plist): Rework.
(eglot-handle-request): Simplify.

20 months agoruby-mode: Fix method call indentation in rhs of multiple assignment
Dmitry Gutov [Tue, 28 Feb 2023 21:00:42 +0000 (23:00 +0200)]
ruby-mode: Fix method call indentation in rhs of multiple assignment

* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Special-case
assignment that follows a comma-separated list (bug#61871).

* test/lisp/progmodes/ruby-mode-resources/ruby.rb: Add case.

20 months ago* lisp/net/tramp.el (tramp-remote-path): Improve docstring.
Michael Albinus [Tue, 28 Feb 2023 15:42:11 +0000 (16:42 +0100)]
* lisp/net/tramp.el (tramp-remote-path): Improve docstring.

20 months agoMinor change in 'dired--find-possibly-alternative-file'
Felix [Sun, 26 Feb 2023 13:14:59 +0000 (14:14 +0100)]
Minor change in 'dired--find-possibly-alternative-file'

* lisp/dired.el (dired--find-possibly-alternative-file): Don't
kill the buffer if the directory is shown in other windows.

Copyright-paperwork-exempt: yes

20 months agoImplement prefix arg for 'c-ts-mode-toggle-comment-style'
Felix [Mon, 27 Feb 2023 15:15:02 +0000 (16:15 +0100)]
Implement prefix arg for 'c-ts-mode-toggle-comment-style'

* lisp/progmodes/c-ts-mode.el (c-ts-mode-toggle-comment-style):
Actually implement the optional numeric arg mentioned in the
docstring.

Copyright-paperwork-exempt: yes

20 months agoDefaults to zero for image-dired--number-of-thumbnails
Manuel Giraud [Thu, 23 Feb 2023 15:42:48 +0000 (16:42 +0100)]
Defaults to zero for image-dired--number-of-thumbnails

* lisp/image/image-dired.el (image-dired--number-of-thumbnails):
Defaults zero to avoid wrong type argument error.  (Bug#61734)

20 months ago; Add a doc string for 'ediff-window-display-p' obsolescence
Eli Zaretskii [Tue, 28 Feb 2023 13:15:27 +0000 (15:15 +0200)]
; Add a doc string for 'ediff-window-display-p' obsolescence

* lisp/vc/ediff-init.el (ediff-window-display-p): Document how to
prevent Ediff from creating additional frames, now that this
function can no longer be used or advised for that.  (Bug#61850)

20 months agoRename the newly added -ref- faces to -use-
Dmitry Gutov [Tue, 28 Feb 2023 02:07:55 +0000 (04:07 +0200)]
Rename the newly added -ref- faces to -use-

* lisp/font-lock.el (font-lock-variable-use-face)
(font-lock-property-use-face): Rename from font-lock-variable-ref-face
and font-lock-property-ref-face.  Update all references (bug#61655).

20 months agoEglot: support multiple labels in same inlay hint
João Távora [Mon, 27 Feb 2023 14:54:53 +0000 (14:54 +0000)]
Eglot: support multiple labels in same inlay hint

Mainly the rust-analyzer LSP server uses this.  There are still more
things we could support, like tooltips and stuff.

* lisp/progmodes/eglot.el (lsp-interface-alist): Add
InlayHintLabelPart.
(eglot--update-hints-1): Support multiple labels for same hint.

20 months agoEglot: don't paint hints outside requested region (bug#61812)
João Távora [Mon, 27 Feb 2023 14:23:35 +0000 (14:23 +0000)]
Eglot: don't paint hints outside requested region (bug#61812)

* lisp/progmodes/eglot.el (eglot--lambda): Add cl-block.
(eglot--update-hints-1): Return early if hint is outside the
requested inlay hint range.

20 months ago; * doc/misc/gnus.texi: Fix last change.
Eli Zaretskii [Mon, 27 Feb 2023 12:32:57 +0000 (14:32 +0200)]
; * doc/misc/gnus.texi: Fix last change.

20 months ago; Add `nnimap-user' to Gnus manual
Arash Esbati [Mon, 27 Feb 2023 09:10:13 +0000 (10:10 +0100)]
; Add `nnimap-user' to Gnus manual

* doc/misc/gnus.texi (Customizing the IMAP Connection): Document
backend variable `nnimap-user' which was introduced with commit
5e68f8614f in 2011.
Add index entries for all backend variables.  (bug#61837)

20 months ago; * lisp/progmodes/c-ts-mode.el (treesit-node-prev-sibling): Declare.
Eli Zaretskii [Mon, 27 Feb 2023 12:11:13 +0000 (14:11 +0200)]
; * lisp/progmodes/c-ts-mode.el (treesit-node-prev-sibling): Declare.

20 months agoEglot: protect against unintended field text motion (bug#61726)
João Távora [Mon, 27 Feb 2023 11:29:32 +0000 (11:29 +0000)]
Eglot: protect against unintended field text motion (bug#61726)

Suggested-by: Augusto Stoffel <arstoffel@gmail.com>
* lisp/progmodes/eglot.el (eglot--bol): New helper.
(eglot-utf-8-linepos, eglot-utf-16-linepos)
(eglot-utf-32-linepos, eglot-move-to-utf-8-linepos)
(eglot-move-to-utf-16-linepos, eglot-move-to-utf-32-linepos)
(eglot-handle-notification, eglot--xref-make-match)
(eglot-completion-at-point): Use it.

20 months ago; And yet another fix to eglot-current-linepos-function's docstring
João Távora [Mon, 27 Feb 2023 11:04:44 +0000 (11:04 +0000)]
; And yet another fix to eglot-current-linepos-function's docstring

bug#61726

* lisp/progmodes/eglot.el (eglot-current-linepos-function):
Another fix.

20 months agoFix description of 'desktop-save-mode'
Eli Zaretskii [Mon, 27 Feb 2023 11:31:47 +0000 (13:31 +0200)]
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>.

20 months agoAdjust tree-sitter defun navigation (bug#61617)
Yuan Fu [Mon, 27 Feb 2023 08:14:32 +0000 (00:14 -0800)]
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.

20 months agoSimplify c-ts-mode--top-level-label-matcher
Yuan Fu [Mon, 27 Feb 2023 02:24:49 +0000 (18:24 -0800)]
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.

20 months agoNew tree-sitter indent anchor standalone-parent used by c-ts-mode
Yuan Fu [Mon, 27 Feb 2023 02:05:13 +0000 (18:05 -0800)]
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.

20 months agoruby-smie-rules: Fix misindentation of a method call after assignment
Dmitry Gutov [Mon, 27 Feb 2023 00:05:56 +0000 (02:05 +0200)]
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.

20 months ago* lib-src/etags.c (process_file_name): Free malloc'ed vars (bug#61819).
Eli Zaretskii [Sun, 26 Feb 2023 18:03:20 +0000 (20:03 +0200)]
* lib-src/etags.c (process_file_name): Free malloc'ed vars (bug#61819).

20 months ago; Improve documentation of loading *.eln files
Eli Zaretskii [Sun, 26 Feb 2023 17:51:59 +0000 (19:51 +0200)]
; 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.

20 months ago; Another doc fix in eglot.el
Eli Zaretskii [Sun, 26 Feb 2023 14:48:07 +0000 (16:48 +0200)]
; Another doc fix in eglot.el

* lisp/progmodes/eglot.el (eglot-current-linepos-function):
Another doc fix.

20 months ago; Fix last change
João Távora [Sun, 26 Feb 2023 14:05:07 +0000 (14:05 +0000)]
; Fix last change

bug#61726

* lisp/progmodes/eglot.el (eglot-current-linepos-function): Fix docstring.

20 months ago; Fix last change
Eli Zaretskii [Sun, 26 Feb 2023 13:24:11 +0000 (15:24 +0200)]
; 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)

20 months agoEglot: rename and redocument encoding-related functions (bug#61726)
João Távora [Sun, 26 Feb 2023 12:50:42 +0000 (12:50 +0000)]
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.

20 months agoEglot: support positionEncoding LSP capability (bug#61726)
Augusto Stoffel [Sun, 26 Feb 2023 11:47:32 +0000 (11:47 +0000)]
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.

20 months agoEglot: use faster strategy for moving to LSP positions (bug#61726)
Eli Zaretskii [Sun, 26 Feb 2023 10:27:18 +0000 (10:27 +0000)]
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>
20 months agoFix mule-tests in UTF-8 locales
Eli Zaretskii [Sun, 26 Feb 2023 09:46:20 +0000 (11:46 +0200)]
Fix mule-tests in UTF-8 locales

* test/lisp/international/mule-tests.el
(sgml-html-meta-no-post-less-than-10lines): Fix test condition.

20 months agoFix 'vertical-motion' when display strings are around
Eli Zaretskii [Sun, 26 Feb 2023 09:34:14 +0000 (11:34 +0200)]
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)

20 months ago; * src/treesit.c (treesit_predicate_match): Fix typo.
Yuan Fu [Sun, 26 Feb 2023 09:12:18 +0000 (01:12 -0800)]
; * src/treesit.c (treesit_predicate_match): Fix typo.

20 months agopython-ts-mode: Fix single-quote string fontification
Dmitry Gutov [Sun, 26 Feb 2023 01:09:29 +0000 (03:09 +0200)]
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).

20 months ago; * etc/NEWS: Fix typos.
Michael Albinus [Sat, 25 Feb 2023 17:45:14 +0000 (18:45 +0100)]
; * etc/NEWS: Fix typos.

20 months agoFix infloop in bidi.c
Eli Zaretskii [Sat, 25 Feb 2023 15:19:15 +0000 (17:19 +0200)]
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>.

20 months ago; Fix doc string of 'emacs-lisp-byte-compile'
Eli Zaretskii [Sat, 25 Feb 2023 13:51:04 +0000 (15:51 +0200)]
; Fix doc string of 'emacs-lisp-byte-compile'

* lisp/progmodes/elisp-mode.el (emacs-lisp-byte-compile): Doc
fix.  (Bug#61784)

20 months agoCheck the anchor along with the offset in treesit-indent-region
Daniel Martín [Sat, 25 Feb 2023 02:07:55 +0000 (03:07 +0100)]
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.

20 months ago; Fix typos in docstrings in c-ts-common.el
Daniel Martín [Thu, 23 Feb 2023 17:30:36 +0000 (18:30 +0100)]
; Fix typos in docstrings in c-ts-common.el

* lisp/progmodes/c-ts-common.el:
(c-ts-common-statement-offset): Fix typo.

20 months ago; Set indent-tabs-mode to nil in c-ts-mode indent preproc test
Yuan Fu [Sat, 25 Feb 2023 03:43:22 +0000 (19:43 -0800)]
; 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.

20 months agoAlign to prev sibling for c-ts-mode indentation
Yuan Fu [Sat, 25 Feb 2023 02:40:52 +0000 (18:40 -0800)]
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.

20 months agoFix c-ts-common-statement-offset and c-ts-common--node-is
Yuan Fu [Sat, 25 Feb 2023 03:31:34 +0000 (19:31 -0800)]
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.

20 months agotypescript-ts-mode: Highlight non-shorthand destructuring bindings
Dmitry Gutov [Sat, 25 Feb 2023 01:54:31 +0000 (03:54 +0200)]
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.

20 months agoAdd more/finer faces for tree-sitter
Dmitry Gutov [Sat, 25 Feb 2023 01:15:46 +0000 (03:15 +0200)]
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.

20 months agoAvoid crashes in batch mode due to lack of frame face cache
Eli Zaretskii [Fri, 24 Feb 2023 20:46:05 +0000 (22:46 +0200)]
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.

20 months agoAdd Tramp version integrated in Emacs 28.3
Michael Albinus [Fri, 24 Feb 2023 18:47:15 +0000 (19:47 +0100)]
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.

20 months agoAvoid reusing :lisp-dir twice in 'package-vc--main-file'
Philip Kaludercic [Wed, 22 Feb 2023 14:28:44 +0000 (15:28 +0100)]
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.

20 months agoEnsure right package-desc-type before installing package
Philip Kaludercic [Wed, 22 Feb 2023 14:23:43 +0000 (15:23 +0100)]
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)

20 months agoRestore invisibility of symlink target on exiting wdired-mode
Stephen Berman [Fri, 24 Feb 2023 15:43:35 +0000 (16:43 +0100)]
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.

20 months agoEglot: fix jit-lock inlay hint bugs
João Távora [Fri, 24 Feb 2023 14:48:01 +0000 (14:48 +0000)]
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.

20 months agoEglot: fix inlay hint with label collection instead of string
João Távora [Fri, 24 Feb 2023 10:46:20 +0000 (10:46 +0000)]
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.

20 months agoFix insertion of keyboard macro containing named keys
Robert Pluim [Fri, 24 Feb 2023 10:12:24 +0000 (11:12 +0100)]
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)

20 months agoEglot: simplify inlay hints implementation with jit-lock
João Távora [Thu, 23 Feb 2023 23:51:09 +0000 (23:51 +0000)]
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.

20 months agoEglot: update inlay hints on window configuration changes
João Távora [Thu, 23 Feb 2023 19:18:41 +0000 (19:18 +0000)]
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.

20 months ago; Fix a typo in a doc string in c-ts-common.el (bug#61736).
Daniel Martín [Thu, 23 Feb 2023 17:30:36 +0000 (18:30 +0100)]
; Fix a typo in a doc string in c-ts-common.el (bug#61736).

20 months ago; Clarify documentation of 'file-modes-number-to-symbolic'
Eli Zaretskii [Thu, 23 Feb 2023 15:45:52 +0000 (17:45 +0200)]
; 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)

20 months ago; Fix recently-added doc strings in eglot.el
Eli Zaretskii [Thu, 23 Feb 2023 15:18:28 +0000 (17:18 +0200)]
; Fix recently-added doc strings in eglot.el

* lisp/progmodes/eglot.el (eglot-lazy-inlay-hints)
(eglot-inlay-hints-mode): Doc fixes.

20 months agoEglot: display completion label when safe
João Távora [Thu, 23 Feb 2023 13:58:38 +0000 (13:58 +0000)]
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.

20 months agoImprove documentation of VC commands, including in Dired
Eli Zaretskii [Thu, 23 Feb 2023 12:26:06 +0000 (14:26 +0200)]
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.

20 months ago* doc/emacs/maintaining.texi: More mentions of marked files in Dired.
Juri Linkov [Thu, 23 Feb 2023 08:23:41 +0000 (10:23 +0200)]
* 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).

20 months ago; * lisp/emacs-lisp/eldoc.el (eldoc-display-in-echo-area): Fix typo.
Yuan Fu [Thu, 23 Feb 2023 01:55:30 +0000 (17:55 -0800)]
; * lisp/emacs-lisp/eldoc.el (eldoc-display-in-echo-area): Fix typo.

20 months agoEglot: implement inlay hints (bug#61412, bug#61066)
João Távora [Tue, 21 Feb 2023 14:14:05 +0000 (14:14 +0000)]
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.

20 months agoEglot: run eglot-managed-mode-hook after LSP didOpen
João Távora [Wed, 22 Feb 2023 18:44:39 +0000 (18:44 +0000)]
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.

20 months agoEglot: restore eldoc-documentation-functions on shutdown
João Távora [Wed, 22 Feb 2023 18:50:46 +0000 (18:50 +0000)]
Eglot: restore eldoc-documentation-functions on shutdown

* lisp/progmodes/eglot.el (eglot--managed-mode): Restore
eldoc-documentation-functions when shutting down eglot.

20 months agoEglot: simplify capability-checking code
João Távora [Tue, 21 Feb 2023 13:59:04 +0000 (13:59 +0000)]
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.

20 months agoEglot: go back to setting eldoc-documentation-strategy again
João Távora [Wed, 22 Feb 2023 18:05:00 +0000 (18:05 +0000)]
Eglot: go back to setting eldoc-documentation-strategy again

This commits reverts part of

   commit e83c78b8c7784254c2c6f043530ab325c2fa7f16
   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.

20 months ago; * etc/NEWS: Fix typo again
Martin Rudalics [Wed, 22 Feb 2023 17:48:33 +0000 (18:48 +0100)]
; * etc/NEWS: Fix typo again

20 months ago; * etc/NEWS (C-x v !): Additional text.
Sean Whitton [Wed, 22 Feb 2023 17:17:08 +0000 (10:17 -0700)]
; * etc/NEWS (C-x v !): Additional text.