Yuan Fu [Fri, 24 Mar 2023 19:19:25 +0000 (12:19 -0700)]
Handle signals gracefully in tree-sitter query predicates
Before this change, predicate functions can signal, which will cause
Ftreesit_query_capture to skip freeing the query and cursor object.
We make predicate functions return the signal data rather than
directly signal.
* src/treesit.c (treesit_predicate_capture_name_to_node)
(treesit_predicate_capture_name_to_text)
(treesit_predicate_equal)
(treesit_predicate_match)
(treesit_predicate_pred)
(treesit_eval_predicates): Return signal rather than signaling
directly.
(Ftreesit_query_capture): Check for returned signal data.
Yuan Fu [Tue, 21 Mar 2023 23:03:08 +0000 (16:03 -0700)]
Refactor Ftreesit_query_capture
Refactor some part of Ftreesit_query_capture out into separate
functions, to pave the way for other query-based functions.
* src/treesit.c (treesit_resolve_node): New function.
(treesit_initialize_query): New function.
(Ftreesit_query_capture): Refactor some part into new functions.
João Távora [Fri, 24 Mar 2023 14:34:05 +0000 (14:34 +0000)]
Eldoc: fix bug recently introduced in "old" protocol
In the "old" protocol, eldoc-documentation-strategy is actually used
as the deprecated eldoc-documentation-function and it is itself the
"origin" of the doc snippet to be displayed.
João Távora [Thu, 23 Mar 2023 17:34:46 +0000 (17:34 +0000)]
Eglot: don't send invisible text to Eldoc
Eglot's rendering of Markdown is imperfect and based on gfm-view-mode.
To make it slightly better, don't send invisible text in
eglot-hover-eldoc-function.
João Távora [Thu, 23 Mar 2023 09:02:18 +0000 (09:02 +0000)]
ElDoc: rework rendering of echo area (bug#62029)
Previously, the display function 'eldoc-display-in-echo-area' reused
the same buffer as 'eldoc-display-in-doc-buffer', but that made it
harder to render documentation items differently depending on the
specific constraints of each display functions.
Allow documentation-generating backends to pass an :echo-area property
for tweaking the echo area display of certain documentation items.
* lisp/emacs-lisp/eldoc.el (eldoc-documentation-functions): Update docstring.
(eldoc--doc-buffer-docs): Remove.
(eldoc--format-doc-buffer): Simplify.
(eldoc--echo-area-render): New helper.
(eldoc-display-in-echo-area): Use 'eldoc--echo-area-render'.
João Távora [Wed, 22 Mar 2023 13:35:43 +0000 (13:35 +0000)]
ElDoc: remember origin backend in doc snippets (bug#62029)
This lays groundwork for discriminating between different
documentation providers in ElDoc display outlets, i.e. members
of eldoc-display-functions
* lisp/emacs-lisp/eldoc.el (eldoc--make-callback): Take extra origin arg.
(eldoc-documentation-compose-1)
(eldoc-documentation-compose-eagerly)
(eldoc-documentation-default): Pass extra arg to eglot--make-callback.
(eldoc--invoke-strategy): Rework.
(eldoc-documentation-functions): Work docstring.
Stefan Kangas [Thu, 23 Mar 2023 05:30:13 +0000 (06:30 +0100)]
Merge from origin/emacs-29
6de00e4df99 ; Fix xref-match's :version since the default value did c... db355b420b6 Use libgccjit-10-dev on EMBA 84963956535 * lisp/outline.el (outline--fix-buttons-after-change): Ad... 3d3bbaace69 Align concatenated strings to the first sibling in c-ts-mode f856468e457 Only fill the current paragraph in c-ts-common--fill-bloc... df669c5a11f Add missing indent rule for c-ts-mode
Felician Nemeth [Wed, 22 Mar 2023 18:34:03 +0000 (18:34 +0000)]
Subject: send clientInfo during the initialize request
'clientInfo' arrived in LSP 3.15.0. LSP clients can use clientInfo to
identify themselves in the initialize request. This is generally
useful for various debugging tasks.
Robert Pluim [Wed, 22 Mar 2023 11:46:11 +0000 (12:46 +0100)]
Make eglot--clangd-version more robust
* test/lisp/progmodes/eglot-tests.el (eglot--clangd-version): Check
for 'version ' followed by a combination of numbers and dots to
extract the clangd version.
It's important for a hook in after-change-functions not to change match-data.
Otherwise it breaks functions that make changes in the buffer, such as
for example, successive calls to delete-region in smerge-keep-n, etc.
Paul Eggert [Tue, 21 Mar 2023 21:38:23 +0000 (14:38 -0700)]
Sleep less in update-game-score
This is mostly to avoid interface hassles with time/srand/rand.
* lib-src/update-game-score.c (main): Don’t use ‘srand’ or ‘time’.
(lock_file): Don’t sleep if we unlocked the lock file. When
sleeping, always just sleep 1 s. This avoids the need for calling
‘time’ and ‘rand’, the utility of which was dubious anyway.
Paul Eggert [Tue, 21 Mar 2023 21:06:27 +0000 (14:06 -0700)]
Avoid backwards clock in movemail timestamps
* lib-src/movemail.c (mbx_delimit_begin): Use ‘current_timespec’
instead of ‘time’ to generate the user-visible timestamp.
This works around the minor glitch caused by glibc bug 30200
<https://sourceware.org/bugzilla/show_bug.cgi?id=30200>.
João Távora [Tue, 21 Mar 2023 09:56:30 +0000 (09:56 +0000)]
Eglot: report window/workDoneProgress capability to language server
In bug#59149, LSP progress reporting was implemented, but Eglot's
'capabilities' statement to the server wasn't changed to include
window/workDoneProgress.
Andrea Corallo [Mon, 20 Mar 2023 16:24:48 +0000 (17:24 +0100)]
Comp fix calls to redefined primtives with op-bytecode (bug#61917)
* lisp/emacs-lisp/comp.el (comp-emit-set-call-subr): Fix compilation
of calls to redefined primtives with dedicated op-bytecode.
* test/src/comp-tests.el (61917-1): New test.
Stefan Kangas [Mon, 20 Mar 2023 05:30:32 +0000 (06:30 +0100)]
Merge from origin/emacs-29
ea87c54f359 ; * lisp/subr.el (setq-local): Add missing period (bug#62... 90362f87d58 ; Correct last commit, downcase node reference 38067f05b92 Enhance section about troubleshooting in Eglot manual. 6f82596b490 Fix Eglot's snippet insertion to follow the manual c54bda15e35 Reset abbrevs-changed after saving abbrevs (bug#62208) e8cee15f780 ; Fix markup in previous change e4a7d0cd6ea Document `keymap-unset' in lispref bb3e0ded9eb Don't add a key binding when REMOVE is non-nil a4a9ffdd80a Fix the documentation of various aspects of adding Xref h... a2222b9a9bf ; Minor wording fix in ELisp reference manual 5cf1de683b2 Fix python-fill-paragraph problems on filling strings (bu... 7385c991dff Also exempt eglot-inlay-hints-mode from desktop.el's fumb... 1961bdb52ed ; Add WebDAV entry to index in Tramp manual dfb36d36230 Refer to EWW instead of w3 and w3m 9d3fdf7e0d4 Fix Eglot's command generation for code actions
Stefan Kangas [Mon, 20 Mar 2023 05:30:30 +0000 (06:30 +0100)]
Merge from origin/emacs-29
028f1102738 Fix quoting of font-family in 'hfy-family' 4cb8a850b08 ; Tweak doc/misc/eglot.texi d5d4959ed7d Document how to construct JSONRPC arrays in Eglot manual 078cf512eef * test/infra/Dockerfile.emba: Use debian:bullseye. 61adb44318a * configure.ac: Fix native comp compatibility check (bug#... d814c249f44 * test/infra/Dockerfile.emba: Install clangd. 27edd7f88cb Remove 'package-vc--query-spec' 39fea115515 Do not store :lisp-dir in package descriptors 168165178f3 Use 'package-vc-selected-packages' to store package specs
João Távora [Sun, 19 Mar 2023 00:47:55 +0000 (00:47 +0000)]
Improve ergonomics of Eglot's inlay hints
Instead of deleting inlay hints instantly as soon as the affected
changes, make hint overlays span one character (instead of being
length 0). Give the overlays an "evaporate" property.
Given an inlay hints at position POS, its attached to [POS, POS+1] if
it's kind=1 (usually type hints) and [POS-1, POS] otherwise. For
kind=1 hints, the 'cursor position of the first such overlay is also
tweaked, so that's it's less akward to edit around it.
Michael Albinus [Sun, 19 Mar 2023 12:11:06 +0000 (13:11 +0100)]
Rename tramp-use-ssh-controlmaster-options to tramp-use-connection-share
* doc/misc/tramp.texi (Ssh setup): Use tramp-use-connection-share.
Describe its settings for PuTTY.
(Remote processes): Use tramp-use-connection-share.
* etc/NEWS: Renamed user option tramp-use-connection-share.
* lisp/net/tramp-integration.el
(tramp-compile-disable-ssh-controlmaster-options):
Use `tramp-use-connection-share'.
* lisp/net/tramp-sh.el (tramp-use-connection-share):
Rename from `tramp-use-ssh-controlmaster-options'. Make it a
defvaralias to `tramp-use-ssh-controlmaster-options'.
(tramp-ssh-controlmaster-options): Adapt docstring.
(tramp-methods) <plink, plinkx, pscp, psftp>: Adapt.
(tramp-ssh-controlmaster-options): Add plink implementation.
Jim Porter [Sun, 12 Mar 2023 07:53:34 +0000 (23:53 -0800)]
Don't over-normalize file names starting with "~" in Eshell
Previously, this would call 'expand-file-name' on the file name, but
that normalizes the value, turning something like "~/." into
"/home/user". As a result, Pcomplete didn't work for dotfiles after
"~/" (bug#28064).
* lisp/eshell/em-dirs.el (eshell-expand-user-reference): New
function...
(eshell-expand-user-reference): ... use it.
João Távora [Fri, 17 Mar 2023 22:37:27 +0000 (22:37 +0000)]
Don't take over mouse-1 binding on Eglot diagnostics (bug#62157)
It's better to give the user a variable to allow the overlay keymap to
be customized.
* lisp/progmodes/eglot.el (eglot--mouse-call): Accept second arg.
(eglot--mode-line-props): Adapt call to eglot--mouse-call
(eglot-diagnostics-map): New variable.
(eglot-code-actions-at-mouse): New command.
Gregory Heytings [Sat, 18 Mar 2023 10:49:29 +0000 (10:49 +0000)]
Avoid slowdowns in xmltok-scan-attributes
* lisp/nxml/xmltok.el (xmltok-scan-attributes): Limit the search
to 10000 characters, to avoid slowdowns due to the quadratic
complexity of the regexp. Suggested by Stefan Monnier.
Alan Mackenzie [Sat, 18 Mar 2023 10:12:24 +0000 (10:12 +0000)]
CC Mode: Eliminate duplicate function c-list-of-strings
Replace it with the existing c-string-list-p. Also put an autoload cookie in
front of c-string-list-p so that it will not be signalled as undefined by
loaddefs.el.
lisp/progmodes/cc-vars.el (c-string-list-p): Make this autoload.
(c-list-of-strings): Remove.
(c-font-lock-extra-types, c++-font-lock-extra-types)
(objc-font-lock-extra-types, java-font-lock-extra-types)
(idl-font-lock-extra-types, pike-font-lock-extra-types): In the autoload
cookies, replace c-list-of-strings with c-string-list-p.
Alan Mackenzie [Mon, 13 Mar 2023 16:42:02 +0000 (16:42 +0000)]
CC Mode: Allow lists of strings as safe values for *-font-lock-extra-types
* lisp/progmodes/cc-vars.el (c-list-of-strings): New function.
(c-font-lock-extra-types, c++-font-lock-extra-types)
(objc-font-lock-extra-types, java-font-lock-extra-types)
(idl-font-lock-extra-types, pike-font-lock-extra-types): Add a :safe entry
into each of thes defcustoms for c-list-of-string.
(Top level): Add an autoload entry for each of the above.
Alan Mackenzie [Sat, 18 Mar 2023 10:12:24 +0000 (10:12 +0000)]
CC Mode: Eliminate duplicate function c-list-of-strings
Replace it with the existing c-string-list-p. Also put an autoload cookie in
front of c-string-list-p so that it will not be signalled as undefined by
loaddefs.el.
lisp/progmodes/cc-vars.el (c-string-list-p): Make this autoload.
(c-list-of-strings): Remove.
(c-font-lock-extra-types, c++-font-lock-extra-types)
(objc-font-lock-extra-types, java-font-lock-extra-types)
(idl-font-lock-extra-types, pike-font-lock-extra-types): In the autoload
cookies, replace c-list-of-strings with c-string-list-p.
Manuel Giraud [Fri, 10 Mar 2023 20:54:00 +0000 (21:54 +0100)]
Fix 'find-ls-option-default-ls' for BSD/MacOS (bug#62096)
* lisp/find-dired.el (find-gnu-find-p): New variable to determine
if "find" is a GNU find.
(find-ls-option-default-ls): Use 'find-gnu-find-p' and adapt to a
value that works with the default "find" on *BSD and Darwin/MacOS.
Tested on OpenBSD and MacOS.
Manuel Giraud [Fri, 10 Mar 2023 20:54:00 +0000 (21:54 +0100)]
Fix 'find-ls-option-default-ls' for BSD/MacOS (bug#62096)
* lisp/find-dired.el (find-ls-option-default-ls): Adapt to
a value that works with the default "find" on *BSD and
Darwin/MacOS. Tested on OpenBSD and MacOS. Do not merge
to master.