João Távora [Thu, 27 Apr 2023 19:51:07 +0000 (20:51 +0100)]
Eglot: fix edge case when deleting inlay hint overlays
When asked to update hints in a region (FROM TO),
eglot--update-hints-1 first deletes the existing hints. It must
however take care to delete all overlays that logically belong to the
region, even if they don't physically belong to it, e.g. inlay
overlays spanning (FROM-1 FROM) and having a 'after-string' property.
Rename all functions called package-*-update-* to package-*-upgrade-*
* lisp/emacs-lisp/package-vc.el (package-vc-upgrade-all):
Rename from 'package-vc-update-all'.
(package-vc-upgrade): Rename from 'package-vc-update'.
* lisp/emacs-lisp/package.el (package-upgrade):
Rename from 'package-update' (bug#62750).
(package--upgradeable-packages):
Rename from 'package--updateable-packages'.
(package-upgrade-all): Rename from 'package-update-all'.
Yuan Fu [Thu, 27 Apr 2023 03:09:42 +0000 (20:09 -0700)]
Fix FOR_EACH_TAIL in c-ts-mode (bug#62951)
* lisp/progmodes/c-ts-mode.el
(c-ts-mode--indent-styles): New indent rule.
(c-ts-mode--for-each-tail-regexp)
(c-ts-mode--for-each-tail-body-matcher)
(c-ts-mode--emacs-c-range-query)
(c-ts-mode--for-each-tail-ranges)
(c-ts-mode--reverse-ranges)
(c-ts-mode--emacs-set-ranges): New functions and variables.
(c-ts-mode): Create a emacs-c parser. More setup for Emacs source
support.
F. Jason Park [Fri, 21 Apr 2023 14:39:05 +0000 (07:39 -0700)]
Explain ERC 5.5 regressions in new version 5.5.0.29.1
* doc/misc/erc.texi: Bump version to 5.5.0.29.1.
* etc/ERC-NEWS: Don't hype bugged option `erc-reconnect-display'.
* lisp/erc/erc-dcc.el (erc-dcc-do-GET-command): Add comment explaining
parsing bug in ERC 5.5 (bug#62444).
* lisp/erc/erc-networks.el (erc-networks-on-MOTD-end): Mention known
/MOTD bug in error notice so people don't waste energy reporting
it (bug#62151).
* lisp/erc/erc.el: Change Version header to 5.5.0.29.1. Don't bother
updating the `customize-package-emacs-version-alist' entry
because no option defaults are affected.
(erc-version): Change version to 5.5.0.29.1.
(erc-reconnect-display, erc-query-on-unjoined-chan-privmsg): Add
warning to doc strings and `custom-set' functions. It's believed that
these bugs degrade the user experience significantly enough to warrant
such mentions (bug#62833).
(erc-query): Fix erroneous redirect string in deprecation spec.
Do not merge to master.
Yuan Fu [Mon, 24 Apr 2023 06:55:22 +0000 (23:55 -0700)]
Accept versioned tree-sitter language grammar files
By discussion on emacs-devel, titled "Versioned Tree-sitter parser
libraries".
* src/treesit.c (Vtreesit_str_dot_0): New variable.
(treesit_load_language_push_for_each_suffix): Additionally look for
lib_base_name.0 and lib_base_name.0.0.
(syms_of_treesit): Initialize Vtreesit_str_dot_0.
Benson Chu [Fri, 24 Mar 2023 20:38:03 +0000 (15:38 -0500)]
tab-bar-new-tab: inhibit side-window checks
Previously, calling 'tab-bar-new-tab-to' only removed the
'window-side' property on the currently selected window,
and then a call to 'delete-other-windows' was made to
ensure that the selected window was the only window.
We can skip this check by shadowing 'window--sides-inhibit-check'
to t.
* lisp/tab-bar.el (tab-bar-new-tab-to): Inhibit side-window checks.
(Bug#62427)
Eli Zaretskii [Sun, 23 Apr 2023 14:04:56 +0000 (17:04 +0300)]
Fix rendering of Traditional Mongolian script
* lisp/international/characters.el: Set punctuation syntax for Po
characters from the Mongolian block
* lisp/international/fontset.el (setup-default-fontset): Add
fontset setting for Traditional Mongolic.
* lisp/language/misc-lang.el (composition-function-table): Add
rules for Traditional Mongolic. (Bug#63028)
Eli Zaretskii [Sat, 22 Apr 2023 16:27:16 +0000 (19:27 +0300)]
Fix line-number-at-pos when POSITION is out of narrowing
* src/fns.c (Fline_number_at_pos): Don't signal an error when
ABSOLUTE is nil and POSITION is outside of the narrowing, like the
original Lisp implementation did. Minor speedup by using the byte
position where it is available from the get-go. (Bug#62857)
Eli Zaretskii [Sat, 22 Apr 2023 10:35:36 +0000 (13:35 +0300)]
Fix exiting Emacs after saving a tutorial
* lisp/tutorial.el (tutorial--starting-point): Make it
permanent-local, so that saving the tutorial to some file doesn't
kill this buffer-local variable. Otherwise, trying to exit Emacs
after saving the tutorial will signal an error, because
'tutorial--starting-point' is void. (Bug#37326)
Eli Zaretskii [Wed, 19 Apr 2023 17:46:40 +0000 (20:46 +0300)]
Fix display of menu-bar bindings of commands in *Help* buffers
* lisp/help-fns.el (help-fns--insert-menu-bindings): Propertize
with 'help-key-binding' face only the menu items, not the arrows
between successive items. This is because 'char-displayable-p' is
unreliable when we propertize the character with an arbitrary
face: that face could specify a font which doesn't support the
character after all, while 'char-displayable-p' assumes there are
no restrictions on fonts that can be used for displaying the
character. Also, make the code more efficient by avoiding the
call to 'char-displayable-p' inside the loop.
Improve Completion Example section in the Emacs manual
This can be a useful substitute for full-on fuzzy completion, as
provided by other completion styles and completion packages.
* doc/emacs/mini.texi (Completion Example): Give an example of
completion with point not at end of minibuffer. Also, use
@kbd{@key{TAB}} when telling the user to hit TAB. (Bug#62836)
xref-search-program-alist: Fix searching larger file lists on MS Windows
* lisp/progmodes/xref.el (xref-search-program-alist):
Add '-s 10000' to xargs' options when on Windows or DOS.
Apparently the xargs port doesn't currently know how to obey the
system-wide limits (https://debbugs.gnu.org/bug=61667#521).
Fix typo and inaccuracy in the ELisp Reference manual
* doc/lispref/loading.texi (Dynamic Modules): Fix a typo.
* doc/lispref/customize.texi (Group Definitions): Faces are also
in the 'custom-group' property of a customization group.
(Bug#62887)
Allow upgrading built-in packages with 'package-install'
* etc/NEWS: Mention the change
* lisp/emacs-lisp/package.el (package--upgradable-built-in-p): Add new
predicate.
(package-install-upgrade-built-in): Add new user option to enable
feature.
(package-install): Respect new user option.
Eli Zaretskii [Sun, 16 Apr 2023 08:12:39 +0000 (11:12 +0300)]
Minor changes in c-ts-mode.el's support of DEFUNs
* lisp/progmodes/c-ts-mode.el (c-ts-mode--fontify-DEFUN): Renamed
from 'c-ts-mode--fontify-defun'; all callers changed.
(c-ts-mode-emacs-sources-support): Renamed from
'c-ts-mode-emacs-devel' and made into a defcustom; all users
changed.
(c-ts-mode--emacs-defun-p, c-ts-mode--emacs-defun-at-point)
(c-ts-mode--emacs-current-defun-name): Doc fixes. (Bug#62825)
Add to Eglot support for additional language-servers.
* lisp/progmodes/eglot.el (eglot-server-programs): Add
'vscode-markdown-language-server' for Markdown and
'dot-language-server' for GraphViz. (Bug#62844)
Yuan Fu [Fri, 14 Apr 2023 19:52:46 +0000 (12:52 -0700)]
Partial support for DEFUN in c-ts-mode (bug#62825)
The DEFUN is hard to incorporate because it's made of two nodes rather
than one, and most tree-sitter functionalities assume a defun is one
node. I fixed the indent-defun and add-log functionality, but
beginning/end-of-defun and imenu still don't recognize DEFUN.
* lisp/progmodes/c-ts-mode.el (c-ts-mode-emacs-devel): New variable.
(c-ts-mode--defun-name): Support DEFUN.
(c-ts-mode--defun-valid-p): Support DEFUN.
(c-ts-mode--emacs-defun-p)
(c-ts-mode--emacs-defun-at-point): New functions.
(c-ts-mode-indent-defun): Use c-ts-mode--emacs-defun-at-point.
(c-ts-mode--emacs-current-defun-name): New function.
(c-ts-mode, c++-ts-mode): Optionally setup custom defun-name function.
Eli Zaretskii [Fri, 14 Apr 2023 06:21:05 +0000 (09:21 +0300)]
Fix style and unwinding code in treesit.c
This was supposed to be a cherry-pick from master, but
isn't, due to the unnecessary rush to fix master without
cleaning up the mess first and without separating changes
that can and cannot be backported.
* src/treesit.c (treesit_traverse_cleanup_cursor): Fix indentation
style.
(Ftreesit_search_subtree, Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Fix specpdl unwinding. (Bug#62823)
Do not merge to master.
Yuan Fu [Thu, 13 Apr 2023 21:36:46 +0000 (14:36 -0700)]
Catch signals produced by PRED in tree-sitter search functions
Earlier we switched to using cursors rather than nodes to traverse the
parse tree. Because cursors need cleanup, we have to catch signals
thrown by the predicate functions and free the cursor. Failing to do
this will result in leaking the cursor whenever the predicate function
signals in a search function. This change fixes the leak.
* src/treesit.c (treesit_traverse_cleanup_cursor): New function.
(Ftreesit_search_subtree)
(Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Catch signals. (Bug#62823)
Earl Hyatt [Tue, 28 Mar 2023 00:57:31 +0000 (20:57 -0400)]
Add more documentation for the keys of `package-vc-selected-packages`.
* doc/emacs/package.texi (Specifying Package Sources): List the
accepted keys in a new subsection of Fetching Package Sources.
* lisp/emacs-lisp/package-vc.el (package-vc-selected-packages):
Mention the `:doc` key. Add the `:doc` key to the Customize form,
mention the new Info node, correct "TexInfo" to "Texinfo", avoid
Git-specific terms for the description of `:branch`, mention guessing
`:vc-backend` based on the URL.
vc-checkout: Try to use the vc-dir's backend first
* lisp/vc/vc.el (vc-checkout): Try to use the vc-dir's backend
before looking for the file's one. The latter doesn't work when
the file doesn't exist on disk yet (bug#62674).
* doc/lispref/sequences.texi (Sequence Functions):
Remove inaccurate and over-specific claims about how `sort` works for
lists: there is no guarantee that it doesn't modify the `car` fields
of the input list (which is precisely what it does at this time).
Eli Zaretskii [Tue, 11 Apr 2023 07:33:32 +0000 (10:33 +0300)]
Fix wallpaper-tests on MS-Windows
* test/lisp/image/wallpaper-tests.el (wallpaper--find-setter)
(wallpaper--find-setter/call-predicate)
(wallpaper--find-setter/set-current-setter)
(wallpaper-set/calls-init-action)
(wallpaper-set/calls-wallpaper-set-function)
(wallpaper-set/runs-command, wallpaper-set/runs-command/detach):
Skip these tests if native functions are used for changing
wallpaper. These tests are irrelevant in that case.
* test/lisp/progmodes/eglot-tests.el
(eglot-test-rust-analyzer-watches-files): Bump timeout.
(eglot-test-json-basic): Check for yas-minor-mode before using it,
like other tests do (bug#61637).
Eli Zaretskii [Mon, 10 Apr 2023 13:09:58 +0000 (16:09 +0300)]
Fix visiting RPM files
We cannot call 'sh-set-shell' inside 'sh-base-mode', since various
settings of 'sh-mode', in particular the syntax table, is not yet
set. Likewise with various hooks: since 'sh-base-mode' is not a
mode any file should be visited with, it makes no sense to set up
stuff like 'hack-local-variables-hook' in 'sh-base-mode'; it
should be set in the descendant modes instead.
* lisp/progmodes/sh-script.el (sh-base-mode): Move the call to
'sh-set-shell' from here...
(sh-mode): ...to here...
(bash-ts-mode): ...with a copy here. (Bug#62748)
Fix some cases of incomplete code's indentation [c/c++-ts-mode]
* lisp/progmodes/c-ts-mode.el (c-ts-base--before-indent): Try to
guess when the parse tree is incomplete, and provide a better node
to indent against (bug#62717).
(c-ts-base-mode): Set up advice for local treesit-indent-function.
João Távora [Fri, 7 Apr 2023 13:55:01 +0000 (14:55 +0100)]
Backport: Eglot: no more tests based on Pylsp (bug#62694)
The functionality under test in eglot.el is exactly the same, but use
the clangd server only, as that is used in more tests, and it is much
easier to check if it misbehaves or not.
Tests pass with clangd version 15.
* test/lisp/progmodes/eglot-tests.el (python): Don't require it.
(eglot--call-with-fixture): Simplify.
(eglot--wait-for-clangd): New helper.
(eglot-test-basic-completions)
(eglot-test-non-unique-completions, eglot-test-basic-xref)
(eglot-test-snippet-completions)
(eglot-test-snippet-completions-with-company)
(eglot-test-eldoc-after-completions, eglot-test-multiline-eldoc):
Use clangd, not pylsp.
(eglot-test-formatting): Renamed from
eglot-test-python-autopep-formatting.
(eglot-test-python-yapf-formatting): Remove.
Eli Zaretskii [Sat, 8 Apr 2023 17:10:49 +0000 (20:10 +0300)]
Fix 'C-h k' for "Paste from Kill Menu" in context menus
* lisp/mouse.el (context-menu-region): Make the entries be
symbols, not just integers, to prevent "C-h c" from interpreting
them as character keys. (Bug#62626)
Eli Zaretskii [Sat, 8 Apr 2023 15:36:23 +0000 (18:36 +0300)]
Improve the documentation of the XDS support
* doc/lispref/frames.texi (Drag and Drop): Rephrase and rearrange
the documentation of XDS support. Add indexing. Document
'x-dnd-save-direct' and 'x-dnd-save-direct-immediately'. Original
patch from Po Lu <luangruo@yahoo.com>.
* lisp/x-dnd.el (x-dnd-types-alist, x-dnd-test-function)
(x-dnd-default-test-function, x-dnd-direct-save-function): Doc
fixes.
(x-dnd-save-direct, x-dnd-save-direct-immediately): Rename the
second argument to FILENAME. Doc fix.
Eli Zaretskii [Sat, 8 Apr 2023 13:00:29 +0000 (16:00 +0300)]
Allow reindentation of images inserted by 'mm-inline-image'
* lisp/gnus/mm-view.el (mm-inline-image): Use "x" as text on which
to put the image 'display' property, so that indentation commands
don't destroy the image inadvertently. (Bug#62637)
Daniel Martín [Sun, 2 Apr 2023 20:39:44 +0000 (22:39 +0200)]
Change cursor color on NS port when it matches the face background
* src/macfont.m (CG_SET_FILL_COLOR_WITH_FRAME_CURSOR): New macro.
(CG_SET_FILL_COLOR_WITH_FRAME_BACKGROUND): New macro.
(macfont_draw): When the cursor's color matches the face background,
set the fill color of the cursor to the face foreground.
* src/nsterm.m (ns_maybe_dumpglyphs_background): When dumping the
background of a glyph string, apply the logic mentioned
above. (Bug#62573)
Eli Zaretskii [Sat, 8 Apr 2023 11:33:06 +0000 (14:33 +0300)]
Improve documentation of image-related commands
* lisp/image.el (image-map): Make it inherit from
'image-slice-map' instead of repeating the bindings.
* doc/emacs/files.texi (Image Mode): Document the key bindings set
by 'insert-image'. Add indexing.
* doc/lispref/display.texi (Showing Images): Make the description
of user commands more concise. Add index entries and
cross-reference to the Emacs manual.
* etc/NEWS: Rearrange entries relevant to image commands.
Eli Zaretskii [Sat, 8 Apr 2023 09:43:34 +0000 (12:43 +0300)]
Fix handling of sliced images
* lisp/image.el (image-slice-map): New keymap, without some
bindings that make no sense with sliced images.
(insert-image, insert-sliced-image): Use it.
(insert-sliced-image): Make the 'keymap' property rear-nonsticky,
to prevent calling image commands when point is to the right of
the slice. (Bug#62679)
* lisp/image/image-crop.el (image-cut, image-crop): Doc fixes.
(image-crop): Don't try using stock MS-Widows convert.exe
program. Use 'image--get-image' to support sliced images.
Eli Zaretskii [Sat, 8 Apr 2023 07:41:53 +0000 (10:41 +0300)]
; Minor addition to the Emacs FAQ
* doc/misc/efaq.texi (Fullscreen mode on MS-Windows): Tell how to
avoid the initial screen changing size on display without using
the Registry. Suggested by David Hedlund <public@beloved.name>.
João Távora [Fri, 7 Apr 2023 18:33:12 +0000 (19:33 +0100)]
Jsonrpc: don't bind inhibit-read-only to t so early
Related to https://github.com/joaotavora/eglot/discussions/1202, where
because of this very wide binding to inhibit-read-only to t, Eglot was
managing to write into read-only buffers from the response handlers
that ran from within the stack of the jsonrpc.el process filter.
This is of course illegal and dangerous, but Eglot wasn't made aware
because of the binding.
* lisp/jsonrpc.el (jsonrpc--process-filter): Don't bind
inhibit-read-only so early.
Eli Zaretskii [Fri, 7 Apr 2023 15:31:42 +0000 (18:31 +0300)]
Allow active region when IM is used
* lisp/international/quail.el (quail-minibuffer-message): Bind
deactivate-mark to allow setting active region in the minibuffer
when an input method is used. (Bug#62709)