Giap Tran <[email protected]> writes:

>> This is usually some third-party package suppressing Org mode's tracking
>> of buffer changes. Any chance you can hunt for that?
>> If not, you can set `org-element--cache-self-verify' to 'backtrace. It
>> will give (much) more detailed log.
>
> Thank you for your fast feedback. 
>
> I followed your guide and found this issue comes from my custom function.  
> I replaced `org-babel--insert-results-keyword` with my function. In this
> function, I set `(inhibit-modification-hooks t)` to ignore continuing
> text properties (front-sticky (gptel))  (gptel response).
>
> Perhaps this affects some hooks in Org mode. If you have time, could you
> explain and give me some advice? Thank you very much.

I think I saw relevant discussion on gptel repo. Karthink suggested you
do use some other approach :)

As for Org mode side, Org keeps track of buffer modifications to
maintain cached parse tree. When something is changing things under the
feet, Org mode tracking of changes is no longer reliable, so you are
basically breaking Org parser by inhibiting modification hooks (not
really, but you are making the parser cache useless).

More generally, inhibit-modification-hooks should not be used
lightly. It was originally designed to suppress change trackers when you
simply want to apply/remove text properties - action that usually does
not affect anything. But inhibiting modification hooks when actual
changes are happening is dangerous practice. Almost like re-defining
built-in Emacs functions.

Meanwhile, there is nothing that needs to be done on Org side.
Canceled. (for the purposes of bug tracker; we can continue the thread)

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to