1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-12 09:28:24 +00:00
Commit Graph

163958 Commits

Author SHA1 Message Date
Yuan Fu
e6c49c0454
; Fix byte-copmiler warning in c-ts-mode--fontify-declarator
* lisp/progmodes/c-ts-mode.el (c-ts-mode--fontify-declarator): Ignore
the rest args.
2022-12-25 01:11:47 -08:00
Yuan Fu
4234033a47
; * lisp/treesit.el: Add some comments. 2022-12-25 01:11:47 -08:00
Yuan Fu
79584a206b
Further generalize treesit-defun functions
Two new functions, treesit-beginning/end-of-thing.  And
treesit-thing-at-point's signature changes.

* lisp/treesit.el (treesit-block-type-regexp): New variable.
(treesit-beginning-of-thing)
(treesit-end-of-thing): Generalized from
treesit-beginning/end-of-defun.
(treesit-beginning-of-defun)
(treesit-end-of-defun): Use the new functions.
(treesit-thing-at-point): Accept PATTERN rather than REGEXP and PRED.
(treesit-defun-at-point): Adjust for the new signature of
treesit-thing-at-point.
2022-12-25 01:11:47 -08:00
Yuan Fu
a819ca5a93
Generalize treesit-defun functions to "things"
Change the "defun" in some functions (e.g. treesit--defuns-around) to
"thing".  Add a function treesit-thing-at-point.

* lisp/treesit.el (treesit--thing-unpack-pattern): New subroutine.
(treesit-beginning-of-defun)
(treesit-end-of-defun): Use new function treesit--navigate-thing.
(treesit--defuns-around): Generalize into treesit--thing-around.
(treesit--top-level-defun): Generalize into treesit--top-level-thing.
(treesit--navigate-defun): Generalize into treesit--navigate-thing.
(treesit-thing-at-point): Generalized from treesit-defun-at-point.
(treesit-defun-at-point): Use treesit-thing-at-point to do tht work.
2022-12-25 01:11:47 -08:00
Philip Kaludercic
e8b34109ee Reorder optional arguments to 'package-vc-install'
* lisp/emacs-lisp/package-vc.el (package-vc-install-selected-packages):
Update 'package-vc-install' invocation.
(package-vc-install): Reorder and update documentation.
2022-12-25 09:53:07 +01:00
Philip Kaludercic
b38e56d8a9 Handle missing dependencies for source packages
* lisp/emacs-lisp/package-vc.el (package-vc-install-dependencies): Add
new function.
(package-vc--unpack-1): Call 'package-vc-install-dependencies' instead
of 'package-compute-transaction' and 'package-download-transaction'.

It is unreasonable to abort the installation, since we cannot expect
all dependencies to be available in the regular archives.  Instead we
note which packages couldn't be found, and warn the user that these
will be missing.
2022-12-25 09:36:01 +01:00
Philip Kaludercic
7bc7b6b4dd ; Partial revert of f3e7820b
* lisp/emacs-lisp/package.el (package-install-from-archive): Check if
a package is a directory package, not a VC package
2022-12-25 09:36:01 +01:00
Eli Zaretskii
2cec78254e ; * nt/INSTALL.W64: Fix wording. 2022-12-25 10:26:59 +02:00
Eli Zaretskii
ecee3bd420 ; Fix recent changes in treesit documentation
* lisp/treesit.el (treesit-defun-name-function, treesit-node-at)
(treesit-node-on): Doc fixes.

* doc/lispref/parsing.texi (Tree-sitter major modes): Fix wording,
punctuation, and indexing.
(Retrieving Nodes): Fix wording and add cross-references.
2022-12-25 09:29:47 +02:00
Yuan Fu
c36fe3df17
Fix c-ts-mode imenu defun name (bug#60296)
Extract out c-ts-mode--declarator-identifier from
c-ts-mode--fontify-declarator.

* lisp/progmodes/c-ts-mode.el (c-ts-mode--declarator-identifier): New
function.
(c-ts-mode--fontify-defun): Extract out.
(c-ts-mode--defun-name): Use the new function.
2022-12-24 18:59:39 -08:00
Yuan Fu
a24e350170
Fix treesit--children-covering-range-recurse (bug#60301)
* lisp/treesit.el (treesit--children-covering-range-recurse): Always
return a list of node.
2022-12-24 18:46:04 -08:00
Yuan Fu
fbb4eb919b
Support treesit-defun-name in tree-sitter major modes
* lisp/progmodes/csharp-mode.el (csharp-ts-mode--defun-name): New
function.
(csharp-ts-mode--imenu-1): Extract into new function.
(csharp-ts-mode): Setup treesit-defun-name-function.
* lisp/progmodes/java-ts-mode.el (java-ts-mode--defun-name): New
function.
(java-ts-mode--imenu-1): Extract into new function.
(java-ts-mode): Setup treesit-defun-name-function.
* lisp/progmodes/js.el (js-treesit-current-defun): Remove function.
This function is not used (for a while already).
(js--treesit-defun-name): New function.
(js--treesit-imenu-1): Extract into new function.
(js-ts-mode): Setup treesit-defun-name-function.
* lisp/progmodes/json-ts-mode.el (json-ts-mode--defun-name): New
function.
(json-ts-mode--imenu-1): Extract into new function.
(json-ts-mode): Setup treesit-defun-name-function.
* lisp/progmodes/python.el (python--treesit-defun-name): New function.
(python--imenu-treesit-create-index-1): Extract into new function.
(python-ts-mode): Setup treesit-defun-name-function.
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--defun-name): New
function.
(rust-ts-mode--imenu-1): Extract into new function.
(rust-ts-mode): Setup treesit-defun-name-function.
* lisp/textmodes/css-mode.el (css--treesit-defun-name): New function.
(css--treesit-imenu-1): Extract into new function.
(css-ts-mode): Setup treesit-defun-name-function.
* lisp/textmodes/toml-ts-mode.el (toml-ts-mode--get-table-name):
Remove function.
(toml-ts-mode--defun-name): New function.
(toml-ts-mode--imenu-1): Extract into new function.
(toml-ts-mode): Setup treesit-defun-name-function.
2022-12-24 18:43:03 -08:00
Yuan Fu
6253184afc
; * lisp/treesit.el (treesit-defun-at-point): Guard against nil. 2022-12-24 18:43:03 -08:00
Yuan Fu
f8e219ebfa
Add treesit-defun-name and friends
1. We now have treesit-defun-name, powered by
treesit-defun-name-function.
2. We now have treesit-add-log-current-defun, which powers
add-log-current-defun.
3. c-ts-mode updates its code to take advantage of these new features.
4. Manual updates.

* doc/lispref/parsing.texi (Tree-sitter major modes): Add manual for
new functions.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--defun-name): New function.
(c-ts-mode--imenu-1): Extract out into c-ts-mode--defun-name.
(c-ts-base-mode): Setup treesit-defun-name-function.
* lisp/treesit.el (treesit-defun-name-function)
(treesit-add-log-defun-delimiter): New variables.
(treesit-defun-at-point)
(treesit-defun-name): New functions.
(treesit-major-mode-setup): Setup add-log-current-defun-function.
2022-12-24 18:43:03 -08:00
Yuan Fu
35c2ca2ca6
Make treesit-node-at/on guess language at point
If PARSER-OR-LANG is nil, it makes more sense to guess the language at
point by treesit-language-at than to simply use the first parser in
the parser list.

* doc/lispref/parsing.texi (Retrieving Nodes): Update manual.
* lisp/treesit.el (treesit-node-at)
(treesit-node-on): Guess language at point.  Update docstring.
(treesit-buffer-root-node): Update docstring.
2022-12-24 18:43:03 -08:00
Yuan Fu
7f7def2ae6
; Add treesit-no-parser error
* lisp/treesit.el (treesit-no-parser): New error.
(treesit-buffer-root-node): Use the new error.
2022-12-24 18:43:03 -08:00
Óscar Fuentes
b6a2e1ddf6 * nt/INSTALL.W64: update instructions for setting up W64 environment 2022-12-25 03:19:20 +01:00
Eli Zaretskii
265b91d891 Revert "; Bump minimum supported Windows version for MinGW64 to Windows 10."
This reverts commit 75155e4586.
Evidently, some MSYS2/MinGW64 folks still think Windows 8.1
is the minimum supported version, even though MinGW-w64 switched
to Windows 10 as the default target in January 2022.
2022-12-24 21:39:26 +02:00
Eli Zaretskii
75155e4586 ; Bump minimum supported Windows version for MinGW64 to Windows 10. 2022-12-24 20:45:08 +02:00
Eli Zaretskii
677f6c79eb ; Update minimum requirements of MinGW-w64
* etc/PROBLEMS (Dumping):
* nt/INSTALL.W64: Update the minimum OS version supported by
MinGW-w64.
2022-12-24 18:46:58 +02:00
Mattias Engdegård
7723af5e4a ; * lisp/progmodes/c-ts-mode.el: quote literal string in regexp 2022-12-24 17:01:36 +01:00
Eli Zaretskii
38866510c7 ; * src/xdisp.c (redisplay_internal): Reinstate the FRAME_LIVE_P test. 2022-12-24 12:27:17 +02:00
Eli Zaretskii
a825aa0b13 Fix definition of CNS 11643-15 charset
* lisp/international/mule-conf.el (chinese-cns11643-15): Fix
:code-offset value.  (Bug#60275)
* lisp/international/characters.el: Add chinese-cns11643-15 to
charsets whose characters have categories c and C.
2022-12-24 12:08:43 +02:00
Yuan Fu
a42b20dd95
; * lisp/progmodes/c-ts-mode.el: Add outline section headers. 2022-12-24 00:33:17 -08:00
Yuan Fu
e4e3634539
Improve c-ts-mode block comment indent (bug#60270)
Now it handles stuff like

/**
 * @some_func:
 * @arg1:
 */

* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Use new
matcher and anchor.
(c-ts-mode--looking-at-star): New matcher.
(c-ts-mode--comment-start-after-first-star): New anchor.
2022-12-24 00:33:17 -08:00
Yuan Fu
e30621caa2
; Add treesit_recursion_limit
* src/treesit.c (treesit_recursion_limit): New constant.
(treesit_cursor_helper)
(Ftreesit_search_subtree)
(Ftreesit_induce_sparse_tree): Use the new constant.
2022-12-24 00:33:17 -08:00
Yuan Fu
6a43af5880
Fix block comment indent and filling for c-ts-mode (bug#59763)
Now indent and filling works like in c-mode.  The only noticeable
missing piece is that the "*/" is not attached to the last sentence
when filling.  c-mode does it by replacing whitespaces between the
"*/" and the end of the last sentence with xxx, fill it, then change
the xxx back. I don't know if we should do that in c-ts-mode's filling.

* doc/lispref/modes.texi (Parser-based Indentation): Add new preset.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Add new
indent rule.
(c-ts-mode--fill-paragraph): New function.
(c-ts-base-mode): Setup paragraph-start, adaptive-fill, etc.
* lisp/treesit.el (treesit-simple-indent-presets): Add new preset.
2022-12-24 00:33:17 -08:00
Yuan Fu
e492c21e81
Fix treesit_cursor_helper (bug#60267)
The cause of that bug is that in a particular parse tree, the node
treesit_cursor_helper tries to go to is a missing node, not only is it
a missing node, it is the first node of a subtree.  So when
treesit_cursor_helper follows the algorithm and goes down the tree, it
goes down the previous subtree (because that subtree's end = end_pos,
because the target node has zero width).

    o
    |
 o--+-o
 |    |
 +-+  +-+-+
 | |  | | |
 o x  t o o

(We ended up in x when the target is t, because t has zero width.)

One way to solve it is to go back up the tree if we are at a leaf node
and still haven't matched the target node.  That's too ugly and
finicky so I resorted to recursion.  Now one more functions will
return give up (treesit_node_parent) if we are in a werid parse tree
that is super deep.  But since we already kind of give up on this kind
of parse trees (bug#59426), it doesn't really hurt.

* src/treesit.c (treesit_cursor_helper_1): New function.
(treesit_cursor_helper): Use the new function.  Change return type to
bool, and accept a cursor pointer.

(Ftreesit_node_parent)
(Ftreesit_search_subtree)
(Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Use the new signature.
2022-12-24 00:33:16 -08:00
Paul Eggert
4437dbedf7 Fix restart-emacs alarms (Bug#60220)
* src/emacs.c (Fkill_emacs): Turn timers off before execing,
so that the re-execed Emacs doesn’t get a timer alarm.
2022-12-24 00:23:02 -08:00
Florian Weimer
121a9ff9f6 Fix alternate stack test in configure
* configure.ac (emacs_cv_alternate_stack): Include <stdlib.h>
for 'malloc's prototype.
2022-12-24 10:03:23 +02:00
Xi Lu
84888080ee Add more functions to "string" shortdoc
* lisp/emacs-lisp/shortdoc.el: Add 'string-or-null-p',
'char-or-string-p', 'char-uppercase-p'.  (Bug#60279)
2022-12-24 09:55:22 +02:00
Yaraslau Tamashevich
c90f97d4e5 Make the Contour terminal an alias of xterm-256color
* lisp/faces.el (term-file-aliases): Make the Contour terminal an
alias of xterm-256color.  (Bug#60278)

Copyright-paperwork-exempt: yes
2022-12-24 09:50:51 +02:00
Eli Zaretskii
c3fac9465f ; Fix punctuation in last change. 2022-12-24 09:40:56 +02:00
glacials
756bb422a4 Correct wrong info in (info)Go to node
The node (info)Go to node in the Info manual states that 'g'
does not allow the use of abbreviations, however it does.
To test this, type 'gt' from this node and see that it takes
you to (info)Top, then type 'ggo<RET>' and see that it takes
you back to (info)Go to node.  Tested on emacs 28.2.
* doc/misc/info.texi (Go to node): Fix inaccurate information.
(Bug#60263)

Copyright-paperwork-exempt: yes
2022-12-24 09:37:50 +02:00
Eli Zaretskii
a8c3424d28 Fix typo in TUTORIAL.fr (bug#60261)
* etc/tutorials/TUTORIAL.fr: Fix typo.  Reported by
Clément Escude--Cotinat <clement.escudecotinat@yahoo.fr>.
2022-12-24 09:32:08 +02:00
Daniel Martín
24cd2f0daf Add some diff-fixup-modifs tests
* test/lisp/vc/diff-mode-tests.el (diff-mode-test-fixups-added-lines):
Test that diff-mode fixes patches with added lines correctly.
* test/lisp/vc/diff-mode-tests.el (diff-mode-test-fixups-empty-hunks):
Ditto for patches with empty hunks.  (Bug#60259)
2022-12-24 09:27:07 +02:00
Ulrich Müller
d32091199a Fix quoted argument in emacsclient-mail.desktop Exec key
Apparently the emacsclient-mail.desktop file doesn't conform to the
Desktop Entry Specification at
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables
which says about the Exec key:

| Field codes must not be used inside a quoted argument, the result of
| field code expansion inside a quoted argument is undefined.

However, the %u field code is used inside a quoted argument of the
Exec key in both the [Desktop Entry] and [Desktop Action new-window]
sections.
* etc/emacsclient-mail.desktop (Exec): The Desktop Entry
Specification does not allow field codes like %u inside a quoted
argument. Work around it by passing %u as first parameter ($1)
to the shell wrapper.
* etc/emacsclient.desktop (Exec): Use `sh` rather than `placeholder`
as the command name of the shell wrapper.  (Bug#60204)
2022-12-24 09:19:40 +02:00
Richard Hansen
286c48137f ert-x: Move window selection logic to its own macro
* lisp/emacs-lisp/ert-x.el (ert-with-buffer-selected): New macro to
temporarily display a buffer in a selected window and evaluate a body.
(ert-with-test-buffer-selected): Use the new macro.
* test/lisp/whitespace-tests.el
(ert-test-with-buffer-selected/current)
(ert-test-with-buffer-selected/selected)
(ert-test-with-buffer-selected/nil-buffer)
(ert-test-with-buffer-selected/modification-hooks)
(ert-test-with-buffer-selected/read-only)
(ert-test-with-buffer-selected/return-value): Add tests.
(Bug#60189)
2022-12-24 09:14:23 +02:00
Richard Hansen
823c49cea8 ; ert-x: Simplify `ert-with-test-buffer-selected'
* lisp/emacs-lisp/ert-x.el (ert-with-test-buffer-selected):
Simplify using 'ert-with-test-buffer'.  (Bug#60189)
2022-12-24 09:12:12 +02:00
Richard Hansen
38c6abe4d0 ; ert-x: Add test for buffer read-only state
This test should have been included with commit
29b7d74000.
* test/lisp/emacs-lisp/ert-x-tests.el
(ert-test-with-test-buffer-selected/read-only): New test.
(Bug#60189)
2022-12-24 09:10:36 +02:00
Po Lu
0e39ad6fa5 Fix crash after X error
* src/xdisp.c (redisplay_internal): Catch another crash if
gcscrollbars after an X error.
2022-12-24 14:15:04 +08:00
Xi Lu
9a3b08061f Fix ruby-mode.el local command injection vulnerability (bug#60268)
* lisp/progmodes/ruby-mode.el
(ruby-find-library-file): Fix local command injection vulnerability.
2022-12-24 01:42:42 +02:00
Michael Albinus
4b44a395b3 ; * etc/NEWS: Fix typos. 2022-12-23 19:29:37 +01:00
Michael Albinus
458e175270 Merge branch 'emacs-29' of git.sv.gnu.org:/srv/git/emacs into emacs-29 2022-12-23 18:36:08 +01:00
Eli Zaretskii
eccb813a94 Fix "C-h k" in recursive minibuffers
* lisp/subr.el (event--posn-at-point): Leave POSN alone if it
doesn't have at least 6 members.  This follows more faithfully
what 'event-start' and 'event-end' did before they started using
this function, see commit c1cead89f5.  Call posn-at-point with
the minibuffer-window when in the minibuffer.  (Bug#60252)
2022-12-23 16:41:08 +02:00
Eli Zaretskii
6dda2106ec ; Improve documentation of "C-x @"
* doc/emacs/custom.texi (Modifier Keys): Document how to enter
Shift, Control, and Meta using "C-x @".

* lisp/simple.el (function-key-map): Add commentary to "C-x @"
bindings to make them easier to discover.
2022-12-23 14:37:04 +02:00
Eli Zaretskii
a0738e8ad1 ; * etc/NEWS: Announce the new behavior of 'C-h f'. (Bug#60252) 2022-12-23 13:32:18 +02:00
Sean Whitton
5a34e7c86c ; * admin/notes/git-workflow: Adding "Backport:" is optional. 2022-12-22 13:38:58 -07:00
Sean Whitton
baaa9f42e5 vc-git-checkin: Don't try to apply an empty patch
* lisp/vc/vc-git.el (vc-git-checkin): Don't try to apply an empty
patch to the index, because in that case 'git apply' fails.

(cherry picked from commit 1424342225)
2022-12-22 13:37:12 -07:00
Ikumi Keita
0754173c92 ; Fix docstring
* lisp/textmodes/reftex-vars.el
(reftex-allow-detached-macro-args): Fix macro name in docstring.
2022-12-22 18:23:34 +01:00