[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#59763: 29.0.60; Filling for c-ts-mode
From: |
Yuan Fu |
Subject: |
bug#59763: 29.0.60; Filling for c-ts-mode |
Date: |
Thu, 1 Dec 2022 21:33:06 -0800 |
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
- bug#59763: 29.0.60; Filling for c-ts-mode,
Yuan Fu <=