On Tue, May 23, 2017 at 4:57 AM, Bram Moolenaar
<[email protected]> wrote:
>
> Jacob Hayes wrote:
>
>> This is a stab at allowing users to add custom handlers for the
>> SIGUSR1 signal. My use case was automatically reloading the
>> configuration file in all open vim processes. I chose SIGUSR1 as it is
>> commonly used for custom handlers and, unlike SIGUSR2, doesn't appear
>> to have any known conflicts.
>>
>> The PR sets the SIGUSR1 signal as 'non-deadly' and attaches a handler
>> function that calls the vimscript function `SIGUSR1_handler`.
>>
>> Aside from general fitness for this in core vim, I'm unsure about a
>> few implementation details:
>> - The vimscript handler's name is defined in `os_unix.c` above the C
>> wrapper function. Does that better fit in a header file?
>> - Would it make sense to provide a default noop handler or is the
>> current "Unknown function" message suitable?
>>
>> I appreciate any feedback!
>
> This seems useful, but needs some tweaks to make it universally useful.
>
> Is there any equivalent on MS-Windows? Would be good to look into that
> before settling on the syntax for Vim script.
>
> When there is no SIGUSR1_handler function it should be a no-op, looks
> like with your patch it would report an error.
>

https://msdn.microsoft.com/en-us/library/xdkz3x12.aspx

Some signals are supported, but the one in question is not.

> What if there are two plugins that want to handle the signal? It's
> probably better to have a function to add a handler and another to
> remove it. So that there can be several at the same time.
> Or use autocommands, as Nikolai suggested.
>

In C/POSIX the last call to `signal()` sets the handling function. The
equivalent action might be using the last processed function name.

Setting it up so that the signal is an event that commands could
subscribe to is probably the better option, and seems to be what
autocommands do. If the change is added this way, please consider
supporting arbitrary signals.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui