Stefan Kangas [Tue, 13 Dec 2022 23:06:29 +0000 (00:06 +0100)]
Merge from origin/emacs-29
cd5856e4038 Fix bug when calling `rgrep` non-interactively ba4bdd6a259 Adapt Tramp specific tests in eglot-tests.el 1d5c35c8e46 * lisp/textmodes/texinfo.el (texinfo-flymake): Improve do... a99d0e7e6c9 Support a function in the BUFFER-LIST arg of list-buffers... def51dd6458 ; Fix typos 4980ed7a6d9 Don't allow lazy highlight from recursive minibuffers 4ef8b9f5441 Improve resetting face attributes when looking for suitab... c4b8bc90a8e ; Fix typos in doc strings c45eb138451 ; * lisp/bs.el (bs-attributes-list): Doc fix d6adaf487d8 Add lexical-binding to example package header 03ad1a92a2d Add improved tree-sitter navigation a5272e2a7cc ; * test/src/treesit-tests.el: Add outline headers. 489bcacc7c3 Add cross-reference to flush-lines 0f9e6532b14 Use font-lock-number-face for numeric values in csharp-mode 4bccb7b211e Make treesit-query-validate create a read-only buffer c0fe6c72cec Improve dockerfile-ts-mode imenu generation (Bug#59979) 631908f7017 Add "->" to python--treesit-operators (bug#59968) 5d4274d9b65 ; * admin/notes/tree-sitter/build-module/build.sh: Add -f... d264b75669d Align C++ access specifiers to their enclosing class/stru... ca67d988d87 Add cmake-ts-mode 8ec923775de Tweak various ts-mode's indent and fontification (bug#59931) 647b6a8099f Add expression for generic_name in csharp-ts-mode (bug#59... 5b178efd85a ; Adjust eglot test to recent autopep8/pycodestyle 58b8ed8b55c ; Avoid compilation warning on MS-Windows 40c23c11e88 * lisp/outline.el: Fix the value 'insert' of outline-mino... 527eb11de20 * lisp/minibuffer.el (completions-group-separator): Rever... 42d740fb2cb ; Skip two eglot tests when typescript is missing 19ef86f775a ; Remove outdated text describing overlays 081bf583007 Skip Eglot rust-analyzer tests if 'cargo' isn't available
Juri Linkov [Tue, 13 Dec 2022 17:47:47 +0000 (19:47 +0200)]
Support a function in the BUFFER-LIST arg of list-buffers-noselect (bug#59935)
* lisp/buff-menu.el (Buffer-menu-buffer-list): New buffer-local variable.
(list-buffers-noselect): Set Buffer-menu-buffer-list to 'buffer-list'
that now keeps the buffer-local value of the provided buffer list
or a function that returns the buffer list.
(list-buffers--refresh): Handle buffer-list and Buffer-menu-buffer-list
as a function and as a list.
* lisp/progmodes/project.el (project-list-buffers): Let-bind
'buffer-list-function' used by both legacy code and the new version
of list-buffers-noselect that supports its arg BUFFER-LIST as a function.
Eli Zaretskii [Tue, 13 Dec 2022 15:35:17 +0000 (17:35 +0200)]
Improve resetting face attributes when looking for suitable fonts
* src/xfaces.c (syms_of_xfaces)<face-font-lax-matched-attributes>:
Change the default value to t. Update doc string.
(realize_gui_face): When 'Vface_font_lax_matched_attributes' is t,
reset the 3 default font attributes efficiently. Call
'font_maybe_unset_attribute' only if the value is neither nil nor
t. (Bug#59347)
Eli Zaretskii [Tue, 13 Dec 2022 14:24:09 +0000 (16:24 +0200)]
; Improve recently installed documentation
* lisp/progmodes/prog-mode.el (prog-fill-reindent-defun): Fix
wording of the doc string.
* doc/emacs/programs.texi (Multi-line Indent): Improve wording of
the description of 'prog-fill-reindent-defun' and related
variables.
Yuan Fu [Tue, 13 Dec 2022 04:25:53 +0000 (20:25 -0800)]
Add improved tree-sitter navigation
This new set of functions (and tests) should eliminate
defun-navigation bugs and limitations we currently have. This commit
doesn't change any existing bahavior: treesit-beginning/end-of-defun
and friends are unchanged. The plan is to later switch gear and
replace the current functions with the new ones introduced in this
change.
This is a relatively big change, but I've setup a comprehensive test,
and it should fix current bugs, so I think it's ok to put it on the
release branch.
The gist of the new navigation is to use treesit--defuns-around to
find the previous sibling defun, next sibling defun, and the parent
defun, then use this information to move to previous/next
beginning/end of defun in treesit--navigate-defun.
I also added comprehensive testing that tests all four possible
operations (prev-beg, next-beg, prev-end, next-end) starting at all
possible positions (between two sibling defuns, inside a sibling
defun, etc).
* lisp/treesit.el (treesit-defun-type-regexp): Expand definition to
allow (REGEXP . FILTER). Old functions don't support this, but it
should be fine since we are soon replacing them.
(treesit-defun-tactic)
(treesit-defun-skipper): New variables.
(treesit-default-defun-skipper)
(treesit--defuns-around)
(treesit--top-level-defun)
(treesit--navigate-defun): New functions.
* test/src/treesit-tests.el (treesit--ert-insert-and-parse-marker)
(treesit--ert-collect-positions)
(treesit--ert-test-defun-navigation): New helper functions.
(treesit--ert-defun-navigation-python-program)
(treesit--ert-defun-navigation-js-program)
(treesit--ert-defun-navigation-bash-program)
(treesit--ert-defun-navigation-nested-master): New variables.
(treesit-defun-navigation-nested-1)
(treesit-defun-navigation-nested-2)
(treesit-defun-navigation-nested-3)
(treesit-defun-navigation-top-level): New tests.
Stefan Kangas [Tue, 13 Dec 2022 00:43:48 +0000 (01:43 +0100)]
Add cross-reference to flush-lines
* lisp/replace.el (flush-lines, kill-matching-lines): Add
cross-references between commands, using the names
'(kill|delete)-matching-lines' for symmetry. (Bug#59934)
Daniel Martín [Sun, 11 Dec 2022 14:57:43 +0000 (15:57 +0100)]
Align C++ access specifiers to their enclosing class/struct/union
(bug#59966)
The default style in c++-mode aligns access specifiers like "private",
"public" or "protected" to their enclosing class, struct, or union.
The "ellemtel" style indents access specifiers, but this C++ style is
not supported by c++-ts-mode yet.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Align access
specifiers to their enclosing class/struct/union.
Randy Taylor [Sun, 11 Dec 2022 02:40:25 +0000 (21:40 -0500)]
Add cmake-ts-mode
* admin/notes/tree-sitter/build-module/batch.sh:
* admin/notes/tree-sitter/build-module/build.sh: Add cmake support.
* etc/NEWS: Mention it.
* lisp/progmodes/cmake-ts-mode.el: New major mode with
tree-sitter support.
* lisp/progmodes/eglot.el (eglot-server-programs): Add it.
Add expression for generic_name in csharp-ts-mode (bug#59897)
Given the below example, we want 'services' to be font-locked in
'font-lock-variable-name-face' in all cases. Previously this only
worked in the first case, and the other was font-locked as
'font-lock-function-name-face'.
Stefan Kangas [Mon, 12 Dec 2022 10:50:38 +0000 (11:50 +0100)]
; Skip two eglot tests when typescript is missing
* test/lisp/progmodes/eglot-tests.el
(javascript-basic, project-wide-diagnostics-typescript): Skip tests
when the npm package "typescript" is not installed.
Po Lu [Mon, 12 Dec 2022 11:21:10 +0000 (19:21 +0800)]
Add variable to make resizing frames sometimes faster
* etc/PROBLEMS: Add documentation about new variable.
* src/xterm.c (x_set_offset, x_set_window_size_1): Respect new
variable.
(syms_of_xterm): Add a new variable to prevent Emacs from
syncing upon resize or movement.
Yuan Fu [Sun, 11 Dec 2022 22:43:58 +0000 (14:43 -0800)]
Add customizale faces for tree-sitter explorer
* lisp/treesit.el (treesit-explorer-anonymous-node)
(treesit-explorer-field-name): New face.
(treesit--explorer-draw-node): Use the new faces.
(treesit-explore-mode): Change playground to explorer.
Introduce a new command that aims to reindent code in a defun, or fill
a paragraph of text. The command uses treesit.el when available,
otherwise falls back to using syntax-ppss and regexps. Treesit.el
needs a new variable that is intended to be set by the major modes so
that this and other future functions can know what kind of node we are
looking at.
* doc/emacs/programs.texi: Mention the new command.
* etc/NEWS: Mention the new command.
* lisp/progmodes/c-ts-mode.el (c++-ts-mode): Add regexp for the new
variable.
* lisp/progmodes/csharp-mode.el (csharp-ts-mode): Add regexp for the
new variable.
* lisp/progmodes/java-ts-mode.el (java-ts-mode): Add regexp for the
new variable.
* lisp/progmodes/js.el (js-ts-mode): Add regexp for the new variable.
* list/progmodes/prog-mode.el (prog-mode-map): Bind the new command by
default.
(prog-fill-reindent-defun): New command.
* lisp/progmodes/sh-script.el (bash-ts-mode): Add regexp for the new
variable.
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-base-mode): Add
regexp for the new variable.
* lisp/treesit.el (treesit-text-type-regexp): New variable.
Juri Linkov [Sun, 11 Dec 2022 17:24:34 +0000 (19:24 +0200)]
Don't use diff-mode buffer as a patch when it's visiting a file (bug#59962)
* lisp/vc/vc.el (vc-deduce-fileset-1): Don't call diff-vc-deduce-fileset
for diff-mode when buffer-file-name is non-nil. This is because in this case
a file with a diff might be committed to VCS. So don't use it as a patch
to commit with 'C-x v v'.
Fix use-package-defaults defcustom type (bug#59941)
* lisp/use-package/use-package-core.el (use-package-defaults):
Enlarge type to allow for keywords such as :ensure and :pin to be
added later, remedying a failure in test-custom-opts.
* src/itree.c (itree_iterator_start): Fix docstring typo.
* test/manual/noverlay/itree-tests.c: Stop defining unused
ITREE_DEBUG. Replace removed names and APIs with current ones,
e.g. interval_tree_init is now called itree_init, and
itree_iterator_finish no longer exists. Ensure preconditions of
itree API are satisfied before use, e.g. by zero-initializing
instances of itree_node before inserting them into a tree.
Po Lu [Sun, 11 Dec 2022 01:34:03 +0000 (09:34 +0800)]
Merge from origin/emacs-29
44c5f361497 ; Fix two byte-compiler warnings a8ee046fb50 Ensure 'package-vc--version' always returns a version 022ab1061b2 Ensure 'package-vc--main-file' always returns an existing... 357fe91996b Check if package already exists before installing from ch... 5e8bc79f6b2 ; Fix reference in docstring to 'package-vc-install-from-... af88b00b19c Refresh the package quickstart file in package-vc 5a092c8e461 ; * admin/notes/tree-sitter/starter-guide (Indent): Minor... ebef8905b0d Make indirect buffers use tree-sitter parsers of their ba... 8f53fa10d94 Fontify "this" as a keyword in c++-ts-mode (bug#59924) 8de8f1dc051 Add class_body indentation for typescript (bug#59680) 839341d7370 Make more granular defun-type-regexp (bug#59873) 8f49137c9bf Add dockerfile-ts-mode (Bug#59894) 1014bcc8e32 Fix fontification of method-invocations in js-ts-mode (bu... 7141920c6af Fix escape-sequence feature in typescript-ts-mode (bug#59... 4df35e3491c Improve fontification in csharp-ts-mode (bug#59909) 33a8415eb7e Use 'project--value-in-dir' for 'project-vc-include-untra... 594267395d5 Update Turkish Hello 940d9070e97 Support newer glib versions (Bug#59061) 0bd26abf7fb ; * doc/misc/use-package.texi: Fix @file. bcf235acd58 Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/... 2ea7a357fd1 ; * doc/misc/use-package.texi: Fix @acronym. d268ab1c5d7 Bring back the project--value-in-dir logic
Po Lu [Sun, 11 Dec 2022 01:32:20 +0000 (09:32 +0800)]
Improve last change to xfaces.c
* src/xfaces.c (font_unset_attribute): New function.
(realize_gui_face): Improve commentary and use list instead of
bitmask.
(syms_of_xfaces): Get rid of bitmask. Replace it by a list,
there is no reason any user should have to think about bitmasks
in Emacs lisp.
Gregory Heytings [Sat, 10 Dec 2022 22:13:58 +0000 (22:13 +0000)]
Unset the weight/slant/width in the spec when realizing a font
Between commits bf0d3f76dc (2014) and 6b1ed2f2c9 (2022),
realize_gui_face called font_load_for_lface with an empty or
partly emptied font spec, i.e. it ignored a part of its attrs
argument. The rationale given in bug#17973, which led to bf0d3f76dc, is not clear. However, 6b1ed2f2c9, which passes
the full font spec to font_load_for_lface and
font_find_for_lface, leads to suboptimal font choices, for
example when the font chosen for the default face has a
weight, slant or width that is not supported by other
available fonts on the system, such as 'medium' or 'heavy'.
If these attributes are not unset here, the call to
font_list_entities in font_find_for_lface arbitrarily limits
the candidate font list to those that are perfect matches for
these attributes, which means that the scoring mechanism is
bypassed. Note that the size attribute in spec is also unset,
in font_find_for_lface.
Also allow unsetting the other attributes, for debugging purposes.
* src/xfaces.c (realize_gui_face): Unset the weight, slant and
width of the font spec. Fixes bug#57555 and bug#59347.
(syms_of_xfaces): New variable
'realize-gui-face-ignored-spec-attributes'.
gdb-mi.el: Configure variable order and length in local-vars window
This changes allows users to configure the order of various properties
as well as truncating their length. The full description of each
property is available as a help-text (tooltip).
* lisp/progmodes/gdb-mi.el (gdb-locals-table-row-config): New user
option.
(gdb-locals-value-filter): Don't limit the values here.
(gdb-locals-table-columns-list): New function.
(gdb-locals-handler-custom): Call it. (Bug#59730)
Jim Porter [Sat, 10 Dec 2022 06:56:24 +0000 (22:56 -0800)]
; Fix a failure when running server-tests via the command line
* test/lisp/server-tests.el
(server-tests/server-force-stop/keeps-frames): Delete every new frame
created during the test. On some systems, 'delete-terminal' will
delete the frames for us, so this ensures that if there are no new
frames, nothing happens.
Ensure 'package-vc--main-file' always returns an existing file
* lisp/emacs-lisp/package-vc.el (require): Explicitly require cl-lib.
(package-vc--main-file): If the expected file name is missing, try and
find the closest match.
Matt Armstrong [Wed, 30 Nov 2022 23:58:07 +0000 (15:58 -0800)]
Refresh the package quickstart file in package-vc
* lisp/emacs-lisp/package-vc.el (package-vc--unpack-1): Call
`package--quickstart-maybe-refresh', just as
`package-install-from-buffer' does. (bug#59728)
Jim Porter [Sat, 10 Dec 2022 06:56:24 +0000 (22:56 -0800)]
; Fix a failure when running server-tests via the command line
* test/lisp/server-tests.el
(server-tests/server-force-stop/keeps-frames): Delete every new frame
created during the test. On some systems, 'delete-terminal' will
delete the frames for us, so this ensures that if there are no new
frames, nothing happens.