all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [elpa] externals/org 46da64c 4/6: org-persist.el: Fix `add-hook' priority argument
Date: Tue, 19 Oct 2021 09:14:40 -0400	[thread overview]
Message-ID: <jwvee8h5fjy.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20211019125725.EA9CF209AA@vcs0.savannah.gnu.org> (ELPA Syncer's message of "Tue, 19 Oct 2021 08:57:25 -0400 (EDT)")

Hi Ihor,

>     org-persist.el: Fix `add-hook' priority argument
> ---
>  lisp/org-persist.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/org-persist.el b/lisp/org-persist.el
> index 9885386..e518974 100644
> --- a/lisp/org-persist.el
> +++ b/lisp/org-persist.el
> @@ -278,7 +278,7 @@ When BUFFER is `all', unregister VAR in all buffers."
>      (setq org-persist--index (nreverse new-index))))
>  
>  (add-hook 'kill-emacs-hook #'org-persist-gc)
> -(add-hook 'kill-emacs-hook #'org-persist-write-all 1000)
> +(add-hook 'kill-emacs-hook #'org-persist-write-all 100)

The docstring also says:

    Since nothing is \"always\" true, don't use 100 nor -100.

100 means that nothing will *ever* want to come later.  I.e. you claim
to be the one and only function that will ever deserve to always be the
last one on this hook, which is rather presumptuous, I think.

AFAICT the only thing that actually matters is that it should come after
`org-persist-gc`, so even just 0.01 would be good enough.  No need to
get anywhere near 100 (tho it would make sense to leave room for other
hooks that might need to come between `org-persist-gc` and
`org-persist-write-all`).  Also, I'd recommend you add a comment
explaining the constraints that were considered when choosing this depth
(e.g "Make sure it comes after `org-persist-gc`").


        Stefan




       reply	other threads:[~2021-10-19 13:14 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   ` Stefan Monnier [this message]
2021-10-19 13:50     ` [elpa] externals/org 46da64c 4/6: org-persist.el: Fix `add-hook' priority argument Ihor Radchenko
2021-10-19 14:16       ` Stefan Monnier
2021-10-20 13:38         ` Ihor Radchenko

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=jwvee8h5fjy.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=yantar92@gmail.com \
    /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.