summaryrefslogtreecommitdiff
path: root/lisp/progmodes/c-ts-mode.el
Commit message (Collapse)AuthorAgeFilesLines
...
* ; * lisp/progmodes/c-ts-mode.el (treesit-node-prev-sibling): Declare.Eli Zaretskii2023-02-271-0/+1
|
* Simplify c-ts-mode--top-level-label-matcherYuan Fu2023-02-261-9/+6
| | | | | | * lisp/progmodes/c-ts-mode.el: (c-ts-mode--top-level-label-matcher): Make more assumptions and remove the loop, so it's faster in large files.
* New tree-sitter indent anchor standalone-parent used by c-ts-modeYuan Fu2023-02-261-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When writing c-ts-mode Theo used parent-bol which works well except one case: 1 for (int i=0; 2 i < 5; 3 i++) { 4 func(i); 5 } In this case, when indenting "func(i)", parent-bol returns the start of "i++" on line 3, instead of the "correct" anchor, the start of "for" on line 1. parent-bol would have worked if the "for (...) {" part is in one line. To support this case I tried numerous things and added a bunch of stuff, culminating in c-ts-common-statement-offset. It's complicated, requires extra setup, and slow. Not anymore! I think the new anchor standalone-parent really captures the logic behind how people expect indentation to work. It's simple and fast, and requires no setup. * doc/lispref/modes.texi (Parser-based Indentation): Update manual. * lisp/progmodes/c-ts-mode.el: (c-ts-mode--standalone-grandparent): New anchor. (c-ts-mode--indent-styles): Replace c-ts-common-statement-offset with standalone-parent. (c-ts-base-mode): Add comment. * lisp/treesit.el: (treesit-simple-indent-presets): New anchor standalone-parent.
* Align to prev sibling for c-ts-mode indentationYuan Fu2023-02-241-11/+35
| | | | | | | | | | As requested by a discussion on emacs-devel. * lisp/progmodes/c-ts-mode.el: (c-ts-mode--anchor-prev-sibling): New function. (c-ts-mode--indent-styles): Indent first child as before, indent the rest to their previous sibling. Remove bracketless statement rules that I forgot to remove previously.
* Add more/finer faces for tree-sitterDmitry Gutov2023-02-251-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/modes.texi (Faces for Font Lock): Update the list of faces (bug#61655). * etc/NEWS: Update the list of new faces. * lisp/cus-theme.el (custom-theme--listed-faces): Update. * lisp/font-lock.el (font-lock-function-call-face) (font-lock-variable-ref-face, font-lock-property-ref-face): New faces. (font-lock-property-name-face): Rename from 'font-lock-property-face'. * lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): Use new faces. More 'enumerator' query to 'definition' feature. (c-ts-mode--fontify-declarator, c-ts-mode--fontify-variable): Use new faces. * lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode--font-lock-settings): Use new faces. * lisp/progmodes/csharp-mode.el (csharp-ts-mode--font-lock-settings): Use new faces. * lisp/progmodes/go-ts-mode.el (go-ts-mode--font-lock-settings): Use new faces. * lisp/progmodes/java-ts-mode.el (java-ts-mode--font-lock-settings): Use new faces. * lisp/progmodes/js.el (js--treesit-fontify-assignment-lhs) (js--treesit-font-lock-settings): Use new faces. Highlight variable definitions inside array and object destructuring patterns. * lisp/progmodes/python.el (python--treesit-variable-p): Exclude identifiers in parameters. (python--treesit-settings): Use new faces. Highlight function parameters. Move 'keyword' up to still highlight 'self' as keyword. * lisp/progmodes/ruby-ts-mode.el (ruby-ts--font-lock-settings): Use new faces. * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings): Use new faces. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--font-lock-settings): Use new faces. * lisp/textmodes/css-mode.el (css--treesit-settings): Use font-lock-property-ref-face. * lisp/textmodes/toml-ts-mode.el (toml-ts-mode--font-lock-settings): Use font-lock-property-ref-face. * lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode--font-lock-settings): Same.
* Add declaration_list to c-ts-common-indent-type-regexp-alistDaniel Martín2023-02-201-1/+2
| | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-base-mode): Consider a "declaration_list" a block. (Bug#61635) * test/lisp/progmodes/c-ts-mode-resources/indent.erts (Code): Add a test case.
* Cleanup preproc indent for c-ts-mode (bug#61558)Theodor Thornhill2023-02-191-5/+25
| | | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Make sure we indent to great-grand-parent if inside an #ifdef...#endif block. If grand-parent is root node, then don't indent one step. (c-ts-mode--preproc-offset): New helper anchor function to calculate indent offset.
* Add comment style toggle for c-ts-mode (bug#61550)Theodor Thornhill2023-02-191-1/+23
| | | | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode-toggle-comment-style): New command. (c-ts-base-mode-map): Add binding. (c-ts-mode-set-modeline): New function. (c-ts-mode): Set modeline. (c++-ts-mode): Set modeline.
* Add electric indent for preproc directivesTheodor Thornhill2023-02-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | It looks like there are few if no other cases where we get this particular error in the AST than with insertion of '#'. Consider: ``` int main() { | } ``` If we only add '#' the AST yields (ERROR (ERROR)), which we can exploit to hook onto electric indent. The end result should be the hashtag anchored to column 0. * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): New rule. (c-ts-base-mode): Add # to electric-indent-chars.
* Move block closer above declaration_list rule (bug#61531)Theodor Thornhill2023-02-151-4/+4
| | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Move rule above the previous rule.
* Minor improvements in c-ts-mode and docsEli Zaretskii2023-02-151-1/+2
| | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-base-mode-map): Add a binding for comment-region. * doc/emacs/programs.texi (C Indent): Mention "C-u TAB".
* ; * lisp/progmodes/c-ts-mode.el (c-ts-base-mode): delete duplicateMattias Engdegård2023-02-131-2/+1
|
* Fix indentation for closing bracket in c-ts-mode (bug#61398)Yuan Fu2023-02-121-3/+8
| | | | | | | * lisp/progmodes/c-ts-mode.el: (c-ts-mode--indent-styles): Move the rule earlier. (c-ts-base-mode): Add move block type. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: New tests.
* Fix c-ts-mode indentationYuan Fu2023-02-061-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sign, ok, there's another edge case: else if statements. Because "else if" is usually implemented as just another if statement nested in the else branch, this creates additional levels that indentation needs to ignore. I converted c-ts-common-indent-block-type-regexp + c-ts-common-indent-bracketless-type-regexp into a new, more flexible variable, c-ts-common-indent-type-regexp-alist, to avoid adding yet more variables in order to recognize else and if statements. * lisp/progmodes/c-ts-common.el: (c-ts-common-indent-type-regexp-alist): New variable. (c-ts-common-indent-block-type-regexp) (c-ts-common-indent-bracketless-type-regexp): Remove variables. (c-ts-common--node-is): New function. (c-ts-common-statement-offset): Use the new variable, and add the "else if" special case. Also merge the code of c-ts-mode--fix-bracketless-indent, because now the code is much more succinct. (c-ts-mode--fix-bracketless-indent): Merge into c-ts-common-statement-offset. * lisp/progmodes/c-ts-mode.el: (c-ts-base-mode): Setup c-ts-common-indent-type-regexp-alist. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test.
* Fix c-ts-mode indentationYuan Fu2023-02-061-0/+6
| | | | | | | | Turns out I shouldn't have removed the explicit rules. Anyway, now it indents properly. * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Add rules. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: Add tests
* Fix c-ts-mode indentation (bug#61291)Yuan Fu2023-02-061-0/+2
| | | | | | | | | | Fix indentation for the semicolon in while (str_a[i++] == str_b[j++]) ; * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): New rule. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test.
* Use c-ts-common-statement-offset in java-ts-mode (bug#61142)Theodor Thornhill2023-02-061-0/+7
| | | | | | | | | | | | | | | * lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules): Add new matchers to enable c-ts-common machinery. (java-ts-mode): Add regexps. * lisp/progmodes/c-ts-common.el (c-ts-common-statement-offset): Fix typo in documentation and use the new if statement helpers. (c-ts-common-if-statement-regexp): New defvar. (c-ts-common-nestable-if-statement-p): New defvar. (c-ts-common--fix-nestable-if-statement): New helper. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: Add test for complicated bracket matching indentation. * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Add indent rules for bracketless statements.
* c-ts-mode: Highlight "property functions" as functionsDmitry Gutov2023-02-061-1/+3
| | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): Highlight "property functions" as functions (bug#61302).
* Make highlighting more regular across TS modes (bug#61205)Dmitry Gutov2023-02-051-2/+2
| | | | | | | | | | | | | | | | | | | | | * doc/emacs/display.texi (Parser-based Font Lock): Update description of treesit-font-lock-level, moving 'property' to level 4. * lisp/treesit.el (treesit-font-lock-level): Likewise, in docstring. * lisp/progmodes/c-ts-mode.el (c-ts-base-mode): Do that here. * lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode): Add a comment. * lisp/progmodes/go-ts-mode.el (go-ts-mode): Add 'definition' to level 1. Move 'function', 'property' and 'variable' to level 4. (go-ts-mode--font-lock-settings): Move a bunch of existing rules to 'definition'. Add highlighting of function parameters. * lisp/progmodes/rust-ts-mode.el (rust-ts-mode) (rust-ts-mode--font-lock-settings): Same. And also change "scoped identifiers" highlights to only match capitalized names.
* Make c-ts-mode-set-style's effect local (bug#61245)Yuan Fu2023-02-041-12/+17
| | | | | | | | | | | | | | | | Now c-ts-mode-set-style's effect is local, and there is a new function c-ts-mode-set-global-style that changes the global setting. * lisp/progmodes/c-ts-mode.el: (c-ts-mode--indent-style-setter): Use c-ts-mode-set-style. (c-ts-mode-indent-style) (c-ts-mode--prompt-for-style): Minor change in docstring. (c-ts-mode-set-global-style): New function (from c-ts-mode-set-style). (c-ts-mode-set-local-style): Remove function (became c-ts-mode-set-style). (c-ts-mode-set-style): Renamed from c-ts-mode-set-local-style. * test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts: * test/lisp/progmodes/c-ts-mode-resources/indent.erts: Use c-ts-mode-set-style.
* c-ts-mode: Highlight name in parameter declarationsDmitry Gutov2023-02-041-7/+7
| | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): Uncomment parameter declaration highlighting (bug#61275). (c-ts-mode--fontify-declarator): Check that identifier was found. Some declarations can miss identifier name.
* Make c-ts-mode indent tests side-effect-freeYuan Fu2023-02-021-18/+26
| | | | | | | | | | | | | | | | | | Running indent tests changes the global value of c-ts-mode-indent-style. That's not good. This change fixes that. I also refactored the indent style functions a bit. * lisp/progmodes/c-ts-mode.el: (c-ts-mode--prompt-for-style): New function. (c-ts-mode-set-local-style): New function. (c-ts-mode-set-style): Use c-ts-mode--prompt-for-style. Use derived-mode-p when testing for major mode. Remove check of current buffer's major mode since it doesn't matter. * test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts: * test/lisp/progmodes/c-ts-mode-resources/indent.erts: Use c-ts-mode-set-local-style to set the indent style locally.
* Use c-ts-common-statement-offset for closing brackets tooYuan Fu2023-02-021-2/+6
| | | | | | | | | | | Merge c-ts-mode--close-bracket-offset into c-ts-common-statement-offset. * lisp/progmodes/c-ts-common.el: (c-ts-common-statement-offset): Handle closing brackets too. (c-ts-mode--close-bracket-offset): Remove function. * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Use c-ts-common-statement-offset for closing brackets.
* Change the default of 'treesit-defun-tactic' for 'c-ts-mode'Eli Zaretskii2023-02-021-0/+2
| | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode): Set 'treesit-defun-tactic' as appropriate for C. (Bug#61208)
* Fix keymap inheritance in descendants of 'c-ts-base-mode'Eli Zaretskii2023-01-301-3/+3
| | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-base-mode-map): Rename from 'c-ts-mode-map'. (c-ts-base-mode): Adjust accordingly. (Bug#60983)
* Document tree-sitter features in the user manualEli Zaretskii2023-01-291-1/+2
| | | | | | | | | | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode-map): Bind "C-c .", for consistency with CC mode. * lisp/treesit.el (treesit-font-lock-level): Doc fix. * doc/emacs/programs.texi (C Indent, Custom C Indent): Document the indentation features of 'c-ts-mode'. (Moving by Defuns): Document 'treesit-defun-tactic'. * doc/emacs/files.texi (Visiting): Document 'treesit-max-buffer-size'. * doc/emacs/display.texi (Traditional Font Lock) (Parser-based Font Lock): New subsections. * doc/emacs/emacs.texi (Top): Update top-level menu.
* Move c-ts-mode--statement-offset to c-ts-common.elYuan Fu2023-01-291-107/+18
| | | | | | | | | | | | | | | | | | | | | | | | | Now it can be used by other C-like languages. * lisp/progmodes/c-ts-common.el (c-ts-common-indent-offset): (c-ts-common-indent-block-type-regexp): (c-ts-common-indent-bracketless-type-regexp): New variables. (c-ts-common-statement-offset): (c-ts-mode--fix-bracketless-indent): (c-ts-mode--close-bracket-offset): New functions. * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Change c-ts-mode--statement-offset to c-ts-common-statement-offset. The (parent-is "if_statement") rules are now handled by (node-is "compound_statement"). (c-ts-mode--statement-offset-post-processr): (c-ts-mode--statement-offset): (c-ts-mode--fix-bracketless-indent): Move to c-ts-common.el. (c-ts-base-mode): Setup c-ts-common stuff. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: Make the test more challenging.
* ; Fix byte-compile warnings in c-ts-mode.elYuan Fu2023-01-291-9/+15
| | | | | | * lisp/progmodes/c-ts-mode.el: (c-ts-mode--get-indent-style): Move down. (c-ts-mode-set-style): Add docstring.
* ; Improve docstring of c-ts-mode--indent-style-setterYuan Fu2023-01-291-1/+4
| | | | | * lisp/progmodes/c-ts-mode.el: (c-ts-mode--indent-style-setter): Improve docstring.
* Add c-ts-mode-set-style and :set for c-ts-mode-indent-styleTheodor Thornhill2023-01-281-19/+48
| | | | | | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-style-setter): New setter for the indent style defcustom. (c-ts-mode-indent-style): Don't quote the values and refer to the setter. (c-ts-mode-set-style): New command to interactively set the indent style. (c-ts-mode--get-indent-style): New function renamed from 'c-ts-mode--set-indent-style'.
* ; Fix typosStefan Kangas2023-01-271-1/+1
|
* Fix indentation for c-ts-mode (bug#61026)Yuan Fu2023-01-251-1/+31
| | | | | | | | | | | | | | | | | | | Fix indentation for things like while (true) if (true) { puts ("Hello"); } Note that the outer while loop omits brackets. * lisp/progmodes/c-ts-mode.el: (c-ts-mode--statement-offset-post-processr): New variable. (c-ts-mode--statement-offset): Use the new function. (c-ts-mode--fix-bracketless-indent): New function. (c-ts-base-mode): Use the new function. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: New tests.
* Tweak BSD style indentation (bug#60984)Theodor Thornhill2023-01-221-0/+4
| | | | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Simplify rules. * test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts: New testfile with bsd style indentation examples. * test/lisp/progmodes/c-ts-mode-tests.el (c-ts-mode-test-indentation-bsd): Add a test for the new style.
* Fix typo of exposed symbol nameTheodor Thornhill2023-01-221-1/+1
| | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Remove double hyphen.
* Fix typo after move to common lib (bug#61001)Theodor Thornhill2023-01-221-1/+1
| | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Use correct preset.
* Move c-like common utils into own library (bug#60961)Theodor Thornhill2023-01-211-220/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/c-ts-common.el: New file. * lisp/progmodes/c-ts-mode.el (treesit-induce-sparse-tree): Remove unused declaration. (c-ts-mode--indent-styles): Refer to the new library. (c-ts-mode--looking-at-star, c-ts-mode--comment-start-after-first-star, c-ts-mode--comment-2nd-line-matcher, c-ts-mode--comment-2nd-line-anchor, c-ts-mode--comment-regexp, c-ts-mode--fill-paragraph, c-ts-mode--fill-block-comment): Move to c-ts-common and expose as public. (c-ts-mode-comment-setup): Move to c-ts-common. * lisp/progmodes/csharp-mode.el (c-ts-common): Require new library. (csharp-ts-mode--indent-rules): Refer to the new symbols. (csharp-ts-mode): Use new function. * lisp/progmodes/java-ts-mode.el (c-ts-common): Require new library. (java-ts-mode--indent-rules): Refer to the new symbols. (java-ts-mode): Use new function. * lisp/progmodes/js.el (c-ts-common): Require new library. (js--treesit-indent-rules): Refer to the new symbols. (js-ts-mode): Use new function. * lisp/progmodes/rust-ts-mode.el (c-ts-common): Require new library. (rust-ts-mode--indent-rules): Refer to the new symbols. (rust-ts-mode): Use new function. * lisp/progmodes/typescript-ts-mode.el (c-ts-common): Require new library. (typescript-ts-mode--indent-rules): Refer to the new symbols. (typescript-ts-base-mode): Use new function.
* Fix typo in c-ts-mode (bug#60932)Theodor Thornhill2023-01-211-1/+1
| | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode-indent-block-type-regexp): enumerator, not enumeratior.
* Use point-min to anchor top-level constructs (bug#60602)Theodor Thornhill2023-01-201-1/+1
| | | | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): New anchor. * lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules): New anchor. * lisp/progmodes/ruby-ts-mode.el (ruby-ts--indent-rules): New anchor. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--indent-rules): New anchor.
* Make tree-sitter based modes optionalEli Zaretskii2023-01-201-5/+45
| | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/c-ts-mode.el: Update Commentary. Make 'auto-mode-alist' update conditional on the tree-sitter and grammar libraries being available. * lisp/progmodes/cmake-ts-mode.el: * lisp/progmodes/csharp-mode.el: * lisp/progmodes/dockerfile-ts-mode.el: * lisp/progmodes/go-ts-mode.el: * lisp/progmodes/java-ts-mode.el: * lisp/progmodes/js.el: * lisp/progmodes/json-ts-mode.el: * lisp/progmodes/python.el: * lisp/progmodes/ruby-ts-mode.el: * lisp/progmodes/typescript-ts-mode.el: * lisp/textmodes/css-mode.el: * lisp/textmodes/toml-ts-mode.el: * lisp/textmodes/yaml-ts-mode.el: Make 'auto-mode-alist' update for tree-sitter based modes be conditional on the tree-sitter and grammar libraries being available. (Bug#60559)
* Fix c-ts-mode indent (bug#60873)Yuan Fu2023-01-191-1/+12
| | | | | | * lisp/progmodes/c-ts-mode.el: (c-ts-mode--statement-offset): Handle the edge case. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: Add a test.
* ; Add commentary and dostring in c-ts-modeYuan Fu2023-01-191-2/+48
| | | | | * lisp/progmodes/c-ts-mode.el: Add commentary. (c-ts-mode, c++-ts-mode): Add docstring.
* Revert "Revert "Add c-or-c++-ts-mode (bug#59613)""Yuan Fu2023-01-171-0/+44
| | | | | | | This reverts commit d46f7f4edcce14e6cbd8e2d7091dbabbe08defc1. Aaaactually, we need this, otherwise we can't use tree-sitter based C mode for header files.
* Fix c-ts-mode block comment indentation (bug#60270)Yuan Fu2023-01-151-4/+14
| | | | | * lisp/progmodes/c-ts-mode.el: (c-ts-mode--comment-2nd-line-anchor): Handle another edge case.
* Fix c-ts-mode label indentYuan Fu2023-01-151-3/+7
| | | | | | | Fix indentation of the statement right under a label. * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Fix. (c-ts-mode--top-level-label-matcher): Fix.
* Fix statement indent for c-ts-mode (bug#59686) (bug#60280)Yuan Fu2023-01-151-18/+54
| | | | | | | | | | | | | Instead of trying to figure out the correct anchor, now we just count the layers of {} blocks between the node and the root node. * lisp/progmodes/c-ts-mode.el: (c-ts-mode--indent-styles): Use new offset functions c-ts-mode--close-bracket-offset and c-ts-mode--statement-offset. (c-ts-mode--bracket-children-anchor): Remove function. (c-ts-mode--top-level-label-matcher): New variable. (c-ts-mode--statement-offset) (c-ts-mode--close-bracket-offset): New offset functions.
* ; Minor change in c-ts-mode--indent-stylesYuan Fu2023-01-151-1/+1
| | | | | ; * lisp/progmodes/c-ts-mode.el: (c-ts-mode--indent-styles): Move top-level label rule to GNU style.
* Support filling line comments in c-ts-modeYuan Fu2023-01-151-61/+71
| | | | | | | | | | | | Now we handle line comments separately because for line comments, each line is an individual node, unlike block comments, where the whole block comment is a single node. fill-comment-paragraph turns out to do the job perfectly fine. * lisp/progmodes/c-ts-mode.el: (c-ts-mode--fill-paragraph): Extract out most parts into c-ts-mode--fill-block-comment. (c-ts-mode--fill-block-comment): New extracted function.
* ; Fix c-ts-mode fillingYuan Fu2023-01-151-5/+10
| | | | | | | * lisp/progmodes/c-ts-mode.el: (c-ts-mode--comment-regexp): New variable. (c-ts-mode--fill-paragraph): Use the new variable, and make sure start-marker is always initialized.
* Fix c-ts-mode--fill-paragraphYuan Fu2023-01-131-1/+4
| | | | | | | | | | | Example: doc: /* Return non-nil if NODE1 and NODE2 are the same node. If any one of NODE1 and NODE2 is nil, return nil. This function uses the same equivalence metric as `equal'. */ * lisp/progmodes/c-ts-mode.el (c-ts-mode--fill-paragraph): Fix the case where there are words before the /*, like the example above.
* Fix c-ts-mode comment indentation (bug#60270)Yuan Fu2023-01-121-2/+4
| | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Move the star rule up.