aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/c-ts-mode.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index c815ee35501..9bbb78e0862 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -973,9 +973,14 @@ Return nil if NODE is not a defun node or doesn't have a name."
973 973
974(defun c-ts-mode--outline-predicate (node) 974(defun c-ts-mode--outline-predicate (node)
975 "Match outlines on lines with function names." 975 "Match outlines on lines with function names."
976 (or (and (equal (treesit-node-type node) "function_declarator") 976 (or (when-let* ((decl (treesit-node-child-by-field-name
977 (equal (treesit-node-type (treesit-node-parent node)) 977 (treesit-node-parent node) "declarator"))
978 "function_definition")) 978 (node-pos (treesit-node-start node))
979 (decl-pos (treesit-node-start decl))
980 (eol (save-excursion (goto-char node-pos) (line-end-position))))
981 (and (equal (treesit-node-type decl) "function_declarator")
982 (<= node-pos decl-pos)
983 (< decl-pos eol)))
979 ;; DEFUNs in Emacs sources. 984 ;; DEFUNs in Emacs sources.
980 (and c-ts-mode-emacs-sources-support 985 (and c-ts-mode-emacs-sources-support
981 (c-ts-mode--emacs-defun-p node)))) 986 (c-ts-mode--emacs-defun-p node))))