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)
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.
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.
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.
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'.
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)
Yuan Fu [Wed, 7 Dec 2022 22:50:16 +0000 (14:50 -0800)]
Make indirect buffers use tree-sitter parsers of their base buffer
Fix the problem described in bug#59693.
* src/treesit.c (treesit_record_change): Always use the base buffer.
(Ftreesit_parser_create): Always use the base buffer. Also change the
for loop into FOR_EACH_TAIL (stylistic change).
(Ftreesit_parser_list): Always use the base buffer.
Randy Taylor [Thu, 8 Dec 2022 01:53:35 +0000 (20:53 -0500)]
Add dockerfile-ts-mode (Bug#59894)
* admin/notes/tree-sitter/build-module/batch.sh: Add dockerfile support.
* admin/notes/tree-sitter/build-module/build.sh: Support different
namespaces and add dockerfile support.
* etc/NEWS: Mention it.
* lisp/progmodes/dockerfile-ts-mode.el: New major mode with
tree-sitter support.
* lisp/progmodes/eglot.el (eglot-server-programs): Add it.
Dmitry Gutov [Fri, 9 Dec 2022 21:21:10 +0000 (23:21 +0200)]
Use 'project--value-in-dir' for 'project-vc-include-untracked' too
* lisp/progmodes/project.el (project--vc-list-files): Use
'project--value-in-dir' for 'project-vc-include-untracked' too.
So that is can be reliably set through dir-locals.
Dmitry Gutov [Fri, 9 Dec 2022 16:15:49 +0000 (18:15 +0200)]
Bring back the project--value-in-dir logic
Essentialy revert commit 2389158a31b4a12, restoring the changes
and fixing the conflicts. Motivated by the problem brought up in
bug#59722 (behavior of project-find-files/regexp when switching
projects). We should find other ways to improve performance.
F. Jason Park [Fri, 25 Nov 2022 05:03:03 +0000 (21:03 -0800)]
Respect some spaces in auth-source-pass--match-regexp
* lisp/auth-source-pass.el (auth-source-pass--match-regexp): Allow an
entry's host and user fields to contain spaces, just like other
backends do.
* lisp/erc/erc-compat.el
(erc-compat--29-auth-source-pass--retrieve-parsed): Change regexp to
allow spaces in host and user components of file names.
* test/lisp/auth-source-pass-tests.el (auth-source-pass-any-host):
Silence warning message re wildcards emitted by
`auth-source-pass-search'.
(auth-source-pass-extra-query-keywords--suffixed-user): Add spaces
to users and hosts of some example entries. (Bug#58985.)
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.