GNU bug report logs -
#78402
treesit after-change-functions
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Tue, 13 May 2025 06:34:02 UTC
Severity: normal
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #14 received at 78402 <at> debbugs.gnu.org (full text, mbox):
> Btw, what’s the issue we’re trying to fix here? If some lisp want to have
> up-to-date ranges, it can just call treesit--pre-redisplay or
> treesit-update-ranges. Why do we get the node-outdated error?
Hmm... so what you're saying is that we should do something like the
patch below?
Stefan
diff --git a/lisp/treesit.el b/lisp/treesit.el
index a353bc942d3..0c368de6a03 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -4050,6 +4050,9 @@ treesit-outline-search
"Search for the next outline heading in the syntax tree.
For BOUND, MOVE, BACKWARD, LOOKING-AT, see the descriptions in
`outline-search-function'."
+ (if backward
+ (treesit-update-ranges bound (point))
+ (treesit-update-ranges (point) bound))
(if looking-at
(when (treesit-outline--at-point) (pos-bol))
@@ -4136,11 +4139,6 @@ treesit-outline-level
level))
-(defun treesit--after-change (beg end _len)
- "Force updating the ranges in BEG...END.
-Expected to be called after each text change."
- (treesit-update-ranges beg end))
-
;;; Hideshow mode
(defun treesit-hs-block-end ()
@@ -4438,8 +4436,7 @@ treesit-major-mode-setup
(setq treesit-outline-predicate
#'treesit-outline-predicate--from-imenu))
(setq-local outline-search-function #'treesit-outline-search
- outline-level #'treesit-outline-level)
- (add-hook 'outline-after-change-functions #'treesit--after-change nil t))
+ outline-level #'treesit-outline-level))
;; Remove existing local parsers.
(dolist (ov (overlays-in (point-min) (point-max)))
This bug report was last modified today.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.