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: Eli Zaretskii
Subject: bug#19547: Patch for this bug
Date: Sun, 27 Nov 2016 20:40:15 +0200

> From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
> Cc: npostavs@users.sourceforge.net, 19547@debbugs.gnu.org, rrt@sc3d.org
> Date: Sun, 27 Nov 2016 18:59:37 +0100
> 
> 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 ?

Yes, it means no events are filtered out initially.

> > 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)
>      ^

My advice is to look at how a function is used elsewhere in the
sources, before using it in your code.  In this case, you will find
stuff like this:

              arg = Flist (nargs - i, &arg_vector[i]);

IOW, the first argument to Flist is the number of arguments, and the
second argument is an array of that dimension.

> >> 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) ?

Why not?  You will see quite a few examples of such stuff there.
E.g.:

  (setq undo-outer-limit-function 'undo-outer-limit-truncate)

> 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):
> 
> 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]

That's because you don't have a "case default".  You should, as I
explained earlier.

> 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 ?

Like I said: initialize ignore_event and add a "case default".

> Or should I just ignore this ?

Not a good idea, at least as long as you don't feel at home with C
programming.

Thanks.





reply via email to

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