From: Ihor Radchenko <yantar92@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
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 [thread overview]
Message-ID: <87cznzddf1.fsf@localhost> (raw)
In-Reply-To: <jwvlf2p3xvf.fsf-monnier+emacs@gnu.org>
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.
Best,
Ihor
prev parent reply other threads:[~2021-10-20 13:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20211019125722.17993.60001@vcs0.savannah.gnu.org>
[not found] ` <20211019125725.EA9CF209AA@vcs0.savannah.gnu.org>
2021-10-19 13:14 ` [elpa] externals/org 46da64c 4/6: org-persist.el: Fix `add-hook' priority argument Stefan Monnier
2021-10-19 13:50 ` Ihor Radchenko
2021-10-19 14:16 ` Stefan Monnier
2021-10-20 13:38 ` Ihor Radchenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87cznzddf1.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.