GNU bug report logs - #19547
25.0.50; throw-on-input "fires" when switching workspace

Previous Next

Package: emacs;

Reported by: michael_heerdegen <at> web.de

Date: Fri, 9 Jan 2015 15:48:02 UTC

Severity: normal

Tags: fixed

Found in version 25.0.50

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


Message #143 received at 19547 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
Cc: rrt <at> sc3d.org, 19547 <at> debbugs.gnu.org, npostavs <at> users.sourceforge.net
Subject: Re: bug#19547: Patch for this bug
Date: Sun, 27 Nov 2016 20:40:15 +0200
> From: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
> Cc: npostavs <at> users.sourceforge.net, 19547 <at> debbugs.gnu.org, rrt <at> sc3d.org
> Date: Sun, 27 Nov 2016 18:59:37 +0100
> 
> Eli Zaretskii <eliz <at> 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.




This bug report was last modified 8 years and 43 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.