Merge from origin/emacs-29

4b6f2a7028 * lisp/progmodes/xref.el: Bump the version.
24c8b146bb * lisp/progmodes/xref.el (xref--xref-buffer-mode): Split ...
46f9e53c3d Fix import of keys in buffer created by epa-search-keys
36ade0704e Fix connection-local variables settings
e759905d2e ; Minor copyedits in EGLOT-NEWS
ba22a2c346 Bump Eglot version to 1.12
54e123a505 Update Eglot's manual about eglot-workspace-configuration
812597f864 ; * lisp/novice.el (disabled-command-function): Add note ...
4a603c9849 Amend last Eglot commit (bug#62065)
b916ec88b2 Make eglot-ensure's post-command-hook run a bit later (bu...
1c05175c21 Fix display of disabled-command help text
3ce37db988 Remove mention of old dotted-list reader quirk from manual
42335c2c1f Fix value history shown for 'gc-cons-percentage'
fffbce2934 TRework fix for bug#62106
8bc12a2736 ; * etc/NEWS: Fix last change.
2ac068d294 ; Remove 'ns-popup-font-panel' from documentation
5bc32d008f Add missing indentation rule for rust-ts-mode (Bug#62109)
0404924930 ; One more improvement to ELisp "internals" appendix.
c857775ca6 Fix bug#62106
0fedbfa6a9 ; Minor improvement of documentation of GC thresholds
b0b24ad2fc Add missing rust-ts-mode highlight query for scoped_type_...
c0cf69f7a1 Make "case" keyword a dedenter in Python
db178517ce ; * lisp/arc-mode.el (w32-get-console-codepage): Declare.
157a91b54b Fix decoding non-ASCII file names in zip archives on MS-W...
4803f97204 Fix copying binary files from zip archives
679f528b95 Skip ruby-ts-syntax-propertize-symbol unless treesitter i...
081cc7aa8e ; * doc/misc/eglot.texi (Project-specific configuration):...
1de513a29f Fix enums and unions appearing as structs in c-ts-base-mo...
ecdfd584a5 ruby-ts-mode: Fine-tune s-p-f on symbols (bug#62086)
29228e24f2 python-info-dedenter-opening-block-positions: Fix to supp...
01b65d442a Autoload Eglot helper funtion eglot--debbugs-or-github-bu...
50a3559c5a Add chapter on advanced server configuration to Eglot manual
2e7460c231 ; * lisp/progmodes/java-ts-mode.el (treesit-query-capture...
255eeee0e0 java-ts-mode: detect if text_block is supported.
6fe9075ff3 Revert workaround introduced in Bug#56271
f175141aea Fix searching for end of string in python-nav-end-of-stat...

# Conflicts:
#	etc/NEWS
This commit is contained in:
João Távora 2023-03-14 18:14:48 +00:00
commit a55aaf9eaf
22 changed files with 1049 additions and 188 deletions

View file

@ -201,13 +201,6 @@ Setting a lower number makes the trackpad more sensitive, and a higher
number makes the trackpad less sensitive.
@end table
@subsection Font Panel
@findex ns-popup-font-panel
The standard Mac / GNUstep font panel is accessible with @kbd{M-x
ns-popup-font-panel} and will set the default font in the frame most
recently used or clicked on.
@c To make the setting permanent, use @samp{Save Options} in the
@c Options menu, or run @code{menu-bar-options-save}.

View file

@ -558,12 +558,15 @@ The initial threshold value is @code{GC_DEFAULT_THRESHOLD}, defined in
value is 400,000 for the default 32-bit configuration and 800,000 for
the 64-bit one. If you specify a larger value, garbage collection
will happen less often. This reduces the amount of time spent garbage
collecting, but increases total memory use. You may want to do this
when running a program that creates lots of Lisp data. However, we
collecting (so Lisp programs will run faster between cycles of garbage
collection that happen more rarely), but increases total memory use.
You may want to do this when running a program that creates lots of
Lisp data, especially if you need it to run faster. However, we
recommend against increasing the threshold for prolonged periods of
time, and advise that you never set it higher than needed for the
program to run in reasonable time. Using thresholds higher than
necessary could potentially cause system-wide memory pressure, and
necessary could potentially cause higher system-wide memory pressure,
and also make each garbage-collection cycle take much more time, and
should therefore be avoided.
You can make collections more frequent by specifying a smaller value, down

View file

@ -1007,13 +1007,6 @@ It looks like this:
@end example
@end ifnottex
As a somewhat peculiar side effect of @code{(a b . c)} and
@code{(a . (b . c))} being equivalent, for consistency this means
that if you replace @code{b} here with the empty sequence, then it
follows that @code{(a . c)} and @code{(a . ( . c))} are equivalent,
too. This also means that @code{( . c)} is equivalent to @code{c},
but this is seldom used.
@node Association List Type
@subsubsection Association List Type

View file

@ -98,6 +98,7 @@ This manual documents how to configure, use, and customize Eglot.
* Eglot and LSP Servers:: How to work with language servers.
* Using Eglot:: Important Eglot commands and variables.
* Customizing Eglot:: Eglot customization and advanced features.
* Advanced server configuration:: Fine-tune a specific language server
* Troubleshooting Eglot:: Troubleshooting and reporting bugs.
* GNU Free Documentation License:: The license for this manual.
* Index::
@ -226,11 +227,10 @@ This says to invoke @var{program} with zero or more arguments
standard input and standard output streams.
@item (@var{program} @var{args}@dots{} :initializationOptions @var{options}@dots{})
Like above, but with @var{options} specifying the options to be
used for constructing the @samp{initializationOptions} JSON object for
the server. @var{options} can also be a function of one argument, in
which case it will be called with the server instance as the argument,
and should return the JSON object to use for initialization.
@var{program} is invoked with @var{args} but @var{options} specifies
how to construct the @samp{:initializationOptions} JSON object to pass
the server on during the LSP handshake (@pxref{Advanced server
configuration}).
@item (@var{host} @var{port} @var{args}@dots{})
Here @var{host} is a string and @var{port} is a positive integer
@ -970,83 +970,128 @@ mechanism.
Set this variable to true if you'd like progress notifications coming
from the LSP server to be handled as Emacs's progress reporting
facilities.
@vindex eglot-workspace-configuration
@cindex server workspace configuration
@item eglot-workspace-configuration
This variable is meant to be set in the @file{.dir-locals.el} file, to
provide per-project settings, as described below in more detail.
@end table
Some language servers need to know project-specific settings, which
the LSP calls @dfn{workspace configuration}. Eglot allows such fine
tuning of per-project settings via the variable
@code{eglot-workspace-configuration}. Eglot sends the settings in
this variable to each server, and each server applies the portion of the
settings relevant to it and ignores the rest. These settings are
communicated to the server initially (upon establishing the
connection) or when the settings are changed, or in response to a
configuration request from the server.
@node Advanced server configuration
@chapter Advanced server configuration
In many cases, servers can be configured globally using a
configuration file in the user's home directory or in the project
directory, which the language server reads. For example, the
@command{pylsp} server for Python reads the file
@file{~/.config/pycodestyle} and the @command{clangd} server reads the
file @file{.clangd} anywhere in the current project's directory tree.
If possible, we recommend using those configuration files that are
independent of Eglot and Emacs; they have the advantage that they will
work with other LSP clients as well.
Though many language servers work well out-of-the-box, most allow
fine-grained control of their operation via specific configuration
options that vary from server to server. A small number of servers
require such special configuration to work acceptably, or even to work
at all.
If you do need to provide Emacs-specific configuration for a language
server, we recommend defining the appropriate value in the
@file{.dir-locals.el} file in the project's directory. The value of
this variable should be a property list of the following format:
After having setup a server executable program in
@code{eglot-server-programs} (@pxref{Setting Up LSP Servers}) and
ensuring Eglot can invoke it, you may want to take advantage of some
of these options. You should first distinguish two main kinds of
server configuration:
@itemize @bullet
@item
Project-specific, applying to a specific project;
@item
User-specific, applying to all projects the server is used for.
@end itemize
When you have decided which kind you need, the following sections
teach how Eglot's user variables can be used to achieve it:
@menu
* Project-specific configuration::
* User-specific configuration::
* JSONRPC objects in Elisp::
@end menu
It's important to note that not all servers allow both kinds of
configuration, nor is it guaranteed that user options can be copied
over to project options, and vice-versa. When in doubt, consult your
language server's documentation.
It's also worth noting that some language servers can read these
settings from configuration files in the user's @code{HOME} directory
or in a project's directory. For example, the @command{pylsp} Python
server reads the file @file{~/.config/pycodestyle} for user
configuration. The @command{clangd} C/C++ server reads both
@file{~/.config/clangd/config.yaml} for user configuration and
@file{.clangd} for project configuration. It may be advantageous to
use these mechanisms instead of Eglot's, as the latter have the
advantage of working with other LSP clients.
@node Project-specific configuration
@section Project-specific configuration
@vindex eglot-workspace-configuration
@cindex workspace configuration
To set project-specific settings, which the LSP specification calls
@dfn{workspace configuration}, the variable
@code{eglot-workspace-configuration} may be used.
This variable is a directory-local variable (@pxref{Directory
Variables, , Per-directory Local Variables, emacs, The GNU Emacs
Manual}). It's important to recognize that this variable really only
makes sense when set directory-locally. It usually does not make
sense to set it file-locally or in a major-mode hook.
The most common way to set @code{eglot-workspace-configuration } is
using a @file{.dir-locals.el} file in the root of your project. If
you can't do that, you may also set it from Elisp code via the
@code{dir-locals-set-class-variables} function. (@pxref{Directory
Local Variables,,, elisp, GNU Emacs Lisp Reference Manual}).
However you choose to set it, the variable's value is a plist
(@pxref{Property Lists,,, elisp, GNU Emacs Lisp Reference Manual}) with
the following format:
@lisp
(:@var{server} @var{plist}@dots{})
(@var{:server1} @var{plist1} @var{:server2} @var{plist2} @dots{})
@end lisp
@noindent
Here @code{:@var{server}} identifies a particular language server and
@var{plist} is the corresponding keyword-value property list of one or
more parameter settings for that server, serialized by Eglot as a JSON
object. @var{plist} may be arbitrarily complex, generally containing
other keyword-value property sublists corresponding to JSON subobjects.
The JSON values @code{true}, @code{false}, @code{null} and @code{@{@}}
are represented by the Lisp values @code{t}, @code{:json-false},
@code{nil}, and @code{eglot-@{@}}, respectively.
Here, @var{:server1} and @var{:server2} are keywords whose names
identify the LSP language servers to target. Consult server
documentation to find out what name to use. @var{plist1} and
@var{plist2} are plists of options, possibly nesting other plists.
@findex eglot-show-workspace-configuration
When experimenting with workspace settings, you can use the command
@kbd{M-x eglot-show-workspace-configuration} to inspect and debug the
JSON value to be sent to the server. This helper command works even
before actually connecting to the server.
value of this variable in its final JSON form, ready to be sent to the
server (@pxref{JSONRPC objects in Elisp}). This helper command works
even before actually connecting to the server.
Here's an example of defining the workspace-configuration settings for
a project that uses two different language servers, one for Python,
the other one for Go (presumably, the project is written in a
combination of these two languages). The server for Python in this
case is @command{pylsp}, the server for Go is @command{gopls}. The
value of @code{eglot-workspace-configuration} in this case should be:
These variable's value doesn't take effect immediately. That happens
upon establishing the connection, in response to an explicit query
from the server, or when issuing the command @kbd{M-x
eglot-signal-didChangeConfiguration} which notifies the server during
an ongoing Eglot session.
@lisp
((python-mode
. ((eglot-workspace-configuration
. (:pylsp (:plugins (:jedi_completion (:include_params t
:fuzzy t)
:pylint (:enabled :json-false)))))))
(go-mode
. ((eglot-workspace-configuration
. (:gopls (:usePlaceholders t))))))
@end lisp
@subsection Examples
@noindent
This should go into the @file{.dir-locals.el} file in the project's
root directory. It sets up the value of
@code{eglot-workspace-configuration} separately for each major mode.
For some users, setting @code{eglot-workspace-configuration} is a
somewhat daunting task. One of the reasons is having to manage the
general Elisp syntax of per-mode directory-local variables, which uses
alists (@pxref{Association Lists,,, elisp, GNU Emacs Lisp Reference
Manual}), and the specific syntax of Eglot's variable, which uses
plists. Some examples are useful.
Alternatively, the same configuration could be defined as follows:
Let's say you want to configure two language servers to be used in a
project written in a combination of the Python and Go languages. You
want to use the @command{pylsp} and @command{gopls} LSP servers. In
the documentation of the servers in question (or in some other editor's
configuration file, or in some blog article), you find the following
configuration options in informal dotted-notation syntax:
@example
pylsp.plugins.jedi_completion.include_params: true
pylsp.plugins.jedi_completion.fuzzy: true
pylsp.pylint.enabled: false
gopls.usePlaceholders: true
@end example
To apply this to Eglot, and assuming you chose the
@file{.dir-locals.el} file method, the contents of that file could be:
@lisp
((nil
@ -1054,55 +1099,178 @@ Alternatively, the same configuration could be defined as follows:
. (:pylsp (:plugins (:jedi_completion (:include_params t
:fuzzy t)
:pylint (:enabled :json-false)))
:gopls (:usePlaceholders t))))))
:gopls (:usePlaceholders t)))))
(python-mode . ((indent-tabs-mode . nil)))
(go-mode . ((indent-tabs-mode . t))))
@end lisp
This is an equivalent setup which sets the value for all the
major-modes inside the project; each server will use only the section
of the parameters intended for that server, and ignore the rest.
@noindent
This sets the value of @code{eglot-workspace-configuration} in all the
buffers inside the project; each server will use only the section of
the parameters intended for that server, and ignore the rest. Note
how alists are used for associating Emacs mode names with alists
associating variable names with variable values. Then notice how
plists are used inside the value of
@code{eglot-workspace-configuration}.
As yet another alternative, you can set the value of
@code{eglot-workspace-configuration} programmatically, via the
@code{dir-locals-set-class-variables} function, @pxref{Directory Local
Variables,,, elisp, GNU Emacs Lisp Reference Manual}.
This following form may also be used:
@lisp
((python-mode
. ((eglot-workspace-configuration
. (:pylsp (:plugins (:jedi_completion (:include_params t
:fuzzy t)
:pylint (:enabled :json-false)))))
(indent-tabs-mode . nil)))
(go-mode
. ((eglot-workspace-configuration
. (:gopls (:usePlaceholders t)))
(indent-tabs-mode . t))))
@end lisp
@noindent
This sets up the value of @code{eglot-workspace-configuration}
separately depending on the major mode of each of that project's
buffers. @code{python-mode} buffers will have the variable set to
@code{(:pylsp (:plugins ...))}. @code{go-mode} buffers will have the
variable set to @code{(:gopls (:usePlaceholders t))}.
Some servers will issue workspace configuration for specific files
inside your project. For example, if you know @code{gopls} is asking
about specific files in the @code{src/imported} subdirectory and you
want to set a different option for @code{gopls.usePlaceholders} , you
may use something like:
@lisp
((python-mode
. ((eglot-workspace-configuration
. (:pylsp (:plugins (:jedi_completion (:include_params t
:fuzzy t)
:pylint (:enabled :json-false)))))
(indent-tabs-mode nil)))
(go-mode
. ((eglot-workspace-configuration
. (:gopls (:usePlaceholders t)))
(indent-tabs-mode t)))
("src/imported"
. ((eglot-workspace-configuration
. (:gopls (:usePlaceholders nil))))))
@end lisp
Finally, if one needs to determine the workspace configuration based
on some dynamic context, @code{eglot-workspace-configuration} can be
set to a function. The function is called with the
@code{eglot-lsp-server} instance of the connected server (if any) and
with @code{default-directory} set to the root of the project. The
function should return a value of the form described above.
function should return a plist suitable for use as the variable's
value.
Some servers need special hand-holding to operate correctly. If your
server has some quirks or non-conformity, it's possible to extend
Eglot via Elisp to adapt to it, by defining a suitable
@code{eglot-initialization-options} method via @code{cl-defmethod}
(@pxref{Generic Functions,,, elisp, GNU Emacs Lisp Reference Manual}).
@node User-specific configuration
@section User-specific configuration
@cindex initializationOptions
@cindex command-line arguments
Here's an example:
This kind of configuration applies to all projects the server is used
for. Here, there are a number of ways to do this inside Eglot.
A common way is to pass command-line options to the server invocation
via @code{eglot-server-programs}. Let's say we want to configure
where the @command{clangd} server reads its
@code{compile_commands.json} from. This can be done like so:
@lisp
(require 'eglot)
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
`(c++-mode . ("clangd" "--compile-commands-dir=/tmp"))))
(add-to-list 'eglot-server-programs
'((c++-mode c-mode) . (eglot-cquery "cquery")))
(defclass eglot-cquery (eglot-lsp-server) ()
:documentation "A custom class for cquery's C/C++ langserver.")
(cl-defmethod eglot-initialization-options ((server eglot-cquery))
"Passes through required cquery initialization options"
(let* ((root (car (project-roots (eglot--project server))))
(cache (expand-file-name ".cquery_cached_index/" root)))
(list :cacheDirectory (file-name-as-directory cache)
:progressReportFrequencyMs -1)))
@end lisp
@noindent
See the doc string of @code{eglot-initialization-options} for more
details.
@c FIXME: The doc string of eglot-initialization-options should be
@c enhanced and extended.
Another way is to have Eglot pass a JSON object to the server during
the LSP handshake. This is done using the
@code{:initializationOptions} syntax of @code{eglot-server-programs}:
@lisp
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
`(c++-mode . ("clangd" :initializationOptions
(:compilationDatabasePath "/tmp")))))
@end lisp
@noindent
The argument @code{(:compilationDatabasePath "/tmp")} is Emacs's
representation in plist format of a simple JSON object
@code{@{"compilationDatabasePath": "/tmp"@}}. To learn how to
represent more deeply nested options in this format, @xref{JSONRPC
objects in Elisp}.
In this case, the two examples achieve exactly the same, but notice
how the option's name has changed between them.
@vindex eglot-workspace-configuration
Finally there is another way to do user-specific configuration of
language servers, which may be used if the methods above are not
supported. It consists of @emph{globally} setting
@code{eglot-workspace-configuration}, a variable originally intended
for project-specific configuration. This has the same effect as
giving all your projects a certain default configuration, as described
in @xref{Project-specific configuration}. Here is an example.
@lisp
(setq-default eglot-workspace-configuration
'(:pylsp (:plugins (:jedi_completion (:include_params t
:fuzzy t)
:pylint (:enabled :json-false)))
:gopls (:usePlaceholders t)))
@end lisp
Note that the global value of @code{eglot-workspace-configuration} is
always overriden if a directory-local value is detected.
@node JSONRPC objects in Elisp
@section JSONRPC objects in Elisp
Emacs's preferred way of representing JSON is via Lisp lists. In
Eglot, the syntax of this list is the simplest possible (the one with
fewer parenthesis), a plist (@pxref{Property Lists,,, elisp, GNU Emacs
Lisp Reference Manual}).
The plist may be arbitrarily complex, and generally containing other
keyword-value property sub-plists corresponding to JSON sub-objects.
For representing the JSON leaf values @code{true}, @code{false},
@code{null} and @code{@{@}}, you can use the Lisp values @code{t},
@code{:json-false}, @code{nil}, and @code{eglot-@{@}}, respectively.
For example, this plist:
@lisp
(:pylsp (:plugins (:jedi_completion (:include_params t
:fuzzy t)
:pylint (:enabled :json-false)))
:gopls (:usePlaceholders t))
@end lisp
Is serialized by Eglot to the following JSON text:
@example
@{
"pylsp": @{
"plugins": @{
"jedi_completion": @{
"include_params": true,
"fuzzy": true
@},
"pylint": @{
"enabled": false
@}
@}
@},
"gopls": @{
"usePlaceholders":true
@},
@}
@end example
@node Troubleshooting Eglot
@chapter Troubleshooting Eglot

513
etc/EGLOT-NEWS Normal file
View file

@ -0,0 +1,513 @@
Eglot NEWS -*- outline -*-
Copyright (C) 2018-2023 Free Software Foundation, Inc.
See the end of the file for license conditions.
Please send Eglot bug reports to 'bug-gnu-emacs@gnu.org', and Cc (or
X-Debbugs-CC) the maintainer 'joaotavora@gmail.com' as well. Please
read the chapter titled "Troubleshooting" in the Eglot manual,
available https://joaotavora.github.io/eglot/#Troubleshooting-Eglot
This file is about changes in Eglot, the Emacs client for LSP
(Language Server Protocol) distributed with GNU Emacs since Emacs
version 29.1 and with GNU ELPA since 2018.
Note: references to Eglot issues are presented as "github#nnnn".
This refers to https://github.com/joaotavora/eglot/issues/.
That is, to look up issue github#1234, go to
https://github.com/joaotavora/eglot/issues/1234.
* Changes in Eglot 1.12 (13/03/2023)
** LSP inlay hints are now supported.
Inlay hints are small text annotations 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 using overlays, helping the user
remember those types and parameter names.
** Longstanding Tramp instability issues solved.
The solution involves a Tramp-specific workaround in Eglot. Future
Tramp versions will have this problem solved at the origin. The
workaround will then be removed. Emacs bug#61350 has more details.
(github#859, github#1020, github#883)
** LSP's 'positionEncoding' capability is now supported.
The position-encoding scheme (UTF-8, UTF-16 or UTF-32) can now
be negotiated with the server.
** More of the user's Eldoc configuration is respected.
This change addresses the problems reported in many Elglot reports
dating back to early 2021 at least.
(github#646, github#894, github#920, github#1031, github#1171).
This is unfinished work, as 'eldoc-documentation-strategy' is still
set by Eglot during its tenure over a buffer. The default value for
it cannot work reasonably with Eglot's additions to
'eldoc-documentation-functions'.
** Completion labels are correctly displayed in servers like clangd.
(github#1141)
** Assorted bugfixes.
(bug#61312, bug#61478, bug#61532, bug#61726, bug#61866, bug#61748)
* Changes in Eglot 1.11 (27/1/2023)
** New server vscode-json-languageserver added to 'eglot-server-programs'.
(bug#60198)
** Assorted bugfixes.
(bug#60379, bug#60557, (bug#61048)
* Changes in Eglot 1.10 (16/12/2022)
** Emacs progress reporters are used for LSP progress notifications.
(bug#59149)
** LSP reported URIs other than file:// are passed on to Emacs.
This change allows other URI handlers, such as a 'jar:' handling
package, to cooperate with Eglot and find files inside compressed file
systems (bug#58790).
** Eglot now shows in the menu bar.
** Tree-sitter modes added to 'eglot-server-programs'.
These modes are usually handled by the same server that handles the
"classical mode".
** New servers chsharp-ls and texlab added to 'eglot-server-programs'.
** Assorted bugfixes.
(bug#59824, bug#59338)
* Changes in Eglot 1.9 (8/10/2022)
This is the last release before integration into Emacs's core.
** New 'M-x eglot-list-connections' command.
Probably not very useful for now. More keybindings and clickable
shortcuts to connection-specific commands to be added later.
** Manual temporarily lives in separate MANUAL.md file.
The manual has been rewritten mostly from scratch. It is structured
hierarchically and is more complete. After the merge into Emacs, the
Eglot Texinfo manual bundled with Emacs used this temporary manual as
a starting point.
** Support for "single server, multiple modes".
Previously, if an entry such as '((c++-mode c-mode) . ("clangd)")' was
found in 'eglot-server-programs', it meant that '.cpp' files '.c'
files would lead to two 'clangd' instances for managing them, even if
these files were in the same project. Now only one is created. It is
assumed that most, if not all, servers configured in
'eglot-server-programs' handle this correctly.
(github#681)
** 'eglot-imenu' no longer uses problematic "special elements".
Though Eglot's 'eglot-imenu' returned a fully compliant 'imenu'
structure, that object was not understood by many other frontends
other than 'M-x imenu' itself. Since the special functionality it
enabled wasn't being used anyway, it was decided to remove it to fix
these longstanding problems.
(github#758, github#536, github#535)
** 'eglot-workspace-configuration' has been overhauled.
This variable and its uses are now more thoroughly documented. It can
be set to a function for dynamic calculation of the configuration.
The preferred format is a plist, though the earlier alist format is
still supported.
(github#967, github#590, github#790)
** 'C-u M-.' lists and completes arbitrary workspace symbols.
A very old request, now made possible by a relatively recent change to
the 'workspace/symbol' RPC method.
(github#131)
** Reworked mode-line menus.
New menus help discover Eglot's features and show which of them are
supported by the current server. Menus can be customized away via
'eglot-menu-string', making space in mode-line.
(github#792)
** Easier to use LSP 'initialize.initializationOptions'.
In 'eglot-server-programs' a plist may be appended to the usual list
of strings passed as command line arguments. The value of its
':initializationOptions' key constructs the corresponding LSP JSON
object. This may be easier than creating a 'defclass' for a specific
server and specializing 'eglot-initialization-options' to that class.
(github#901, github#845, github#940)
** LSP on-type formatting is now supported.
This is the 'documentOnTypeFormattingProvider' LSP capability, which
may be disabled via 'eglot-ignored-server-capabilities'
(github#899)
** Basic LSP "workspace folders" support added.
Eglot now advertises 'project-root' and 'project-external-roots' as
workspace-folders. (Configuring 'project-vc-external-roots-function'
via Elisp or 'tags-table-list' via Custtomize are two ways to set the
external roots of a simple git project.)
(github#893)
** Eglot can now show project wide diagnosics via Flymake.
Some LSP servers report diagnostics for all files in the current
workspace. Flymake has (as of version 1.2.1) the option to show
diagnostics from buffers other than the currently visited one. The
command 'M-x flymake-show-project-diagnostics' will now show all the
diagnostics relevant to a workspace.
(github#810)
** Support LSP completion tags.
An LSP completion tag can be used to tell the editor how to render a
completion. Presently, one kind of tag exists, denoting its
corresponding completion as obsolete.
(github#797)
** Support LSP optional diagnostic tags.
A diagnostic tag can indicate either "unused or unnecessary code" or
"deprecated or obsolete code". Following the rendering suggestions in
the protocol, we fade out unnecessary code and strike-through
deprecated code.
(github#794)
** The Rust language server is now rust-analyzer by default.
Eglot will now prefer starting "rust-analyzer" to "rls" when it is
available. The special support code for RLS has been removed.
(github#803)
** New servers have been added to 'eglot-server-programs'.
- clojure-lsp (github#813)
- racket-langserver (github#694)
- futhark lsp (github#922)
- purescript-language-server (github#905)
- Perl::LanguageServer (github#952)
- marksman (github#1013)
- jedi-language-server ([#994](github#994))
* Changes in Eglot 1.8 (12/1/2022)
** Alternate servers supported out-of-box for the same major mode.
In practice, this removes the need for Eglot to "officially" bless one
server over another.
Do not confuse this feature with another missing feature which
consists of supporting multiple servers simultaneously managing a
major mode within a project.
(github#688)
** TRAMP support added.
There are no variables to customize: visit a remote file, ensure the
server also exists in the remote, and type "M-x eglot".
(github#637, github#463, github#84)
** 'eglot-ignored-server-capabilities' is now correctly spelled.
This user-visible variable used to be spelled
'eglot-ignored-server-capabilites', which is still a valid but
obsolete name.
(github#724)
** Eglot can manage cross-referenced files outside project.
This is activated by a new customization option
'eglot-extend-to-xref', which defaults to nil.
(github#76, github#686, github#695)
** Code action shortcuts can be added by the user.
'M-x eglot-code-actions' accepts an optional 'action-kind' argument,
specified interactively with 'C-u'. Other shortcuts call specific
actions directly ('eglot-code-action-inline',
'eglot-code-action-extract', 'eglot-code-action-rewrite',
'eglot-code-action-organize-imports' and
'eglot-code-action-quickfix'). One can create one's own shortcuts for
code actions with specific a kind by calling 'eglot-code-actions' from
Lisp.
(github#411)
** New command 'eglot-shutdown-all added.
This disconnects all the Eglot connections in the user's session.
(github#643)
** New variable 'eglot-withhold-process-id' added.
If non-nil, Eglot will not send the Emacs process ID to the language
server. This can be useful when using docker to run a language
server.
(github#722)
** Several new servers have been added to 'eglot-server-programs'.
- cmake-language-server (github#787)
- css-languageserver (github#204, github#769)
- fortls (github#603)
- html-languageserver (github#204, github#769)
- json-languageserver (github#204, github#769)
- lua-lsp (github#721)
- mint ls (github#750)
- pyright (github#742)
- vim-language-server (github#787)
- yaml-language-server (github#751)
- zls (github#646)
* Changes in Eglot 1.7 (16/12/2020)
** Hierarchical symbols are supported in Imenu.
(github#303).
** Multiple "documentation at point" sources are supported.
Such sources include as LSP's signature, hover and also the Flymake
diagnostic messages. They can all be presented in the echo area
(space permitting), or via 'C-h .'. For now, composition of different
sources can be customized using 'eldoc-documentation-strategy',
'eldoc-echo-area-use-multiline-p' and 'eldoc-prefer-doc-buffer'.
The variables 'eglot-put-doc-in-help-buffer' and
'eglot-auto-display-help-buffer' have been removed.
(github#439, github#494, github#481, github#454)
* Changes in Eglot 1.6 (16/04/2020)
** Column offset calculation is now LSP-conformant.
It seems the majority of servers now comply with the language server
specification when it comes to handling non-ASCII texts. Therefore
the default values of 'eglot-move-to-column-function' and
'eglot-current-column-function' have been changed. Consult the
documentation of these variables for how to restore the old behavior.
(github#361)
** LSP workspace/configuration requests are supported.
Also a new section "Per-project server configuration" in the README.md
should answer some FAQ's in this regard.
(github#326)
* Changes in Eglot 1.5 (20/10/2019)
** Eglot takes over Company configuration.
Similar to what was already the case with Flymake, Eldoc and Xref, use
just the backend that can do something useful in Eglot,
'company-capf'. See 'eglot-stay-out-of' to opt out of this.
(github#324)
** New option 'eglot-autoshutdown' added.
This disconnects the server after last managed buffer is killed.
(github#217, github#270)
** Completion support support has been fixed.
Among other things, consider LSP's "filterText" cookies, which enable
a kind of poor-man's flex-matching for some backends.
(github#235, github#313, github#311, github#279)
** Supports LSP's "goto declaration/implementation/typeDefinition".
(github#302)
** New option 'eglot-send-changes-idle-time' added.
(github#258)
** Eglot's Eldoc no longer flickers when moving around.
(github#198)
** Large docs shown in help buffer instead of echo area by default.
Also add two new customization variables
'eglot-put-doc-in-help-buffer' and 'eglot-auto-display-help-buffer'.
(github#198)
** Built-in support for Go, Elixir and Ada added.
(github#304, github#264, github#316)
* Changes in Eglot 1.4 (5/1/2019)
** Parameter highlighting in the first line of signature corrected.
** Markdown documentation strings are rendered with faces.
Eglot uses 'gfm-view-mode' for this.
** Hard dependencies on Flymake have been removed.
The user can turn Flymake off now in buffers managed by Eglot.
** Connection hooks are run with proper directory local variables.
This fixes issues with suspiciously empty 'didChangeConfiguration'
messages that are supposed to communicate parameters from a
directory-set 'eglot-workspace-configuration'.
(github#196)
** Completion sorting has been fixed.
If the server returns completions in some sensible order, Eglot will
keep it.
(github#190)
** Flymake and Eldoc taken over completely while managing buffers.
No longer try to add Eglot's facilities to existing facilities in
these two domains.
* Changes in Eglot 1.3 (10/12/2018)
** Provide strict checking of incoming LSP messagesp.
(github#144, github#156)
** Add brief context after 'xref-find-references' when available.
(github#52)
** Support 'completionContext' to help servers like 'ccls'.
** Use Flymake from GNU ELPA.
(github#178)
* Changes in Eglot 1.2 (23/11/2018)
** Support snippet completions.
Eglot uses 'yasnippet.el' for this, if it is installed.
(github#50)
** 'workspace/didChangeConfiguration' implemented.
(github#29)
** Handle experimental/unknown server methods gracefully.
(github#39)
** Accept functions as entries in 'eglot-server-programs'.
'CONTACT' in the '(MAJOR-MODE . CONTACT)' association in
'eglot-server-programs' can now be a function of no arguments
producing any value previously valid for a contact. Functions can be
interactive or non-interactive.
(github#63)
** Improve completion to be snappier and don't hinder typing.
(github#61)
** Consider ':triggerCharacters' in company completion.
(github#80)
** Add support for LSP 'TextEdit' objects in completion.
** Prefer ccls over cquery for C/C++
(github#94)
** 'eglot-ignored-server-capabilites' is more user-friendly.
(github#126)
** Supports asynchronous connections.
If a connection to the server is taking too long, is will continue in
the background. A new defcustom 'eglot-sync-connect' controls this
feature.
(github#68)
** The 'eglot-shutdown' command prompts for the server to shutdown.
(github#73)
** Add support for the Eclipse JDT language server.
(github#63)
** Add out-of-the-box support for Haskell, Kotlin, Go, Ocaml, R.
** Add the ability to move to LSP-precise columns.
Some servers like 'clangd' follow the UTF-16-based spec very closely
here.
(github#124)
** Fix a potential security issue fontifying LSP doc.
(github#154)
** Fix many, many bugs
(github#44, github#48, github#54, github#58, github#64, github#74,
github#81, github#82, github#86, github#87, github#83, github#93,
github#100, github#115, github#120, github#121, github#126,
github#138, github#144, github#158, github#160, github#167)
* Changes in Eglot 1.1 (9/7/2018)
** Implement TCP autostart/autoconnect (and support Ruby's Solargraph).
The ':autoport' symbol in the server incovation is replaced
dynamically by a local port believed to be vacant, so that the ensuing
TCP connection finds a listening server.
** Eglot now depends on Emacs library 'jsonrpc.el'.
----------------------------------------------------------------------
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
Local Variables:
bug-reference-bug-regexp: "\\(\\(github\\|bug\\)#\\([0-9]+\\)\\)"
bug-reference-url-format: eglot--debbugs-or-github-bug-uri
paragraph-separate: "[ ]"
End:

View file

@ -3214,7 +3214,8 @@ Imenu now lists the members directly nested in R6RS Scheme libraries
Emacs now comes with the Eglot package, which enhances various Emacs
features, such as completion, documentation, error detection, etc.,
based on data provided by language servers using the Language Server
Protocol (LSP). See the new Info manual "(eglot) Top" for more.
Protocol (LSP). See the new Info manual "(eglot) Top" for more. Also
see "etc/EGLOT-NEWS".
+++
** use-package: Declarative package configuration.
@ -4884,6 +4885,12 @@ two buttons: "Yes" and "No".
---
*** 'process-attributes' is now implemented.
** macOS
+++
*** The 'ns-popup-font-panel' command has been removed.
Use the general command 'M-x menu-set-font' instead.
----------------------------------------------------------------------
This file is part of GNU Emacs.

View file

@ -1093,7 +1093,9 @@ NEW-NAME."
(with-temp-buffer
(set-buffer-multibyte nil)
(archive--extract-file extractor copy ename)
(write-region (point-min) (point-max) write-to))
(let ((coding-system-for-write
(or coding-system-for-write 'no-conversion)))
(write-region (point-min) (point-max) write-to)))
(unless (equal copy archive)
(delete-file copy))))))))
@ -1954,10 +1956,21 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
;; -------------------------------------------------------------------------
;;; Section: Zip Archives
(declare-function w32-get-console-codepage "w32proc.c")
(defun archive-zip-summarize ()
(goto-char (- (point-max) (- 22 18)))
(search-backward-regexp "[P]K\005\006")
(let ((p (archive-l-e (+ (point) 16) 4))
(w32-fname-encoding
;; On MS-Windows, both InfoZip's Zip and the system's
;; built-in File Explorer use the console codepage for
;; encoding file names. Problem: the codepage of the system
;; where the zip file was created cannot be known; we assume
;; it is the same as the one of the current system. Also,
;; the zip file doesn't tell us the OS where the file was
;; created, it only tells the filesystem.
(if (eq system-type 'windows-nt)
(intern (format "cp%d" (w32-get-console-codepage)))))
files)
(when (or (= p #xffffffff) (= p -1))
;; If the offset of end-of-central-directory is 0xFFFFFFFF, this
@ -1987,7 +2000,15 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
;; (lheader (archive-l-e (+ p 42) 4))
(efnname (let ((str (buffer-substring (+ p 46) (+ p 46 fnlen))))
(decode-coding-string
str archive-file-name-coding-system)))
str
(or (if (and w32-fname-encoding
(memq creator
;; This should be just 10 and
;; 14, but InfoZip uses 0 and
;; File Explorer uses 11(??).
'(0 10 11 14)))
w32-fname-encoding)
archive-file-name-coding-system))))
(ucsize (if (and (or (= ucsize #xffffffff) (= ucsize -1))
(> exlen 0))
;; APPNOTE.TXT, para 4.5.3: the Extra Field

View file

@ -140,8 +140,8 @@ Keys are marked using `epa-ks-mark-key-to-fetch'."
(epa-ks--fetch-key id)))))
(tabulated-list-clear-all-tags))
(defun epa-ks--query-url (query exact)
"Return URL for QUERY.
(defun epa-ks--query-url (query exact &optional operation)
"Return URL for QUERY and OPERATION (defaults to \"index\").
If EXACT is non-nil, don't accept approximate matches."
(format "https://%s/pks/lookup?%s"
(cond ((null epa-keyserver)
@ -154,13 +154,13 @@ If EXACT is non-nil, don't accept approximate matches."
(url-build-query-string
(append `(("search" ,query)
("options" "mr")
("op" "index"))
("op" ,(or operation "index")))
(and exact '(("exact" "on")))))))
(defun epa-ks--fetch-key (id)
"Send request to import key with specified ID."
(url-retrieve
(epa-ks--query-url (concat "0x" (url-hexify-string id)) t)
(epa-ks--query-url (concat "0x" (url-hexify-string id)) t "get")
(lambda (status)
(when (plist-get status :error)
(error "Request failed: %s"
@ -236,7 +236,7 @@ enough, since keyservers have strict timeout settings."
(erase-buffer))
(epa-ks-search-mode))
(url-retrieve
(epa-ks--query-url query exact)
(epa-ks--query-url query exact "index")
(lambda (status)
(when (plist-get status :error)
(when buf

View file

@ -681,8 +681,8 @@ variables for a connection profile are defined using
(setq connection-local-criteria-alist
(cons (cons criteria (delete-dups profiles))
connection-local-criteria-alist))))
(customize-set-variable
'connection-local-criteria-alist connection-local-criteria-alist))
(custom-set-variables
`(connection-local-criteria-alist ',connection-local-criteria-alist now)))
(defsubst connection-local-get-profile-variables (profile)
"Return the connection-local variable list for PROFILE."
@ -702,8 +702,8 @@ variables are set in the server's process buffer according to the
VARIABLES list of the connection profile. The list is processed
in order."
(setf (alist-get profile connection-local-profile-alist) variables)
(customize-set-variable
'connection-local-profile-alist connection-local-profile-alist))
(custom-set-variables
`(connection-local-profile-alist ',connection-local-profile-alist now)))
;;;###autoload
(defun connection-local-update-profile-variables (profile variables)

View file

@ -79,16 +79,22 @@ If nil, the feature is disabled, i.e., all commands work normally.")
Do you want to use this command anyway?
You can now type:
\\`y' to try it and enable it (no questions if you use it again).
\\`n' to cancel--don't try the command, and it remains disabled.
\\`n' (also C-g) to cancel--don't try the command; it remains disabled.
\\`y' to enable the command (no questions if you use it again).
\\`SPC' to try the command just this once, but leave it disabled.
\\`!' to try it, and enable all disabled commands for this session only.")))
\\`!' to enable it and all the disabled commands for this session.")))
(char
;; Note: the prompt produced from the choices below must not
;; overflow a single screen line, because otherwise it will
;; cause the mini-window to resize, which will in turn hide
;; the last line of the help text above: the code which fits
;; the window to the size of the help text does not expect
;; the mini-window to become taller.
(car (read-multiple-choice "Use this command?"
'((?y "yes")
(?n "no")
(?! "yes; enable for session")
(?\s "(space bar) yes; once"))
'((?n "no")
(?y "yes")
(?\s "(space bar) only once")
(?! "use and enable all"))
help-string
"*Disabled Command*"))))
(pcase char

View file

@ -961,9 +961,9 @@ the semicolon. This function skips the semicolon."
;; Imenu.
(setq-local treesit-simple-imenu-settings
(let ((pred #'c-ts-mode--defun-valid-p))
`(("Struct" ,(rx bos (or "struct" "enum" "union")
"_specifier" eos)
,pred nil)
`(("Enum" "\\`enum_specifier\\'" ,pred nil)
("Struct" "\\`struct_specifier\\'" ,pred nil)
("Union" "\\`union_specifier\\'" ,pred nil)
("Variable" ,(rx bos "declaration" eos) ,pred nil)
("Function" "\\`function_definition\\'" ,pred nil)
("Class" ,(rx bos (or "class_specifier"

View file

@ -2,12 +2,12 @@
;; Copyright (C) 2018-2023 Free Software Foundation, Inc.
;; Version: 1.11
;; Version: 1.12
;; Author: João Távora <joaotavora@gmail.com>
;; Maintainer: João Távora <joaotavora@gmail.com>
;; URL: https://github.com/joaotavora/eglot
;; Keywords: convenience, languages
;; Package-Requires: ((emacs "26.3") (jsonrpc "1.0.16") (flymake "1.2.1") (project "0.9.3") (xref "1.4.0") (eldoc "1.11.0") (seq "2.23") (external-completion "0.1"))
;; Package-Requires: ((emacs "26.3") (jsonrpc "1.0.16") (flymake "1.2.1") (project "0.9.8") (xref "1.6.2") (eldoc "1.11.0") (seq "2.23") (external-completion "0.1"))
;; This is a GNU ELPA :core package. Avoid adding functionality
;; that is not available in the version of Emacs recorded above or any
@ -1155,12 +1155,12 @@ INTERACTIVE is t if called interactively."
(cl-labels
((maybe-connect
()
(remove-hook 'post-command-hook #'maybe-connect nil)
(eglot--when-live-buffer buffer
(remove-hook 'post-command-hook #'maybe-connect t)
(unless eglot--managed-mode
(apply #'eglot--connect (eglot--guess-contact))))))
(when buffer-file-name
(add-hook 'post-command-hook #'maybe-connect 'append nil)))))
(add-hook 'post-command-hook #'maybe-connect 'append t)))))
(defun eglot-events-buffer (server)
"Display events buffer for SERVER.
@ -3666,13 +3666,14 @@ If NOERROR, return predicate, else erroring function."
;;; Misc
;;;
(defun eglot--debbugs-or-github-bug-uri ()
(format (if (string= (match-string 2) "github")
"https://github.com/joaotavora/eglot/issues/%s"
"https://debbugs.gnu.org/%s")
(match-string 3)))
(put 'eglot--debbugs-or-github-bug-uri 'bug-reference-url-format t)
;;;###autoload
(progn
(put 'eglot--debbugs-or-github-bug-uri 'bug-reference-url-format t)
(defun eglot--debbugs-or-github-bug-uri ()
(format (if (string= (match-string 2) "github")
"https://github.com/joaotavora/eglot/issues/%s"
"https://debbugs.gnu.org/%s")
(match-string 3))))
;;; Obsolete
;;;

View file

@ -36,6 +36,8 @@
(declare-function treesit-node-start "treesit.c")
(declare-function treesit-node-type "treesit.c")
(declare-function treesit-node-child-by-field-name "treesit.c")
(declare-function treesit-node-child-by-field-name "treesit.c")
(declare-function treesit-query-capture "treesit.c")
(defcustom java-ts-mode-indent-offset 4
"Number of spaces for each indentation step in `java-ts-mode'."
@ -145,6 +147,16 @@
"|=" "~" ">>" ">>>" "<<" "::" "?" "&=")
"Java operators for tree-sitter font-locking.")
(defun java-ts-mode--string-highlight-helper ()
"Returns, for strings, a query based on what is supported by
the available version of Tree-sitter for java."
(condition-case nil
(progn (treesit-query-capture 'java '((text_block) @font-lock-string-face))
`((string_literal) @font-lock-string-face
(text_block) @font-lock-string-face))
(error
`((string_literal) @font-lock-string-face))))
(defvar java-ts-mode--font-lock-settings
(treesit-font-lock-rules
:language 'java
@ -182,8 +194,7 @@
:language 'java
:override t
:feature 'string
`((string_literal) @font-lock-string-face
(text_block) @font-lock-string-face)
(java-ts-mode--string-highlight-helper)
:language 'java
:override t
:feature 'literal

View file

@ -426,7 +426,7 @@ This variant of `rx' supports common Python named REGEXPS."
(or "def" "for" "with")))
symbol-end))
(dedenter (seq symbol-start
(or "elif" "else" "except" "finally")
(or "elif" "else" "except" "finally" "case")
symbol-end))
(block-ender (seq symbol-start
(or
@ -2062,10 +2062,6 @@ of the statement."
;; are somehow out of whack. This has been
;; observed when using `syntax-ppss' during
;; narrowing.
;; It can also fail in cases where the buffer is in
;; the process of being modified, e.g. when creating
;; a string with `electric-pair-mode' disabled such
;; that there can be an unmatched single quote
(when (>= string-start last-string-end)
(goto-char string-start)
(if (python-syntax-context 'paren)
@ -2076,10 +2072,16 @@ of the statement."
(goto-char (+ (point)
(python-syntax-count-quotes
(char-after (point)) (point))))
(setq last-string-end
(or (re-search-forward
(rx (syntax string-delimiter)) nil t)
(goto-char (point-max)))))))
(setq
last-string-end
(or (if (eq t (nth 3 (syntax-ppss)))
(re-search-forward
(rx (syntax string-delimiter)) nil t)
(ignore-error scan-error
(goto-char string-start)
(python-nav--lisp-forward-sexp)
(point)))
(goto-char (point-max)))))))
((python-syntax-context 'paren)
;; The statement won't end before we've escaped
;; at least one level of parenthesis.
@ -2148,10 +2150,7 @@ backward to previous statement."
(while (and (forward-line 1)
(not (eobp))
(or (and (> (current-indentation) block-indentation)
(let ((start (point)))
(python-nav-end-of-statement)
;; must move forward otherwise infinite loop
(> (point) start)))
(or (python-nav-end-of-statement) t))
(python-info-current-line-comment-p)
(python-info-current-line-empty-p))))
(python-util-forward-comment -1)
@ -5784,7 +5783,8 @@ likely an invalid python file."
(pairs '(("elif" "elif" "if")
("else" "if" "elif" "except" "for" "while")
("except" "except" "try")
("finally" "else" "except" "try")))
("finally" "else" "except" "try")
("case" "case")))
(dedenter (match-string-no-properties 0))
(possible-opening-blocks (cdr (assoc-string dedenter pairs)))
(collected-indentations)
@ -5793,7 +5793,9 @@ likely an invalid python file."
(while (python-nav--syntactically
(lambda ()
(cl-loop while (re-search-backward (python-rx block-start) nil t)
if (memq (char-before) '(nil ?\s ?\t ?\n))
if (save-match-data
(looking-back (rx line-start (* whitespace))
(line-beginning-position)))
return t))
#'<)
(let ((indentation (current-indentation)))

View file

@ -1026,7 +1026,7 @@ leading double colon is not added."
(:match "\\`?[#\"'`:?]" @char))
;; Symbols like :+, :<=> or :foo=.
((simple_symbol) @symbol
(:match "[[:punct:]]" @symbol))
(:match "\\s." @symbol))
;; Method calls with name ending with ? or !.
((call method: (identifier) @ident)
(:match "[?!]\\'" @ident))
@ -1058,7 +1058,9 @@ leading double colon is not added."
(put-text-property (1- (treesit-node-end node)) (treesit-node-end node)
'syntax-table (string-to-syntax "_")))
('symbol
(put-text-property (1+ (treesit-node-start node)) (treesit-node-end node)
(goto-char (treesit-node-end node))
(skip-syntax-backward "." (treesit-node-start node))
(put-text-property (point) (treesit-node-end node)
'syntax-table (string-to-syntax "_")))
('heredoc
(put-text-property (treesit-node-start node) (1+ (treesit-node-start node))

View file

@ -91,6 +91,7 @@
((parent-is "let_declaration") parent-bol rust-ts-mode-indent-offset)
((parent-is "macro_definition") parent-bol rust-ts-mode-indent-offset)
((parent-is "parameters") parent-bol rust-ts-mode-indent-offset)
((parent-is "struct_pattern") parent-bol rust-ts-mode-indent-offset)
((parent-is "token_tree") parent-bol rust-ts-mode-indent-offset)
((parent-is "use_list") parent-bol rust-ts-mode-indent-offset)))
"Tree-sitter indent rules for `rust-ts-mode'.")
@ -235,6 +236,7 @@
"^\\(u8\\|u16\\|u32\\|u64\\|u128\\|usize\\|i8\\|i16\\|i32\\|i64\\|i128\\|isize\\|char\\|str\\)$"
@font-lock-type-face))
((scoped_identifier path: (identifier) @rust-ts-mode--fontify-scope))
((scoped_type_identifier path: (identifier) @rust-ts-mode--fontify-scope))
(type_identifier) @font-lock-type-face)
:language 'rust

View file

@ -1,7 +1,7 @@
;;; xref.el --- Cross-referencing commands -*-lexical-binding:t-*-
;; Copyright (C) 2014-2023 Free Software Foundation, Inc.
;; Version: 1.6.2
;; Version: 1.6.3
;; Package-Requires: ((emacs "26.1"))
;; This is a GNU ELPA :core package. Avoid functionality that is not
@ -981,7 +981,7 @@ point."
map))
(declare-function outline-search-text-property "outline"
(property &optional value bound move backward looking-at))
(property &optional value bound move backward looking-at))
(define-derived-mode xref--xref-buffer-mode special-mode "XREF"
"Mode for displaying cross-references."
@ -993,14 +993,14 @@ point."
(setq imenu-extract-index-name-function
#'xref--imenu-extract-index-name)
(setq-local add-log-current-defun-function
#'xref--add-log-current-defun)
(setq-local outline-minor-mode-cycle t
outline-minor-mode-use-buttons 'insert
outline-search-function
#'xref--add-log-current-defun)
(setq-local outline-minor-mode-cycle t)
(setq-local outline-minor-mode-use-buttons 'insert)
(setq-local outline-search-function
(lambda (&optional bound move backward looking-at)
(outline-search-text-property
'xref-group nil bound move backward looking-at))
outline-level (lambda () 1)))
'xref-group nil bound move backward looking-at)))
(setq-local outline-level (lambda () 1)))
(defvar xref--transient-buffer-mode-map
(let ((map (make-sparse-keymap)))

View file

@ -1954,7 +1954,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
/* Do less garbage collection in batch mode (since these tend to be
more short-lived, and the memory is returned to the OS on exit
anyway). */
Vgc_cons_percentage = make_float (noninteractive? 1.0: 0.1);
Vgc_cons_percentage = make_float (noninteractive && initialized ? 1.0 : 0.1);
no_loadup
= argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args);

View file

@ -66,7 +66,9 @@
"Test setting connection-local profile variables."
;; Declare (PROFILE VARIABLES) objects.
(let (connection-local-profile-alist connection-local-criteria-alist)
(let ((clpa connection-local-profile-alist)
(clca connection-local-criteria-alist)
connection-local-profile-alist connection-local-criteria-alist)
(connection-local-set-profile-variables
'remote-bash files-x-test--variables1)
(should
@ -94,13 +96,20 @@
(should
(equal
(connection-local-get-profile-variables 'remote-nullfile)
files-x-test--variables4))))
files-x-test--variables4))
;; Cleanup.
(custom-set-variables
`(connection-local-profile-alist ',clpa now)
`(connection-local-criteria-alist ',clca now))))
(ert-deftest files-x-test-connection-local-update-profile-variables ()
"Test updating connection-local profile variables."
;; Declare (PROFILE VARIABLES) objects.
(let (connection-local-profile-alist connection-local-criteria-alist)
(let ((clpa connection-local-profile-alist)
(clca connection-local-criteria-alist)
connection-local-profile-alist connection-local-criteria-alist)
(connection-local-set-profile-variables
'remote-bash (copy-alist files-x-test--variables1))
(should
@ -116,13 +125,20 @@
(equal
(connection-local-get-profile-variables 'remote-bash)
(cons (car files-x-test--variables2)
(cdr files-x-test--variables1))))))
(cdr files-x-test--variables1))))
;; Cleanup.
(custom-set-variables
`(connection-local-profile-alist ',clpa now)
`(connection-local-criteria-alist ',clca now))))
(ert-deftest files-x-test-connection-local-set-profiles ()
"Test setting connection-local profiles."
;; Declare (CRITERIA PROFILES) objects.
(let (connection-local-profile-alist connection-local-criteria-alist)
(let ((clpa connection-local-profile-alist)
(clca connection-local-criteria-alist)
connection-local-profile-alist connection-local-criteria-alist)
(connection-local-set-profile-variables
'remote-bash files-x-test--variables1)
(connection-local-set-profile-variables
@ -205,12 +221,19 @@
'(remote-bash remote-ksh remote-nullfile)))
;; A criteria other than plist is wrong.
(should-error (connection-local-set-profiles 'dummy))))
(should-error (connection-local-set-profiles 'dummy))
;; Cleanup.
(custom-set-variables
`(connection-local-profile-alist ',clpa now)
`(connection-local-criteria-alist ',clca now))))
(ert-deftest files-x-test-hack-connection-local-variables-apply ()
"Test setting connection-local variables."
(let (connection-local-profile-alist connection-local-criteria-alist)
(let ((clpa connection-local-profile-alist)
(clca connection-local-criteria-alist)
connection-local-profile-alist connection-local-criteria-alist)
(connection-local-set-profile-variables
'remote-bash files-x-test--variables1)
@ -302,13 +325,18 @@
(hack-connection-local-variables-apply nil)
(should-not connection-local-variables-alist)
(should-not (local-variable-p 'remote-shell-file-name))
(should-not (boundp 'remote-shell-file-name))))))
(should-not (boundp 'remote-shell-file-name))))
;; Cleanup.
(custom-set-variables
`(connection-local-profile-alist ',clpa now)
`(connection-local-criteria-alist ',clca now))))
(ert-deftest files-x-test-with-connection-local-variables ()
"Test setting connection-local variables."
(let ((connection-local-profile-alist connection-local-profile-alist)
(connection-local-criteria-alist connection-local-criteria-alist))
(let ((clpa connection-local-profile-alist)
(clca connection-local-criteria-alist))
(connection-local-set-profile-variables
'remote-bash files-x-test--variables1)
(connection-local-set-profile-variables
@ -385,7 +413,12 @@
(should-not (local-variable-p 'remote-null-device))
;; The variable values are reset.
(should-not (boundp 'remote-shell-file-name))
(should (string-equal (symbol-value 'remote-null-device) "null"))))))
(should (string-equal (symbol-value 'remote-null-device) "null"))))
;; Cleanup.
(custom-set-variables
`(connection-local-profile-alist ',clpa now)
`(connection-local-criteria-alist ',clca now))))
(defun files-x-test--get-lazy-var ()
"Get the connection-local value of `remote-lazy-var'.
@ -405,7 +438,9 @@ If it's not initialized yet, initialize it."
(ert-deftest files-x-test-setq-connection-local ()
"Test dynamically setting connection local variables."
(let (connection-local-profile-alist connection-local-criteria-alist)
(let ((clpa connection-local-profile-alist)
(clca connection-local-criteria-alist)
connection-local-profile-alist connection-local-criteria-alist)
(connection-local-set-profile-variables
'remote-lazy files-x-test--variables5)
(connection-local-set-profiles
@ -440,7 +475,12 @@ If it's not initialized yet, initialize it."
(should (equal (files-x-test--get-lazy-var) "there"))
(with-connection-local-application-variables
(cadr files-x-test--application)
(should (equal remote-null-device "null"))))))
(should (equal remote-null-device "null"))))
;; Cleanup.
(custom-set-variables
`(connection-local-profile-alist ',clpa now)
`(connection-local-criteria-alist ',clca now))))
(provide 'files-x-tests)
;;; files-x-tests.el ends here

View file

@ -5973,6 +5973,8 @@ INPUT, if non-nil, is a string sent to the process."
(enable-remote-dir-locals t)
(inhibit-message t)
kill-buffer-query-functions
(clpa connection-local-profile-alist)
(clca connection-local-criteria-alist)
connection-local-profile-alist connection-local-criteria-alist)
(unwind-protect
(progn
@ -6021,6 +6023,9 @@ INPUT, if non-nil, is a string sent to the process."
(kill-buffer (current-buffer))))
;; Cleanup.
(custom-set-variables
`(connection-local-profile-alist ',clpa now)
`(connection-local-criteria-alist ',clca now))
(ignore-errors (delete-directory tmp-name1 'recursive)))))
(ert-deftest tramp-test34-explicit-shell-file-name ()
@ -6031,6 +6036,8 @@ INPUT, if non-nil, is a string sent to the process."
(let ((default-directory ert-remote-temporary-file-directory)
explicit-shell-file-name kill-buffer-query-functions
(clpa connection-local-profile-alist)
(clca connection-local-criteria-alist)
connection-local-profile-alist connection-local-criteria-alist)
(unwind-protect
(progn
@ -6062,6 +6069,9 @@ INPUT, if non-nil, is a string sent to the process."
;; Cleanup.
(put 'explicit-shell-file-name 'permanent-local nil)
(custom-set-variables
`(connection-local-profile-alist ',clpa now)
`(connection-local-criteria-alist ',clca now))
(kill-buffer "*shell*"))))
(ert-deftest tramp-test35-exec-path ()

View file

@ -1658,6 +1658,21 @@ a == 4):
(python-indent-line t)
(should (= (python-indent-calculate-indentation t) 6))))
(ert-deftest python-indent-dedenters-9 ()
"Test de-indentation for the case keyword."
(python-tests-with-temp-buffer
"
match a:
case 1:
print(1)
case 2
"
(python-tests-look-at "case 2")
(should (eq (car (python-indent-context)) :at-dedenter-block-start))
(should (= (python-indent-calculate-indentation) 4))
(python-indent-line t)
(should (= (python-indent-calculate-indentation t) 4))))
(ert-deftest python-indent-inside-string-1 ()
"Test indentation for strings."
(python-tests-with-temp-buffer
@ -1994,6 +2009,20 @@ def test_re(string):
(python-tests-look-at "else:")
(should (= (python-indent-calculate-indentation) 4))))
(ert-deftest python-indent-after-bare-match ()
"Test BUG 62031 regression."
(python-tests-with-temp-buffer
"
from re import match
def test_re(string):
if match('^[a-c]+$', string):
print('yes')
else:
"
(python-tests-look-at "else:")
(should (= (python-indent-calculate-indentation) 4))))
;;; Filling
@ -2955,6 +2984,36 @@ string
"'\n''\n"
(python-nav-end-of-statement)))
(ert-deftest python-nav-end-of-statement-3 ()
"Test unmatched quotes (Bug#58780)."
(python-tests-with-temp-buffer
"
' \"\"\"
v = 1
"
(python-tests-look-at "v =")
(should (= (save-excursion
(python-nav-end-of-statement)
(point))
(save-excursion
(point-max))))))
(ert-deftest python-nav-end-of-statement-4 ()
(python-tests-with-temp-buffer
"
abc = 'a\\
b\\
c'
d = '''d'''
"
(python-tests-look-at "b\\")
(should (= (save-excursion
(python-nav-end-of-statement)
(point))
(save-excursion
(python-tests-look-at "c'")
(pos-eol))))))
(ert-deftest python-nav-forward-statement-1 ()
(python-tests-with-temp-buffer
"
@ -5221,6 +5280,20 @@ def decoratorFunctionWithArguments(arg1, arg2, arg3):
(should (string= (python-info-current-defun t)
"def decoratorFunctionWithArguments"))))
(ert-deftest python-info-current-defun-4 ()
"Ensure unmatched quotes do not cause hang (Bug#58780)."
(python-tests-with-temp-buffer
"
def func():
' \"\"\"
v = 1
"
(python-tests-look-at "v = 1")
(should (string= (python-info-current-defun)
"func"))
(should (string= (python-info-current-defun t)
"def func"))))
(ert-deftest python-info-current-symbol-1 ()
(python-tests-with-temp-buffer
"

View file

@ -258,6 +258,22 @@ The whitespace before and including \"|\" on each line is removed."
(delete-char 1)
(should (string= (ruby-ts-add-log-current-function) "M::C#foo"))))
(ert-deftest ruby-ts-syntax-propertize-symbol ()
(skip-unless (treesit-ready-p 'ruby t))
(pcase-dolist (`(,str . ,expected)
'((":abc" . ":abc")
(":foo?" . #(":foo?" 4 5 (syntax-table (3))))
(":<=>" . #(":<=>" 1 4 (syntax-table (3))))))
(ruby-ts-with-temp-buffer str
(syntax-propertize (point-max))
(let ((text (buffer-string)))
(remove-text-properties 0 (1- (point-max))
'(fontified)
text)
(should (equal-including-properties
text
expected))))))
(defmacro ruby-ts-resource-file (file)
`(when-let ((testfile ,(or (macroexp-file-name)
buffer-file-name)))