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. ** Tree-sitter +*** The file treesit-x.el defines a number of simple tree-sitter modes. +Using the new macro 'define-treesit-generic-mode', generic modes are +defined including, but not limited to, 'gitattributes-generic-ts-mode'. +Visiting a file in such mode asks for confirmation before installing +its tree-sitter grammar. Then it highlights the visited file +according to the syntax defined by the grammar. + *** New command 'treesit-cycle-sexp-type'. It cycles the type of navigation for commands that move across sexp's and lists, such as 'treesit-forward-sexp', 'treesit-forward-list', @@ -556,6 +563,117 @@ symbols and using the thing 'list' for lists. With the 'sexp' type these commands move across nodes defined by the tree-sitter thing 'sexp' in 'treesit-thing-settings'. ++++ +*** Indirect buffers can have their own parser list. +Before, indirect buffers share their base buffer’s parser list and +parsers. Now they can have their own parser list. + ++++ +*** New variable 'treesit-language-remap-alist'. +This variable allows a user to remap one language into another, such +that creating a parser for language A actually creates a parser for +language B. By extension, any font-lock rules or indentation rules for +language A will be applied to language B instead. + +This is useful for reusing font-lock rules and indentation rules of +language A for language B, when language B is a strict superset of +language A. + ++++ +*** New accessor functions for each setting in 'treesit-font-lock-settings'. +Now users can access a setting's query, feature, enable flag, and +override flag by 'treesit-font-lock-setting-query', +'treesit-font-lock-setting-feature', 'treesit-font-lock-setting-enable', +and 'treesit-font-lock-setting-override'. + +*** New tree-sitter thing 'list'. +Unlike the existing thing 'sexp' that defines both lists and atoms, +'list' defines only lists to be navigated by 'forward-sexp'. +The new function 'treesit-forward-sexp-list' uses 'list' +to move across lists. But to move across atoms inside the list +it uses 'forward-sexp-default-function'. + +*** New tree-sitter based functions for moving by lists. +If a major mode defines 'list' in 'treesit-thing-settings', +tree-sitter setup for these modes sets 'forward-list-function' to +'treesit-forward-list', 'up-list-function' to 'treesit-up-list', and +'down-list-function' to 'treesit-down-list'. This enables the +'forward-list', 'up-list', and 'down-list' motion commands for those +modes. + +*** Tree-sitter enabled modes now properly support 'show-paren-mode'. +They do that by letting 'show-paren-mode' use the results of parsing by +the tree-sitter library. The new function 'treesit-show-paren-data' is +used to communicate the tree-sitter parsing results to +'show-paren-mode'. + +*** Tree-sitter enabled modes now properly support 'hs-minor-mode'. +All commands from hideshow.el can selectively display blocks +defined by the new tree-sitter thing 'list'. + +*** New tree-sitter thing 'comment'. +The new variable 'forward-comment-function' is set to the new function +'treesit-forward-comment' if a major mode defines the thing 'comment'. + ++++ +*** New function 'treesit-language-display-name'. +This new function returns the display name of a language given the +language symbol. For example, 'cpp' is translated to "C++". A new +variable 'treesit-language-display-name-alist' holds the translations of +language symbols where that translation is not trivial. + +*** New function 'treesit-merge-font-lock-feature-list'. +This function merges two tree-sitter font-lock feature lists. Returns a +new font-lock feature list with no duplicates in the same level. It can +be used to merge font-lock feature lists in a multi-language major mode. + +*** New function 'treesit-replace-font-lock-feature-settings'. +Given two tree-sitter font-lock settings, it replaces the feature in the +second font-lock settings with the same feature in the first font-lock +settings. In a multi-language major mode it is sometimes necessary to +replace features from one of the major modes, with others that are +better suited to the new multilingual context. + +*** New function 'treesit-simple-indent-modify-rules'. +Given two tree-sitter indent rules, it replaces, adds, or prepends rules +in the old rules with new ones, then returns the modified rules. In a +multi-language major mode it is sometimes necessary to modify rules from +one of the major modes to better suit the new multilingual context. + ++++ +*** New variable 'treesit-aggregated-simple-imenu-settings'. +This variable allows major modes to setup Imenu for multiple languages. + ++++ +*** New variable 'treesit-aggregated-outline-predicate'. +This variable allows major modes to setup 'outline-minor-mode' +for multiple languages. + +*** New function 'treesit-simple-indent-add-rules'. +This new function makes it easier to customize indent rules for +tree-sitter modes. + +*** New variable 'treesit-simple-indent-override-rules'. +Users can customize this variable to add simple custom indentation rules +for tree-sitter major modes. + ++++ +*** 'treesit-language-at-point-function' is now optional. +Multi-language major modes can rely on the default return value from +'treesit-language-at' that uses the new function 'treesit-parsers-at'. + ++++ +*** New command 'treesit-explore'. +This command replaces 'treesit-explore-mode'. It turns on +'treesit-explore-mode' if it is not on, and pops up the explorer buffer +if it is already on. + ++++ +*** 'treesit-explore-mode' now supports local parsers. +Now 'treesit-explore-mode' (or 'treesit-explore') prompts for a parser +rather than a language, and it is now possible to select a local parser +at point to explore. + ** Text mode --- @@ -1970,126 +2088,6 @@ authorize the invoked D-Bus method (for example via polkit). ** The customization group 'wp' has been removed. It has been obsolete since Emacs 26.1. Use the group 'text' instead. -** Changes in tree-sitter modes - -*** The file treesit-x.el defines a number of simple tree-sitter modes. -Using the new macro 'define-treesit-generic-mode', generic modes are -defined including, but not limited to, 'gitattributes-generic-ts-mode'. -Visiting a file in such mode asks for confirmation before installing -its tree-sitter grammar. Then it highlights the visited file -according to the syntax defined by the grammar. - -+++ -*** Indirect buffers can have their own parser list. -Before, indirect buffers share their base buffer’s parser list and -parsers. Now they can have their own parser list. - -+++ -*** New variable 'treesit-language-remap-alist'. -This variable allows a user to remap one language into another, such -that creating a parser for language A actually creates a parser for -language B. By extension, any font-lock rules or indentation rules for -language A will be applied to language B instead. - -This is useful for reusing font-lock rules and indentation rules of -language A for language B, when language B is a strict superset of -language A. - -+++ -*** New accessor functions for each setting in 'treesit-font-lock-settings'. -Now users can access a setting's query, feature, enable flag, and -override flag by 'treesit-font-lock-setting-query', -'treesit-font-lock-setting-feature', 'treesit-font-lock-setting-enable', -and 'treesit-font-lock-setting-override'. - -*** New tree-sitter thing 'list'. -Unlike the existing thing 'sexp' that defines both lists and atoms, -'list' defines only lists to be navigated by 'forward-sexp'. -The new function 'treesit-forward-sexp-list' uses 'list' -to move across lists. But to move across atoms inside the list -it uses 'forward-sexp-default-function'. - -*** New tree-sitter based functions for moving by lists. -If a major mode defines 'list' in 'treesit-thing-settings', -tree-sitter setup for these modes sets 'forward-list-function' to -'treesit-forward-list', 'up-list-function' to 'treesit-up-list', and -'down-list-function' to 'treesit-down-list'. This enables the -'forward-list', 'up-list', and 'down-list' motion commands for those -modes. - -*** Tree-sitter enabled modes now properly support 'show-paren-mode'. -They do that by letting 'show-paren-mode' use the results of parsing by -the tree-sitter library. The new function 'treesit-show-paren-data' is -used to communicate the tree-sitter parsing results to -'show-paren-mode'. - -*** Tree-sitter enabled modes now properly support 'hs-minor-mode'. -All commands from hideshow.el can selectively display blocks -defined by the new tree-sitter thing 'list'. - -*** New tree-sitter thing 'comment'. -The new variable 'forward-comment-function' is set to the new function -'treesit-forward-comment' if a major mode defines the thing 'comment'. - -+++ -*** New function 'treesit-language-display-name'. -This new function returns the display name of a language given the -language symbol. For example, 'cpp' is translated to "C++". A new -variable 'treesit-language-display-name-alist' holds the translations of -language symbols where that translation is not trivial. - -*** New function 'treesit-merge-font-lock-feature-list'. -This function merges two tree-sitter font-lock feature lists. Returns a -new font-lock feature list with no duplicates in the same level. It can -be used to merge font-lock feature lists in a multi-language major mode. - -*** New function 'treesit-replace-font-lock-feature-settings'. -Given two tree-sitter font-lock settings, it replaces the feature in the -second font-lock settings with the same feature in the first font-lock -settings. In a multi-language major mode it is sometimes necessary to -replace features from one of the major modes, with others that are -better suited to the new multilingual context. - -*** New function 'treesit-simple-indent-modify-rules'. -Given two tree-sitter indent rules, it replaces, adds, or prepends rules -in the old rules with new ones, then returns the modified rules. In a -multi-language major mode it is sometimes necessary to modify rules from -one of the major modes to better suit the new multilingual context. - -+++ -*** New variable 'treesit-aggregated-simple-imenu-settings'. -This variable allows major modes to setup Imenu for multiple languages. - -+++ -*** New variable 'treesit-aggregated-outline-predicate'. -This variable allows major modes to setup 'outline-minor-mode' -for multiple languages. - -*** New function 'treesit-simple-indent-add-rules'. -This new function makes it easier to customize indent rules for -tree-sitter modes. - -*** New variable 'treesit-simple-indent-override-rules'. -Users can customize this variable to add simple custom indentation rules -for tree-sitter major modes. - -+++ -*** 'treesit-language-at-point-function' is now optional. -Multi-language major modes can rely on the default return value from -'treesit-language-at' that uses the new function 'treesit-parsers-at'. - -+++ -*** New command 'treesit-explore'. -This command replaces 'treesit-explore-mode'. It turns on -'treesit-explore-mode' if it is not on, and pops up the explorer buffer -if it is already on. - -+++ -*** 'treesit-explore-mode' now supports local parsers. -Now 'treesit-explore-mode' (or 'treesit-explore') prompts for a parser -rather than a language, and it is now possible to select a local parser -at point to explore. - +++ ** New optional BUFFER argument for 'string-pixel-width'. If supplied, 'string-pixel-width' will use any face remappings from