From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#19547: Patch for this bug Date: Sun, 27 Nov 2016 20:40:15 +0200 Message-ID: <83twaszrzk.fsf@gnu.org> References: <874ms03qj1.fsf@web.de> <8360nxhfiw.fsf@gnu.org> <83k2ccfnh8.fsf@gnu.org> <83wpgbdy82.fsf@gnu.org> <87y4071o5k.fsf@gmail.com> <83h96u3d07.fsf@gnu.org> <87zikl8leb.fsf@gmail.com> <871sxxj9s8.fsf@users.sourceforge.net> <87twat6kjd.fsf@gmail.com> <834m2s2a0d.fsf@gnu.org> <87r35wx0qe.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1480272076 18771 195.159.176.226 (27 Nov 2016 18:41:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 27 Nov 2016 18:41:16 +0000 (UTC) Cc: npostavs@users.sourceforge.net, 19547@debbugs.gnu.org, rrt@sc3d.org To: Thierry Volpiatto Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 27 19:41:09 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cB4Nw-0003Pu-Kp for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 Nov 2016 19:41:08 +0100 Original-Received: from localhost ([::1]:55196 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cB4Ny-00069w-TW for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 Nov 2016 13:41:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cB4Ns-00069p-VS for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2016 13:41:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cB4Nq-0002ql-M8 for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2016 13:41:04 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56655) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cB4Nq-0002qe-Ij for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2016 13:41:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cB4Nq-0006zn-Cf for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2016 13:41:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Nov 2016 18:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19547 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19547-submit@debbugs.gnu.org id=B19547.148027204926863 (code B ref 19547); Sun, 27 Nov 2016 18:41:02 +0000 Original-Received: (at 19547) by debbugs.gnu.org; 27 Nov 2016 18:40:49 +0000 Original-Received: from localhost ([127.0.0.1]:43821 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cB4Nc-0006zD-Lo for submit@debbugs.gnu.org; Sun, 27 Nov 2016 13:40:48 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57455) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cB4Na-0006z1-Vq for 19547@debbugs.gnu.org; Sun, 27 Nov 2016 13:40:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cB4NU-0002d8-L0 for 19547@debbugs.gnu.org; Sun, 27 Nov 2016 13:40:41 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:58596) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cB4NP-0002aZ-Pz; Sun, 27 Nov 2016 13:40:35 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1806 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1cB4NM-0001DY-Rl; Sun, 27 Nov 2016 13:40:35 -0500 In-reply-to: <87r35wx0qe.fsf@gmail.com> (message from Thierry Volpiatto on Sun, 27 Nov 2016 18:59:37 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:126179 Archived-At: > From: Thierry Volpiatto > Cc: npostavs@users.sourceforge.net, 19547@debbugs.gnu.org, rrt@sc3d.org > Date: Sun, 27 Nov 2016 18:59:37 +0100 > > Eli Zaretskii 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.