bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#19547: Patch for this bug


From: npostavs
Subject: bug#19547: Patch for this bug
Date: Sun, 27 Nov 2016 13:42:34 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>> In addition to using 'break', you need to initialize ignore_event with
>> some value, otherwise it will hold garbage, which could accidentally
>> be one of the values you want to filter.  Alternatively, add a
>> 'default' case to the switch.
>
> Is Qnil ok as default value ?
>
>> I'd suggest to use Flist instead, it should be closer to Lisp (if you
>> want to do this from C).
>
> Didn't succeed with Flist:
>
> keyboard.c:11842:5: error: too many arguments to function ‘Flist’
>      = Flist (Qfocus_in, Qfocus_out, Qhelp, Qiconify, Qdeiconify, 
> Qselection_request)
>      ^

You have to use CALLN for functions taking a non-fixed amount of arguments:

    CALLN (Flist, Qfocus_in, Qfocus_out, Qhelp, Qiconify, Qdeiconify, 
Qselection_request);

>
>>> I wondered also if instead the variable could be feeded from lisp as
>>> suggested by Eli, but I don't know yet where is the good place for this
>>> and how.
>>
>> Something like simple.el should be fine.
>
> I would prefer setting the variable from lisp.
> ok for simple.el, but what is the recommended way for setting it (I
> don't think throwing a (setq while-no-input-ignore-events [...])
> anywhere in simple.el is the way to do) ?

I think that should be fine.  Though maybe in subr.el next to the
definition of `while-no-input' would be a better place?

>
> Also on my laptop with gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
> I have no warnings, but on an other computer with gcc version 5.4.0
> 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4), I have these warnings (but it
> compiled fine):

That should be fixed by adding a default case as Eli suggested, but does
it make sense to handle any of those other events?

>
> keyboard.c: In function ‘kbd_buffer_store_buffered_event’:
> keyboard.c:3572:3: warning: enumeration value ‘NO_EVENT’ not handled in 
> switch [-Wswitch]
>    switch (event->kind)
>    ^
> keyboard.c:3572:3: warning: enumeration value ‘ASCII_KEYSTROKE_EVENT’ not 
> handled in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value 
> ‘MULTIBYTE_CHAR_KEYSTROKE_EVENT’ not handled in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘NON_ASCII_KEYSTROKE_EVENT’ not 
> handled in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘TIMER_EVENT’ not handled in 
> switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘MOUSE_CLICK_EVENT’ not handled 
> in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘WHEEL_EVENT’ not handled in 
> switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘HORIZ_WHEEL_EVENT’ not handled 
> in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘SCROLL_BAR_CLICK_EVENT’ not 
> handled in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value 
> ‘HORIZONTAL_SCROLL_BAR_CLICK_EVENT’ not handled in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘SELECTION_CLEAR_EVENT’ not 
> handled in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘BUFFER_SWITCH_EVENT’ not 
> handled in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘DELETE_WINDOW_EVENT’ not 
> handled in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘MENU_BAR_EVENT’ not handled in 
> switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘MENU_BAR_ACTIVATE_EVENT’ not 
> handled in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘DRAG_N_DROP_EVENT’ not handled 
> in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘USER_SIGNAL_EVENT’ not handled 
> in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘TOOL_BAR_EVENT’ not handled in 
> switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘SELECT_WINDOW_EVENT’ not 
> handled in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘SAVE_SESSION_EVENT’ not 
> handled in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘GPM_CLICK_EVENT’ not handled 
> in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘DBUS_EVENT’ not handled in 
> switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘CONFIG_CHANGED_EVENT’ not 
> handled in switch [-Wswitch]
> keyboard.c:3572:3: warning: enumeration value ‘FILE_NOTIFY_EVENT’ not handled 
> in switch [-Wswitch]
> keyboard.c:3585:11: warning: ‘ignore_event’ may be used uninitialized in this 
> function [-Wmaybe-uninitialized]
>        && !NILP (Fmemq (ignore_event, Vwhile_no_input_ignore_events)))
>            ^
>
> What can I do to avoid this ? Or should I just ignore this ?
>
> Thanks.





reply via email to

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