diff options
| author | Eli Zaretskii | 2025-04-14 11:42:26 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2025-04-14 11:42:26 +0300 |
| commit | f7ca720e2d0aebeabc454a24a600c23fd444b60b (patch) | |
| tree | 1af0b6bf9b8940aeedef0e78d6a733cd048d2bcd | |
| parent | 462bd149cddc2a7ba81de7ad0c286bcb64681d69 (diff) | |
| download | emacs-f7ca720e2d0aebeabc454a24a600c23fd444b60b.tar.gz emacs-f7ca720e2d0aebeabc454a24a600c23fd444b60b.zip | |
; * etc/NEWS: Move tree-sitter related items.
| -rw-r--r-- | etc/NEWS | 238 |
1 files changed, 118 insertions, 120 deletions
| @@ -546,6 +546,13 @@ This variable has no effect when Transient Mark mode is off. | |||
| 546 | 546 | ||
| 547 | ** Tree-sitter | 547 | ** Tree-sitter |
| 548 | 548 | ||
| 549 | *** The file treesit-x.el defines a number of simple tree-sitter modes. | ||
| 550 | Using the new macro 'define-treesit-generic-mode', generic modes are | ||
| 551 | defined including, but not limited to, 'gitattributes-generic-ts-mode'. | ||
| 552 | Visiting a file in such mode asks for confirmation before installing | ||
| 553 | its tree-sitter grammar. Then it highlights the visited file | ||
| 554 | according to the syntax defined by the grammar. | ||
| 555 | |||
| 549 | *** New command 'treesit-cycle-sexp-type'. | 556 | *** New command 'treesit-cycle-sexp-type'. |
| 550 | It cycles the type of navigation for commands that move across sexp's | 557 | It cycles the type of navigation for commands that move across sexp's |
| 551 | and lists, such as 'treesit-forward-sexp', 'treesit-forward-list', | 558 | and lists, such as 'treesit-forward-sexp', 'treesit-forward-list', |
| @@ -556,6 +563,117 @@ symbols and using the thing 'list' for lists. | |||
| 556 | With the 'sexp' type these commands move across nodes defined by | 563 | With the 'sexp' type these commands move across nodes defined by |
| 557 | the tree-sitter thing 'sexp' in 'treesit-thing-settings'. | 564 | the tree-sitter thing 'sexp' in 'treesit-thing-settings'. |
| 558 | 565 | ||
| 566 | +++ | ||
| 567 | *** Indirect buffers can have their own parser list. | ||
| 568 | Before, indirect buffers share their base buffer’s parser list and | ||
| 569 | parsers. Now they can have their own parser list. | ||
| 570 | |||
| 571 | +++ | ||
| 572 | *** New variable 'treesit-language-remap-alist'. | ||
| 573 | This variable allows a user to remap one language into another, such | ||
| 574 | that creating a parser for language A actually creates a parser for | ||
| 575 | language B. By extension, any font-lock rules or indentation rules for | ||
| 576 | language A will be applied to language B instead. | ||
| 577 | |||
| 578 | This is useful for reusing font-lock rules and indentation rules of | ||
| 579 | language A for language B, when language B is a strict superset of | ||
| 580 | language A. | ||
| 581 | |||
| 582 | +++ | ||
| 583 | *** New accessor functions for each setting in 'treesit-font-lock-settings'. | ||
| 584 | Now users can access a setting's query, feature, enable flag, and | ||
| 585 | override flag by 'treesit-font-lock-setting-query', | ||
| 586 | 'treesit-font-lock-setting-feature', 'treesit-font-lock-setting-enable', | ||
| 587 | and 'treesit-font-lock-setting-override'. | ||
| 588 | |||
| 589 | *** New tree-sitter thing 'list'. | ||
| 590 | Unlike the existing thing 'sexp' that defines both lists and atoms, | ||
| 591 | 'list' defines only lists to be navigated by 'forward-sexp'. | ||
| 592 | The new function 'treesit-forward-sexp-list' uses 'list' | ||
| 593 | to move across lists. But to move across atoms inside the list | ||
| 594 | it uses 'forward-sexp-default-function'. | ||
| 595 | |||
| 596 | *** New tree-sitter based functions for moving by lists. | ||
| 597 | If a major mode defines 'list' in 'treesit-thing-settings', | ||
| 598 | tree-sitter setup for these modes sets 'forward-list-function' to | ||
| 599 | 'treesit-forward-list', 'up-list-function' to 'treesit-up-list', and | ||
| 600 | 'down-list-function' to 'treesit-down-list'. This enables the | ||
| 601 | 'forward-list', 'up-list', and 'down-list' motion commands for those | ||
| 602 | modes. | ||
| 603 | |||
| 604 | *** Tree-sitter enabled modes now properly support 'show-paren-mode'. | ||
| 605 | They do that by letting 'show-paren-mode' use the results of parsing by | ||
| 606 | the tree-sitter library. The new function 'treesit-show-paren-data' is | ||
| 607 | used to communicate the tree-sitter parsing results to | ||
| 608 | 'show-paren-mode'. | ||
| 609 | |||
| 610 | *** Tree-sitter enabled modes now properly support 'hs-minor-mode'. | ||
| 611 | All commands from hideshow.el can selectively display blocks | ||
| 612 | defined by the new tree-sitter thing 'list'. | ||
| 613 | |||
| 614 | *** New tree-sitter thing 'comment'. | ||
| 615 | The new variable 'forward-comment-function' is set to the new function | ||
| 616 | 'treesit-forward-comment' if a major mode defines the thing 'comment'. | ||
| 617 | |||
| 618 | +++ | ||
| 619 | *** New function 'treesit-language-display-name'. | ||
| 620 | This new function returns the display name of a language given the | ||
| 621 | language symbol. For example, 'cpp' is translated to "C++". A new | ||
| 622 | variable 'treesit-language-display-name-alist' holds the translations of | ||
| 623 | language symbols where that translation is not trivial. | ||
| 624 | |||
| 625 | *** New function 'treesit-merge-font-lock-feature-list'. | ||
| 626 | This function merges two tree-sitter font-lock feature lists. Returns a | ||
| 627 | new font-lock feature list with no duplicates in the same level. It can | ||
| 628 | be used to merge font-lock feature lists in a multi-language major mode. | ||
| 629 | |||
| 630 | *** New function 'treesit-replace-font-lock-feature-settings'. | ||
| 631 | Given two tree-sitter font-lock settings, it replaces the feature in the | ||
| 632 | second font-lock settings with the same feature in the first font-lock | ||
| 633 | settings. In a multi-language major mode it is sometimes necessary to | ||
| 634 | replace features from one of the major modes, with others that are | ||
| 635 | better suited to the new multilingual context. | ||
| 636 | |||
| 637 | *** New function 'treesit-simple-indent-modify-rules'. | ||
| 638 | Given two tree-sitter indent rules, it replaces, adds, or prepends rules | ||
| 639 | in the old rules with new ones, then returns the modified rules. In a | ||
| 640 | multi-language major mode it is sometimes necessary to modify rules from | ||
| 641 | one of the major modes to better suit the new multilingual context. | ||
| 642 | |||
| 643 | +++ | ||
| 644 | *** New variable 'treesit-aggregated-simple-imenu-settings'. | ||
| 645 | This variable allows major modes to setup Imenu for multiple languages. | ||
| 646 | |||
| 647 | +++ | ||
| 648 | *** New variable 'treesit-aggregated-outline-predicate'. | ||
| 649 | This variable allows major modes to setup 'outline-minor-mode' | ||
| 650 | for multiple languages. | ||
| 651 | |||
| 652 | *** New function 'treesit-simple-indent-add-rules'. | ||
| 653 | This new function makes it easier to customize indent rules for | ||
| 654 | tree-sitter modes. | ||
| 655 | |||
| 656 | *** New variable 'treesit-simple-indent-override-rules'. | ||
| 657 | Users can customize this variable to add simple custom indentation rules | ||
| 658 | for tree-sitter major modes. | ||
| 659 | |||
| 660 | +++ | ||
| 661 | *** 'treesit-language-at-point-function' is now optional. | ||
| 662 | Multi-language major modes can rely on the default return value from | ||
| 663 | 'treesit-language-at' that uses the new function 'treesit-parsers-at'. | ||
| 664 | |||
| 665 | +++ | ||
| 666 | *** New command 'treesit-explore'. | ||
| 667 | This command replaces 'treesit-explore-mode'. It turns on | ||
| 668 | 'treesit-explore-mode' if it is not on, and pops up the explorer buffer | ||
| 669 | if it is already on. | ||
| 670 | |||
| 671 | +++ | ||
| 672 | *** 'treesit-explore-mode' now supports local parsers. | ||
| 673 | Now 'treesit-explore-mode' (or 'treesit-explore') prompts for a parser | ||
| 674 | rather than a language, and it is now possible to select a local parser | ||
| 675 | at point to explore. | ||
| 676 | |||
| 559 | ** Text mode | 677 | ** Text mode |
| 560 | 678 | ||
| 561 | --- | 679 | --- |
| @@ -1970,126 +2088,6 @@ authorize the invoked D-Bus method (for example via polkit). | |||
| 1970 | ** The customization group 'wp' has been removed. | 2088 | ** The customization group 'wp' has been removed. |
| 1971 | It has been obsolete since Emacs 26.1. Use the group 'text' instead. | 2089 | It has been obsolete since Emacs 26.1. Use the group 'text' instead. |
| 1972 | 2090 | ||
| 1973 | ** Changes in tree-sitter modes | ||
| 1974 | |||
| 1975 | *** The file treesit-x.el defines a number of simple tree-sitter modes. | ||
| 1976 | Using the new macro 'define-treesit-generic-mode', generic modes are | ||
| 1977 | defined including, but not limited to, 'gitattributes-generic-ts-mode'. | ||
| 1978 | Visiting a file in such mode asks for confirmation before installing | ||
| 1979 | its tree-sitter grammar. Then it highlights the visited file | ||
| 1980 | according to the syntax defined by the grammar. | ||
| 1981 | |||
| 1982 | +++ | ||
| 1983 | *** Indirect buffers can have their own parser list. | ||
| 1984 | Before, indirect buffers share their base buffer’s parser list and | ||
| 1985 | parsers. Now they can have their own parser list. | ||
| 1986 | |||
| 1987 | +++ | ||
| 1988 | *** New variable 'treesit-language-remap-alist'. | ||
| 1989 | This variable allows a user to remap one language into another, such | ||
| 1990 | that creating a parser for language A actually creates a parser for | ||
| 1991 | language B. By extension, any font-lock rules or indentation rules for | ||
| 1992 | language A will be applied to language B instead. | ||
| 1993 | |||
| 1994 | This is useful for reusing font-lock rules and indentation rules of | ||
| 1995 | language A for language B, when language B is a strict superset of | ||
| 1996 | language A. | ||
| 1997 | |||
| 1998 | +++ | ||
| 1999 | *** New accessor functions for each setting in 'treesit-font-lock-settings'. | ||
| 2000 | Now users can access a setting's query, feature, enable flag, and | ||
| 2001 | override flag by 'treesit-font-lock-setting-query', | ||
| 2002 | 'treesit-font-lock-setting-feature', 'treesit-font-lock-setting-enable', | ||
| 2003 | and 'treesit-font-lock-setting-override'. | ||
| 2004 | |||
| 2005 | *** New tree-sitter thing 'list'. | ||
| 2006 | Unlike the existing thing 'sexp' that defines both lists and atoms, | ||
| 2007 | 'list' defines only lists to be navigated by 'forward-sexp'. | ||
| 2008 | The new function 'treesit-forward-sexp-list' uses 'list' | ||
| 2009 | to move across lists. But to move across atoms inside the list | ||
| 2010 | it uses 'forward-sexp-default-function'. | ||
| 2011 | |||
| 2012 | *** New tree-sitter based functions for moving by lists. | ||
| 2013 | If a major mode defines 'list' in 'treesit-thing-settings', | ||
| 2014 | tree-sitter setup for these modes sets 'forward-list-function' to | ||
| 2015 | 'treesit-forward-list', 'up-list-function' to 'treesit-up-list', and | ||
| 2016 | 'down-list-function' to 'treesit-down-list'. This enables the | ||
| 2017 | 'forward-list', 'up-list', and 'down-list' motion commands for those | ||
| 2018 | modes. | ||
| 2019 | |||
| 2020 | *** Tree-sitter enabled modes now properly support 'show-paren-mode'. | ||
| 2021 | They do that by letting 'show-paren-mode' use the results of parsing by | ||
| 2022 | the tree-sitter library. The new function 'treesit-show-paren-data' is | ||
| 2023 | used to communicate the tree-sitter parsing results to | ||
| 2024 | 'show-paren-mode'. | ||
| 2025 | |||
| 2026 | *** Tree-sitter enabled modes now properly support 'hs-minor-mode'. | ||
| 2027 | All commands from hideshow.el can selectively display blocks | ||
| 2028 | defined by the new tree-sitter thing 'list'. | ||
| 2029 | |||
| 2030 | *** New tree-sitter thing 'comment'. | ||
| 2031 | The new variable 'forward-comment-function' is set to the new function | ||
| 2032 | 'treesit-forward-comment' if a major mode defines the thing 'comment'. | ||
| 2033 | |||
| 2034 | +++ | ||
| 2035 | *** New function 'treesit-language-display-name'. | ||
| 2036 | This new function returns the display name of a language given the | ||
| 2037 | language symbol. For example, 'cpp' is translated to "C++". A new | ||
| 2038 | variable 'treesit-language-display-name-alist' holds the translations of | ||
| 2039 | language symbols where that translation is not trivial. | ||
| 2040 | |||
| 2041 | *** New function 'treesit-merge-font-lock-feature-list'. | ||
| 2042 | This function merges two tree-sitter font-lock feature lists. Returns a | ||
| 2043 | new font-lock feature list with no duplicates in the same level. It can | ||
| 2044 | be used to merge font-lock feature lists in a multi-language major mode. | ||
| 2045 | |||
| 2046 | *** New function 'treesit-replace-font-lock-feature-settings'. | ||
| 2047 | Given two tree-sitter font-lock settings, it replaces the feature in the | ||
| 2048 | second font-lock settings with the same feature in the first font-lock | ||
| 2049 | settings. In a multi-language major mode it is sometimes necessary to | ||
| 2050 | replace features from one of the major modes, with others that are | ||
| 2051 | better suited to the new multilingual context. | ||
| 2052 | |||
| 2053 | *** New function 'treesit-simple-indent-modify-rules'. | ||
| 2054 | Given two tree-sitter indent rules, it replaces, adds, or prepends rules | ||
| 2055 | in the old rules with new ones, then returns the modified rules. In a | ||
| 2056 | multi-language major mode it is sometimes necessary to modify rules from | ||
| 2057 | one of the major modes to better suit the new multilingual context. | ||
| 2058 | |||
| 2059 | +++ | ||
| 2060 | *** New variable 'treesit-aggregated-simple-imenu-settings'. | ||
| 2061 | This variable allows major modes to setup Imenu for multiple languages. | ||
| 2062 | |||
| 2063 | +++ | ||
| 2064 | *** New variable 'treesit-aggregated-outline-predicate'. | ||
| 2065 | This variable allows major modes to setup 'outline-minor-mode' | ||
| 2066 | for multiple languages. | ||
| 2067 | |||
| 2068 | *** New function 'treesit-simple-indent-add-rules'. | ||
| 2069 | This new function makes it easier to customize indent rules for | ||
| 2070 | tree-sitter modes. | ||
| 2071 | |||
| 2072 | *** New variable 'treesit-simple-indent-override-rules'. | ||
| 2073 | Users can customize this variable to add simple custom indentation rules | ||
| 2074 | for tree-sitter major modes. | ||
| 2075 | |||
| 2076 | +++ | ||
| 2077 | *** 'treesit-language-at-point-function' is now optional. | ||
| 2078 | Multi-language major modes can rely on the default return value from | ||
| 2079 | 'treesit-language-at' that uses the new function 'treesit-parsers-at'. | ||
| 2080 | |||
| 2081 | +++ | ||
| 2082 | *** New command 'treesit-explore'. | ||
| 2083 | This command replaces 'treesit-explore-mode'. It turns on | ||
| 2084 | 'treesit-explore-mode' if it is not on, and pops up the explorer buffer | ||
| 2085 | if it is already on. | ||
| 2086 | |||
| 2087 | +++ | ||
| 2088 | *** 'treesit-explore-mode' now supports local parsers. | ||
| 2089 | Now 'treesit-explore-mode' (or 'treesit-explore') prompts for a parser | ||
| 2090 | rather than a language, and it is now possible to select a local parser | ||
| 2091 | at point to explore. | ||
| 2092 | |||
| 2093 | +++ | 2091 | +++ |
| 2094 | ** New optional BUFFER argument for 'string-pixel-width'. | 2092 | ** New optional BUFFER argument for 'string-pixel-width'. |
| 2095 | If supplied, 'string-pixel-width' will use any face remappings from | 2093 | If supplied, 'string-pixel-width' will use any face remappings from |