mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2026-09-12 16:56:36 -04:00
Fix c-ts-common baseline indentation rule (bug#81735)
* lisp/treesit.el (treesit--indent-prev-line-node): Now skip over empty lines to find the previous sibling.
This commit is contained in:
parent
84e2bb9a5d
commit
d46cc7dda1
|
|
@ -2403,10 +2403,13 @@ This variable should take the same form as
|
|||
over `treesit-simple-indent-rules'.")
|
||||
|
||||
(defun treesit--indent-prev-line-node (pos)
|
||||
"Return the largest node on the previous line of POS."
|
||||
"Return the largest node on the previous (non-empty) line of POS."
|
||||
(save-excursion
|
||||
(goto-char pos)
|
||||
(when (eq (forward-line -1) 0)
|
||||
;; Skip blank lines.
|
||||
(while (and (looking-at-p (rx (* (syntax whitespace)) eol))
|
||||
(eq (forward-line -1) 0)))
|
||||
(back-to-indentation)
|
||||
(treesit--indent-largest-node-at (point)))))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue