dannyfreeman [Fri, 9 Dec 2022 12:49:26 +0000 (12:49 +0000)]
Eglot: Handle LSP progress with Emacs progress reporters (bug#59149)
Co-authored-by: João Távora <joaotavora@gmail.com>
* lisp/progmodes/eglot.el (eglot-report-progress): New custom variable.
(eglot-lsp-server): New slot for tracking active progress reporters.
(eglot-handle-notification (eql $/progress)): New method.
The LSP spec describes methods for reporting progress on long running
jobs to the client:
This change reports those notifications in the minibuffer as they come
in. It shows a percent indicator (if the server provides theme), or a
spinner.
This change could open the door for writing a "cancel long running
request" command, which are identified by these progress
notifications. See
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#window_workDoneProgress_cancel
* doc/misc/eglot.texi (Customizing Eglot): Describe new variable.
Stefan Kangas [Sun, 27 Nov 2022 17:37:37 +0000 (18:37 +0100)]
New script admin/check-man-pages
* admin/check-man-pages: New file with script used to check man pages
for errors. (Bug#59631)
* admin/make-tarball.txt: Document when to use the above script.
Stefan Kangas [Fri, 9 Dec 2022 05:27:33 +0000 (06:27 +0100)]
Improve :delight keyword example in use-package manual
* use-package.texi (Diminish, Delight): Clarify what happens if the
pre-requisite packages are not installed. Change an example with
performance issues to one without any.
Po Lu [Fri, 9 Dec 2022 01:25:42 +0000 (09:25 +0800)]
Revert "; * src/emacs.c (main): Improvements to last change."
This reverts commit c774e83e36784ab96539c5c083b3bcb6d0158a8c. It
causes crashes on GNU/Linux systems using libgmp, as there a shared
library initializer is used to set the malloc functions on startup, so
they are not dumped.
Sean Whitton [Thu, 8 Dec 2022 23:29:44 +0000 (16:29 -0700)]
server-eval-at: Don't call server--file-name
* lisp/server.el (server-eval-at): Revert to old code for determining
the server file. The recent change to call server--file-name meant
that the SERVER argument to server-eval-at was ignored.
Stefan Kangas [Thu, 8 Dec 2022 23:18:49 +0000 (00:18 +0100)]
; Don't say to require bind-key in use-package manual
* doc/misc/use-package.texi (Getting Started): Remove instruction to
require 'bind-key'; it is already required by 'use-package' and the
entry points are autoloaded.
Remove unneeded (require 'edebug) from which-func.el
* lisp/progmodes/which-func.el: Don't require edebug. This is
code from an attempted fix to bug#49592, installed in 55cc8b040b
(2022-08-08) and left behind after 48b0f2606b (2022-08-23).
Jim Porter [Sat, 26 Nov 2022 19:52:18 +0000 (11:52 -0800)]
Treat escaped newlines in Eshell as the empty string
This fixes a regression introduced during Emacs 29's development.
* lisp/eshell/esh-arg.el (eshell-parse-argument): Handle
'eshell-empty-token' as the result of an argument-parsing hook.
(eshell-parse-argument-hook): Document 'eshell-empty-token'.
(eshell-parse-backslash): Return 'eshell-empty-token' when
encountering an escaped newline.
* test/lisp/eshell/eshell-tests.el (eshell-test/escape-nonspecial)
(eshell-test/escape-nonspecial-unicode)
(eshell-test/escape-nonspecial-quoted)
(eshell-test/escape-special-quoted): Move from here...
* test/lisp/eshell/esh-arg-tests.el (esh-arg-test/escape/nonspecial)
(esh-arg-test/escape/nonspecial-unicode)
(esh-arg-test/escape-quoted/nonspecial)
(esh-arg-test/escape-quoted/special): ... to here.
(esh-arg-test/escape/special, esh-arg-test/escape/newline)
(esh-arg-test/escape-quoted/newline): New tests.
* doc/misc/eshell.texi (Arguments): Explain escaping logic in more
detail (bug#59622).
When adapting the 'c-populate-syntax-table' for tree-sitter, I misread
the code, and thus some crucial entries were missing. For the
relevant modes we use the same table as specified in the
non-tree-sitter major mode.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--syntax-table): Add new
entries.
* lisp/progmodes/csharp-mode.el (csharp-ts-mode): Add new entries.
* lisp/progmodes/java-ts-mode.el (java-ts-mode--syntax-table): Add new
entries.
* lisp/progmodes/json-ts-mode.el (json-ts-mode--syntax-table): Add new
entries.
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--syntax-table): Add new entries.
* lisp/textmodes/css-mode.el (css-ts-mode): Add new entries.
Yuan Fu [Wed, 7 Dec 2022 03:56:25 +0000 (19:56 -0800)]
Improve parameter checking in tree-sitter functions
* src/treesit.c (treesit_check_position): Extract out new function.
(Ftreesit_node_first_child_for_pos)
(Ftreesit_node_descendant_for_range): Replace code with the new
function.
(Ftreesit_query_capture): Add missing check for node and parser. Add
check for range for BEG and END. Move treesit_initialize to the
beginning of the function.
* test/src/treesit-tests.el (treesit-node-api)
(treesit-query-api): Add tests for out-of-range error.
Eli Zaretskii [Wed, 7 Dec 2022 19:23:42 +0000 (21:23 +0200)]
Fix comint-tests on MS-Windows
* test/lisp/comint-tests.el (comint-tests/test-password-function):
On MS-Windows, call 'w32-native-executable-find' instead of
'executable-find', to find the native version of the 'cat'
program.
(w32-native-executable-p, w32-native-executable-find): New
functions.
João Távora [Wed, 7 Dec 2022 10:59:30 +0000 (10:59 +0000)]
Use new external-completion.el in Eglot
This refactor simplifies Eglot's source code.
* lisp/progmodes/eglot.el:
(Package-Requires): Require external-completion.
(external-completion): Require it.
(xref-backend-identifier-completion-table): Use external-completion-table.
(completion-category-overrides): No longer set it.
("Backend Completion"): Delete section.
João Távora [Wed, 7 Dec 2022 10:43:59 +0000 (10:43 +0000)]
Don't override completion-category-defaults in fido-mode
To more closely emulate ido-mode, fido-mode and fido-vertical-mode
strongly lean to the 'flex completion style. But overriding
completion-category-defaults is not the correct way to do it, since
sometimes even the 'flex style isn't possible.
* lisp/icomplete.el (icomplete--fido-mode-setup): Don't set
completion-category-defaults here.
João Távora [Fri, 25 Nov 2022 13:03:45 +0000 (13:03 +0000)]
Add lisp/external-completion.el for completions from external tools
This table uses a new 'external' completion style which has been in
use in Eglot and other third-party extensions for a long time. It's
meant for libraries that interface with an external tool which
provides completions, such as a shell utility, an inferior process, an
http server.
The new file lisp/external-completion.el provides a helper function,
external-completion-table which is given an interfacing function to
the external tool and returns a "programmed completion" table that is
bound to the 'external' completion style. That table can then be used
with completing-read or any other facility expecting a completion
table.
When the 'external' is in use, the usual styles configured by the user
or other in 'completion-styles' are completely overriden. This
relatively minor inconvenience is the price to pay for responsive
completion where the full set of completion candidates doesn't need to
be transfered into Emacs's address space.
* lisp/external-completion.el: New file.
* etc/NEWS: (Lisp Changes in Emacs 29.1): Mention
external-completion-table.
João Távora [Wed, 7 Dec 2022 11:30:34 +0000 (11:30 +0000)]
Eglot: fix setting of flymake-list-only-diagnostics (bug#59824)
When Eglot receives diagnostics for a file not yet visited in Emacs,
it stores them in flymake-list-only-diagnostics, which feed M-x
flymake-show-project-diagnostics. If the file is eventually visited
in a buffer and Eglot starts receibing diagnostics for it, the
flymake-list-only-diagnostics database has to be updated accordingly,
since the previous diagnostics are now stale.
(we removed those files in an earlier commit, because they are not
used anymore.)
Now it also more parameterized and builds typescript and tsx
separately.
* admin/notes/tree-sitter/build-module/build.sh (topdir)
(repo, sourcedir, grammardir): New variables.
(Build): Make it parametric.
(Copy out): Use absolute path.
Yuan Fu [Tue, 6 Dec 2022 08:15:30 +0000 (00:15 -0800)]
Fontify some keywords in type face in c-ts-mode
* lisp/progmodes/c-ts-mode.el (c-ts-mode--keywords): Remove some keywords.
(c-ts-mode--type-keywords): New variables.
(c-ts-mode--font-lock-settings): New rule.
* src/lread.c (read_bool_vector, skip_lazy_string):
Replace `|` with `||` to explicitly introduce sequence points since
the variables, `length` and `nskip`, are mutated more than once.
The `|` was just a weak attempt at micro-optimisation in any case;
sorry about that.
Yuan Fu [Tue, 6 Dec 2022 02:37:47 +0000 (18:37 -0800)]
Fix treesit-query-capture
Before this change Ftreesit_query_capture doesn't convert character
position to byte position for BEG and END parameters. I observed
fontification issue in css files but couldn't figure out why, now I
know :-)
I decide to keep treesit--font-lock-query-expand-range, since it might
provide a escape hatch for problems we discover in the future, and it
should be very cheap so no downside of keeping it.
* lisp/textmodes/css-mode.el (css-ts-mode): Stop setting
treesit--font-lock-query-expand-range.
* lisp/treesit.el (treesit--font-lock-query-expand-range): Update
docstring.
* src/treesit.c (Ftreesit_query_capture): Convert BEG and END to byte
position. Also added parentheses wround "beg_byte - visible_beg" in
the call to ts_query_cursor_set_byte_range (i.e., style change).
Improve fontification of typescript-ts-mode (bug#59831)
- Highlight property and field definitions in class declaration.
- Highlight property-keys in object initializaters.
- Highlight variable-names in function/method return-statements.
Add back pair feature in json-ts-mode fontification (bug#59833)
* lisp/progmodes/json-ts-mode.el (json-ts-mode--font-lock-settings):
Add back in removed pair feature. Also alphabetize features.
(json-ts-mode): Use the new feature.
Eli Zaretskii [Mon, 5 Dec 2022 19:45:01 +0000 (21:45 +0200)]
; Clarify description of display on the margins
* doc/lispref/display.texi (Display Margins): More accurate
explanation of how to show text in the display margin without
concealing buffer text. (Bug#59841)
Yuan Fu [Sun, 4 Dec 2022 08:22:28 +0000 (00:22 -0800)]
Improve treesit-fontify-with-override
This also fixes fontification problem with c-ts-mode--fontify-defun.
Now treesit-fontify-with-override clips the fontification region for
the user, so no need for (max start node-start) shenanigans anymore.
More importantly it doesn't fontify unless the region between
node-start and node-end intersects with the region between start and
end, which fixes the problem with c-ts-mode--fontify-defun.
* lisp/treesit.el (treesit-fontify-with-override): Add optional
parameter BOUND-START and BOUND-END. Wrap the function body in a
when-form.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--fontify-declarator)
(c-ts-mode--fontify-variable)
(c-ts-mode--fontify-defun)
(c-ts-fontify-error)
* lisp/progmodes/js.el (js--fontify-template-string)
* lisp/progmodes/python.el (python--treesit-fontify-string): Use the
new signature.
Jim Porter [Fri, 2 Dec 2022 20:14:50 +0000 (12:14 -0800)]
Make killing a non-last client work the same no matter the auto-stop setting
Previously, if 'server-stop-automatically' was configured for
'kill-terminal' or 'delete-frame', killing a client via
'save-buffers-kill-terminal' wouldn't prompt about the saving files in
the client's buffer list (as it does when not using those settings).
This change ensures that those settings only apply when killing the
last client, as described in the manual (bug#51993).
* lisp/server.el (server-save-buffers-kill-terminal): Handle
'server-stop-automatically' behavior in this function, rather than
calling 'server-stop-automatically--handle-delete-frame'.
Juri Linkov [Sun, 4 Dec 2022 19:30:34 +0000 (21:30 +0200)]
Use the function 'window-system' on the tab-bar/tab-line (bug#59620)
* lisp/tab-bar.el (tab-bar-separator)
(tab-bar-format-align-right, tab-bar-auto-width):
* lisp/tab-line.el (tab-line-format-template): Replace the variable
'window-system' with the function call '(window-system)'.
Tom Gillespie [Sun, 4 Dec 2022 06:41:15 +0000 (22:41 -0800)]
Restore font-lock-type-face for lisp mode &symbols
* lisp/emacs-lisp/lisp-mode.el (lisp-cl-font-lock-keywords-2)
(lisp-el-font-lock-keywords-2): Restore use of type face instead of
builtin face for &symbol keywords. This fixes what appears to be
a copy paste error that changed the face for common lisp and emacs
lisp &symbol style keywords that was introduced in commit a498e5f83 by restoring the type face to font-lock-type-face as
consistent with the comments.
Kai Ma [Sat, 3 Dec 2022 10:17:26 +0000 (18:17 +0800)]
Prevent a segfault when deleting a fullscreen frame on NextStep.
* nsterm.m ([EmacsView resetCursorRects:]): Be defensive when
accessing FRAME_OUTPUT_DATA. [resetCursorRects:] can be called
from the event loop after the frame is deleted. When this
happens, emacsframe is NULL. This means there is an underlying
leak of the EmacsView object! (Bug#59794)
Do not merge to master.
Speed up Unicode normalisation tests by a factor of 5
After this change, ucs-normalize-tests are still very slow but
somewhat less disastrously so (from 100 to 20 min on this machine).
* test/lisp/international/ucs-normalize-tests.el
(ucs-normalize-tests--normalization-equal-p)
(ucs-normalize-tests--normalization-chareq-p)
(ucs-normalize-tests--rule1-holds-p)
(ucs-normalize-tests--rule2-holds-p)
(ucs-normalize-tests--part1-rule2):
Run only over the Unicode code space.
Hoist `with-current-buffer` to reduce overhead.
Fix and expand tests broken by commit 2772ebe366 of 2022-11-28
* test/lisp/emacs-lisp/comp-tests.el
(with-test-native-compile-prune-cache)
(test-native-compile-prune-cache)
(test-native-compile-prune-cache/delete-only-eln)
(test-native-compile-prune-cache/dont-delete-in-parent-of-cache):
Check that the last directory in `native-comp-eln-load-path' is
not affected by `native-compile-prune-cache'.
Eli Zaretskii [Sat, 3 Dec 2022 10:21:00 +0000 (12:21 +0200)]
Fix handling of relative directories in "--init-directory=DIR"
* lisp/startup.el (command-line): Interpret non-absolute file
names in '--init-directory' relative to the directory from
which Emacs is started. (Bug#59795)
Eli Zaretskii [Sat, 3 Dec 2022 09:32:00 +0000 (11:32 +0200)]
Fix gud-minor-mode-menu
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode)
(easy-mmode-define-keymap): Don't declare obsolete, since we are
still using it in gud.el. (Bug#59769) (Bug#59605)
Do not merge to master.
Eli Zaretskii [Sat, 3 Dec 2022 09:16:41 +0000 (11:16 +0200)]
Revert "Make easy-mmode-defmap obsolete and adjust only caller"
This reverts commit 8bb5c1bfec0929f2ba419e1c503f5acc01c336c2.
That commit lost too many useful features in the GUD menus
and caused several bugs, the last of them bug#59769.
* test/lisp/server-tests.el (server-tests/can-create-frames-p):
Don't attempt to create frames if TERM=dumb, which what we have
if run from M-x compile (for instance).
(server-tests/server-force-stop/keeps-frames): Delete created frame so
that it doesn't cause trouble for other tests.
Yikai Zhao [Tue, 29 Nov 2022 14:30:14 +0000 (22:30 +0800)]
Speed up auto-completion in 'sh-script-mode'
* lisp/progmodes/sh-script.el (sh--cmd-completion-table-gen): New
function, replacement for 'sh--cmd-completion-table'.
(sh--cmd-completion-table): Function removed.
(sh-completion-at-point-function): Use
'sh--cmd-completion-table-gen'. (Bug#59678)