diff options
author | Yuan Fu <casouri@gmail.com> | 2022-12-23 17:12:32 -0800 |
---|---|---|
committer | Yuan Fu <casouri@gmail.com> | 2022-12-24 00:33:17 -0800 |
commit | 6a43af58802d46555d692d0934d85d22711e0b56 (patch) | |
tree | e10719c3f2697211c84abbbcfe1e759e5e4a65c8 /doc/lispref/modes.texi | |
parent | e492c21e81040b9539139b78f6baf98df17bbaab (diff) | |
download | emacs-6a43af58802d46555d692d0934d85d22711e0b56.tar.gz |
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.
Diffstat (limited to 'doc/lispref/modes.texi')
-rw-r--r-- | doc/lispref/modes.texi | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index c44938f3929..736c2d6841f 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -5024,6 +5024,14 @@ comment-start token. Comment-start tokens are defined by regular expression @code{comment-start-skip}. This function assumes @var{parent} is the comment node. +@item prev-adaptive-prefix +This anchor is a function that is called with 3 arguments: @var{node}, +@var{parent}, and @var{bol}. It tries to go to the beginning of the +previous non-empty line, and matches @code{adaptive-fill-regexp}. If +there is a match, this function returns the end of the match, +otherwise it returns nil. This anchor is useful for a +@code{indent-relative}-like indent behavior for block comments. + @end ftable @end defvar |