[Top][All Lists]

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

Re: [Weechat-dev] description about hook_process in WeeChat plugin API r

From: AYANOKOUZI, Ryuunosuke
Subject: Re: [Weechat-dev] description about hook_process in WeeChat plugin API reference
Date: Sun, 24 Apr 2016 14:26:52 +0900
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (Gojō) APEL/10.8 EasyPG/1.0.0 Emacs/24.4 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

Dear Sébastien,

Thanks for your prompt response.

At Sat, 23 Apr 2016 20:56:55 +0200,
Sébastien Helleu wrote:
> On Sun, Apr 24, 2016 at 02:29:20AM +0900, AYANOKOUZI, Ryuunosuke wrote:
> >
> > I have a question about C and Script (Python) API for 'hook_process'.
> >
> > 1. For C API case, If 'const char *command' is set "func:get_status",
> >    function 'get_status' is NEVER called by both parent and child process.
> > 2. For Python API case, If 'command' is set "func:get_status",
> >    function 'get_status' IS called by child process.
> > Is my understanding correct?
> >
> Yes, in C API, the callback (of hook_process) is called in the child process,
> and then this callback can do anything with the command received (which is
> "func:name"). So the function name is not really used (the callback can use it
> if needed).
> The behavior is different in scripting API, the callback is called too, and 
> this
> callback runs the function after "func:", so the callback is called only one
> time in script, after the call to function in child.

OK, I understand.

In that behavior,
explicitly specifying function name like "func:get_status" in C example
may drive people to expect that the function 'get_status' is called.
Just "func:" is better I think.

And the following sentence[1] may also drive people to expect that
the function "name" is executed independently from the code of callback
even for C API case.
I think the expression of a paragraph with the sentence should be reconsidered.

[1] The command can also be a function name with format:
    "func:name", to execute the function "name" (WeeChat ≥ 1.5).

Making difference between C API and scripting API clear,
It would be nice if explanation of the behavior of
forking process, executing function, and calling callback is mentioned.

I attached a patch for quick fix,
I would appreciate if you review and, if possible, commit it to your repository.

I am awaiting for your reply.

Sincerely yours,
Ryuunosuke Ayanokouzi
AYANOKOUZI, Ryuunosuke <address@hidden>

Attachment: 0002-doc-update-description-of-functions-in-hook_process.patch
Description: Binary data

Attachment: pgpKEhJ7fLi68.pgp
Description: OpenPGP Digital Signature

reply via email to

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