Re: [PATCH v4] emacs: add notmuch-address-post-completion-hook

Subject: Re: [PATCH v4] emacs: add notmuch-address-post-completion-hook

Date: Sun, 13 Nov 2016 14:39:16 +0200

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: Tomi Ollila


(Trying to send this w/o Mark in To: -- in the hope also Mark receive this
email to his gmail account...)

On Sun, Nov 13 2016, Mark Walters <markwalters1009@gmail.com> wrote:

> On Sat, 12 Nov 2016, David Bremner <david@tethera.net> wrote:
>> Tomi Ollila <tomi.ollila@iki.fi> writes:
>>
>>> Like someone (whose message I cannot find just now) mentioned in another
>>> thread, just now it is right time to mention here too...
>>>
>>> https://www.gnu.org/software/emacs/manual/html_node/elisp/Hooks.html
>>>
>>> ... that when hook name ends with `-hook` it is supposed to be "normal hook"
>>> -- a function which does not take arguments nor return values.
>>>
>>> So, I'd like to suggest that this variable is renamed to 
>>> notmuch-address-completion-functions
>>>
>>
>> Well, I guess the -functions convention should be followed, but
>> notmuch-address-completion-functions seems a bit vague.
>
> Maybe notmuch-address-post-completion-functions ?
>
> Alternatively maybe we can end in -hook-functions to indicate it is a
> function which is like a hook?

I found *-hook-functions format mystically familiar but could not found any
references in emacs 24.5 (nor now latest git) elisp source; there has been
loadhist-hook-functions and vc-backend-hook-functions in the source but
those have been removed/replaced later (w/o explanation why). otoh there
are plenty of *-hook-function references (which value seem to be expected to
be symbol to function). Then I recognized I have had such definitions in
my *own* elisp configuration files something like 25 years... ;) (copied
from someone in my early emacs days).

So, after more grepping it looks to me that this 
    notmuch-address-post-completion-functions
is pretty good suggestion.

(Grepping through elisp source distributed with emacs there are quite
a few lines like (run-hook-with-args '...-hook args..). it is easy to
end up being incompliant with the emacs convention. But other code
not being compliant is not good reason to do the same (and thanks to
Matt (in id:qf537j3hu4p.fsf@marmstrong-linux.kir.corp.google.com) for
rest of us to recognize this early enough))

BTW: I just noticed that the message subject said: 
emacs: add notmuch-address-post-completion-hook
but the currently used variable name lacked this -post- part
-- caused a bit of confusion of what/why am I suggesting here ;)

Tomi

>
> Best wishes
>
> Mark

Thread: