GNU bug report logs - #77256
Treesit language-at-point

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Tue, 25 Mar 2025 18:44:02 UTC

Severity: normal

Fixed in version 31.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #26 received at 77256 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 77256 <at> debbugs.gnu.org, Vincenzo Pupillo <v.pupillo <at> gmail.com>
Subject: Re: bug#77256: Treesit language-at-point
Date: Sat, 05 Apr 2025 21:35:54 +0300
> Unfortunately, I discovered that it causes treesit-node-outdated errors.
>
> This is because overlays are updated by 'pre-redisplay-functions'
> later than outline-minor-mode uses them by 'after-change-functions',
> since 'after-change-functions' runs before 'pre-redisplay-functions'.

This fixes the problem:

   (defun outline--fix-buttons-after-change (beg end _len)
  +  (when (fboundp 'treesit-update-ranges)
  +    (treesit-update-ranges beg end))
     ;; Handle whole lines
     (save-excursion (goto-char beg) (setq beg (pos-bol)))
     (save-excursion (goto-char end) (setq end (pos-eol)))

But can we do better?  I see that 'treesit-major-mode-setup'
adds the notifier

      (treesit-parser-add-notifier
       treesit-primary-parser #'treesit--font-lock-mark-ranges-to-fontify)

to 'after_change_functions'.  But why the treesit
'after_change_functions' notifier is called after the
'after-change-functions' hook?  Can we change their order?




This bug report was last modified 91 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.