[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [elpa] externals/org 46da64c 4/6: org-persist.el: Fix `add-hook' pri

From: Ihor Radchenko
Subject: Re: [elpa] externals/org 46da64c 4/6: org-persist.el: Fix `add-hook' priority argument
Date: Wed, 20 Oct 2021 21:38:26 +0800

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> The idea behind 100 is related to Org usage.  We save buffer-local
>> `org-element--cache' to files.  It needs to be done _after_ all the
>> possible changes in Org buffers are made.  If any hook changes an Org
>> buffer after `org-persist-write-all', the saved value will become
>> invalid.  I am not sure what can be a reasonable DEPTH value in such
>> case.  Can it be something like 1?  Looking through Emacs code base, I
>> can mostly see non-nil values as DEPTH argument.  So, maybe 90? 91?
> The value should be chosen in accordance with other possibly
> interfering functions.
> IOW you need for the functions to agree on a numbering-convention.
> Since there is no such convention yet for your functions, you get to
> define it.
> So you can chose, for example 42 and from then on all function that need
> to come before `org-persist-write-all` simply have to refrain from
> using a value higher than 42.

Thanks for the clarification.

After more thinking and reading the manual, I have found that
kill-emacs-hook and kill-buffer-hook generally run after the buffer is
saved. So, I do not need to worry about something outside Org changing
the file contents. Depth 0 is good enough given that I put add-hook
calls in correct order.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]