GNU bug report logs -
#59763
29.0.60; Filling for c-ts-mode
Previous Next
Reported by: Yuan Fu <casouri <at> gmail.com>
Date: Fri, 2 Dec 2022 05:34:01 UTC
Severity: wishlist
Found in version 29.0.60
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
IMO For c-ts-mode to be usable we need to have at least a basic filling
function. Below is the function I have in my init.el, could someone have
a look and see if it’s good? Alternatively we could copy out the comment
and fill it in a temp buffer with c-mode, but I didn’t have the time to try
it out and see how well it works.
(defun ts-c-fill-paragraph (&optional arg)
(interactive)
(let* ((node (treesit-node-at (point)))
(start (treesit-node-start node))
(end (treesit-node-end node))
(pstart (save-excursion
(forward-paragraph -1)
(skip-syntax-forward "-")
(point)))
(pend (save-excursion
(forward-paragraph 1)
(point))))
(when (equal (treesit-node-type node) "comment")
(fill-region (max start pstart) (min end pend)))
t))
Yuan
This bug report was last modified 2 years and 134 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.