1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

; Fix error where we pass t to treesit-node-type in c-ts-common.el

* lisp/progmodes/c-ts-common.el:
(c-ts-common-statement-offset): Move the form that sets node to t
down, also add a check for node’s nullness.
This commit is contained in:
Yuan Fu 2023-02-02 14:42:42 -08:00
parent 88ccf78b20
commit b8009bbf2d
No known key found for this signature in database
GPG Key ID: 56E19BC57664A442

View File

@ -294,16 +294,17 @@ it adds an extra level, except for the top-level.
PARENT is NODE's parent."
(let ((level 0))
;; If NODE is a opening/closing bracket on its own line, take off
;; one level because the code below assumes NODE is a statement
;; _inside_ a {} block.
(when (and node
(string-match-p c-ts-common-indent-block-type-regexp
(treesit-node-type node)))
(cl-decf level))
;; If point is on an empty line, NODE would be nil, but we pretend
;; there is a statement node.
(when (null node)
(setq node t))
;; If NODE is a opening bracket on its own line, take off one
;; level because the code below assumes NODE is a statement
;; _inside_ a {} block.
(when (string-match-p c-ts-common-indent-block-type-regexp
(treesit-node-type node))
(cl-decf level))
;; Go up the tree and compute indent level.
(while (if (eq node t)
(setq node parent)