[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: Stefan Monnier
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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`").


reply via email to

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