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