; 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:
parent
88ccf78b20
commit
b8009bbf2d
1 changed files with 7 additions and 6 deletions
|
@ -294,16 +294,17 @@ it adds an extra level, except for the top-level.
|
||||||
|
|
||||||
PARENT is NODE's parent."
|
PARENT is NODE's parent."
|
||||||
(let ((level 0))
|
(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
|
;; If point is on an empty line, NODE would be nil, but we pretend
|
||||||
;; there is a statement node.
|
;; there is a statement node.
|
||||||
(when (null node)
|
(when (null node)
|
||||||
(setq node t))
|
(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.
|
;; Go up the tree and compute indent level.
|
||||||
(while (if (eq node t)
|
(while (if (eq node t)
|
||||||
(setq node parent)
|
(setq node parent)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue