diff options
| author | Yuan Fu | 2024-11-29 16:33:28 -0800 |
|---|---|---|
| committer | Yuan Fu | 2024-12-01 11:35:06 -0800 |
| commit | 3c7687c1dd136fa535e22262f78fdfadbbf73105 (patch) | |
| tree | 50a278a6d33b4cc42b6f0fbe9f0230faa1f4263b | |
| parent | 748b19e56e87fab44cb5474613502f8e96064a46 (diff) | |
| download | emacs-3c7687c1dd136fa535e22262f78fdfadbbf73105.tar.gz emacs-3c7687c1dd136fa535e22262f78fdfadbbf73105.zip | |
Allow passing nil to treesit-node-match-p (bug#74612)
* src/treesit.c (Ftreesit_node_match_p): Return nil if NODE is nil.
| -rw-r--r-- | src/treesit.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/treesit.c b/src/treesit.c index 4031d80f7c9..cda6d4af2ee 100644 --- a/src/treesit.c +++ b/src/treesit.c | |||
| @@ -4017,7 +4017,8 @@ PREDICATE can be a symbol representing a thing in | |||
| 4017 | `treesit-thing-settings', or a predicate, like regexp matching node | 4017 | `treesit-thing-settings', or a predicate, like regexp matching node |
| 4018 | type, etc. See `treesit-thing-settings' for more details. | 4018 | type, etc. See `treesit-thing-settings' for more details. |
| 4019 | 4019 | ||
| 4020 | Return non-nil if NODE matches PREDICATE, nil otherwise. | 4020 | Return non-nil if NODE matches PREDICATE, nil otherwise. If NODE is |
| 4021 | nil, return nil. | ||
| 4021 | 4022 | ||
| 4022 | Signals `treesit-invalid-predicate' if there's no definition of THING | 4023 | Signals `treesit-invalid-predicate' if there's no definition of THING |
| 4023 | in `treesit-thing-settings', or if PREDICATE is malformed. If | 4024 | in `treesit-thing-settings', or if PREDICATE is malformed. If |
| @@ -4025,6 +4026,8 @@ IGNORE-MISSING is non-nil, don't signal an error for missing THING | |||
| 4025 | definition, but still signal for malformed PREDICATE. */) | 4026 | definition, but still signal for malformed PREDICATE. */) |
| 4026 | (Lisp_Object node, Lisp_Object predicate, Lisp_Object ignore_missing) | 4027 | (Lisp_Object node, Lisp_Object predicate, Lisp_Object ignore_missing) |
| 4027 | { | 4028 | { |
| 4029 | if (NILP (node)) return Qnil; | ||
| 4030 | |||
| 4028 | CHECK_TS_NODE (node); | 4031 | CHECK_TS_NODE (node); |
| 4029 | 4032 | ||
| 4030 | Lisp_Object parser = XTS_NODE (node)->parser; | 4033 | Lisp_Object parser = XTS_NODE (node)->parser; |