[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Weechat-dev] description about hook_process in WeeChat plugin API r
Re: [Weechat-dev] description about hook_process in WeeChat plugin API reference
Sun, 24 Apr 2016 14:26:52 +0900
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)
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
> 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 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.
 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.
AYANOKOUZI, Ryuunosuke <address@hidden>
Description: Binary data
Description: OpenPGP Digital Signature