* lisp/replace.el (replace-preview--input): New function.
(replace-preview-update): Add optional START and END, and
preview only the matches between them.
(replace-preview-setup): Accept a nil FROM, read from the
minibuffer along with the replacement, and add optional
BACKWARD. Limit the preview to the part of the buffer that the
replacement will cover.
(query-replace-read-to): Add optional BACKWARD and pass it on.
(query-replace-read-args): Preview the replacement while reading
FROM as well, and preview nothing when the caller asks for no
highlighting.
* lisp/isearch.el (isearch-query-replace): Pass BACKWARD to
`query-replace-read-to'.
* test/lisp/replace-tests.el (replace-tests--preview): Add START
and END.
(replace-tests-preview-bounds, replace-tests-preview-input): New
tests.
* doc/emacs/search.texi (Replace): Document the above.
* lisp/replace.el (query-replace-show-preview): Accept the
symbols `replacement-only' and `both'. Update the :type
accordingly, which also fixes the name of a function that does
not exist.
(query-replace-preview-match): Update the doc string.
(replace-preview-both, replace-preview-replacement-only): Say
which value of the option calls them.
(replace-preview--format): Dispatch on the new values, and still
call a function value.
(replace-preview-setup): Test the option for non-nil instead of
testing it with `functionp'.
* test/lisp/replace-tests.el (replace-tests--preview)
(replace-tests-preview-both, replace-tests-preview-cleanup)
(replace-tests-preview-disabled): Use the new values.
* doc/emacs/search.texi (Replace): Document the new values.
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-1):
Highlight `define-button-type' the same as `define-widget'.
* (lisp-imenu-generic-expression): Treat `define-button-type'
the same as `define-widget'.
Add new `font-lock-keyword' symbol property, which does the opposite
of the existing `no-font-lock-keyword'; allowing to highlight certain
functions, like macros and special-forms, as opposed to allowing to
not highlight certain macros.
* lisp/emacs-lisp/lisp-mode.el (lisp--el-match-keyword): Use new
`font-lock-keyword'.
* lisp/vc/vc-dir.el (vc-dir-refresh): New OK-IF-ALREADY-RUNNING
argument.
(vc-dir): Use it so that we do not error if already refreshing
(bug#81798).
* lisp/vc/vc-dispatcher.el (vc-set-async-update): Use it such
that if VC-Dir is already refreshing, we restart the refresh.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-style-setter):
Add BUFFER-LOCAL argument. If setting globally, do not override
buffer locals.
(c-ts-mode--simple-indent-rules): Remove 'style' arg, use
`'-ts-mode-indent-style' instead. Handle the case where
this style is a function. Set 'treesit-simple-indent-rules'.
(c-ts-mode-set-style, c-ts-mode, c++-ts-mode): Adjust accordingly.
If you typed `n' before "./" had appeared, Emacs signalled a
wrong-type-argument error. Now it signals a better one.
* lisp/vc/vc-dir.el (vc-dir--before-dotname-p): Return nil if
the "./" entry hasn't appeared yet.
* test/lisp/vc/vc-tests/vc-test-misc.el
(vc-test-vc-dir-next/previous): Simulate the problem case.
* lisp/emacs-lisp/ewoc.el (ewoc-goto-next): Signal a user-error
instead of a plain error. This makes sense for all the current
call sites. (This is secondary to the bug fix above: this code
was never reached, previously.)
Recently, xref gained the xref-find-by-kind API, and Eglot gained
support for that. This commit restructures Eglot's side: any
non-definition LSP reference-like (generic references, declaration,
implementation, and typeDefinition) can now be requested for any
arbitrary symbol, even if point is not on that symbol (of course as long
as the server supports the 'workspace/symbol' method).
This historically hairy code is made somewhat simpler and should agree
with users' expectations of commands like C-u M-?.
However, there is still a wrinkle: some servers (clangd, ty, but not
rust-analyzer) need the document where the canonical definition site
lives to have been explicitly 'didOpen'ed by the client. And we need
the canonical definition site to request references for an arbitrary
symbol, because LSP itself barely knows about "symbols", i.e. they are
not first-class entities. LSP only knows document locations.
The previous approach by Dmitry Gutov's did the heroics: it visited the
URI transiently, just to place point on the definition and then request
the special kind of reference. This worked, but (1) is only needed if
the URI isn't already visited (2) is somewhat hacky and risks things
like surpsising confirmation prompts and user hooks.
Perhaps this wrinkle can be addressed later with a lighter weight
version of a 'didOpen'-sending helper. For now, we take the simpler
approach: craft the request directly from the information we got from
'workspace/symbol', even if that info points to unmanaged LSP documents.
If the server complains, so be it. Users should at least be able to
read the message and visit the file themselves.
For reference, Clangd's behavior is seen a server bug, according to
https://discourse.llvm.org/t/clangd-explicit-and-implicit-doc-open/205/2
and https://github.com/microsoft/language-server-protocol/issues/861.
* lisp/progmodes/eglot.el (eglot--lsp-xrefs-for-id): New function.
(eglot--lsp-xrefs-for-method, eglot--lsp-xref-helper): Delete,
folding into eglot--lsp-xrefs-for-id.
(eglot--lsp-xref-refs): Delete variable.
(xref-backend-identifier-at-point): Return symbol at point.
(xref-backend-definitions, xref-backend-references)
(xref-backend-xrefs-by-kind): Use new helper.
(xref-backend-xref-kinds): Rewrite.
(eglot--deffinder): New helper
(eglot-find-declaration, eglot-find-implementation)
(eglot-find-typeDefinition): Rewrite using eglot--deffinder.
Do not assume that diff has the -a option, as POSIX does not
require it. Problem found on Solaris 10 (bug#81480).
* test/lisp/vc/diff-mode-tests.el (diff-mode-test-font-lock)
(diff-mode-test-font-lock-syntax-one-line)
(diff-mode-test-git-patch)
(diff-mode-test-git-patch/before-first-hunk)
(diff-mode-test-git-patch/signature):
Skip unless "diff -a" works.
grep.el assumes support for grep -E, which is universal among
Emacs platforms except for Solaris /usr/bin/grep. So, on Solaris
substitute a grep that supports -E, if available in one of the
standard Solaris locations. In the usual case where one is
available, this fixes Bug#81483.
* lisp/progmodes/grep.el (grep-compute-defaults):
On Solaris, prefer /usr/sfw/bin/grep or /usr/xpg4/bin/grep to
plain grep if plain grep lacks support for -E.
* test/lisp/net/nsm-tests.el (nsm-check-local-subnet-ipv4):
Don’t test the nsm-trust-local-network case when
network-interface-list reports no network interfaces.
On Solaris 10, network-interface-list always returns nil because
Solaris 10 lacks getifaddrs, and it’s not worth our trouble to
port network-interface-list to the hacky way this obsolescent OS
reports network interfaces (bug#81473).
* test/lisp/tab-bar-tests.el (tab-bar-tests-quit-restore-window):
Test tty-type "linux" only on gnu/linux, as it may not exist
on other platforms, e.g., Solaris (bug#81477).
Problem reported by Paul Eggert (Bug#81484).
* test/lisp/cedet/semantic/bovine/gcc-tests.el (semantic-gcc-test):
Do not assume GCC is version 4 or later.
(semantic-gcc-test/1, semantic-gcc-test/6): Update GCC version number.
* test/src/regex-emacs-tests.el (regex-tests-generic-line):
Read the test file in utf-8-unix.
This indicates that the current completion field is complete when the
string is, e.g. "--option=". The option value is a subsequent field and
is handled by other parts of Pcomplete (bug#81792).
* lisp/pcomplete.el (pcomplete-long-option-completion-table): Set
boundary for completed options that take values.
* test/lisp/pcomplete-tests.el (pcomplete-shell-completion): Convert to
macro and accept BODY arguments.
(pcomplete-test-long-options/with-value/multiple)
(pcomplete-test-long-options/without-value/multiple): New tests.
These files are not included in Emacs distributions so this will
only affect those who, e.g., symlink these into ~/.emacs.d/user-lisp/.
* admin/admin.el:
* admin/authors.el: Autoload all commands.
* admin/gitmerge.el (gitmerge): Autoload.
* lisp/startup.el (prepare-user-lisp): Ignore dangling symlinks.
Restructure to reduce number of system calls made for everything
except dangling symlinks.
* lisp/international/latexenc.el
(latexenc-find-file-coding-system): Decode the main file's name,
since at this point the buffer is still unibyte and undecoded.
(Bug#81606)
* etc/themes/newcomers-presets-theme.el (newcomers-presets): Set
set-mark-command-repeat-pop, kill-do-not-save-duplicates,
help-window-select and window-combination-resize.