From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 5b5f441: read_key_sequence: correct the handling of raw_keybuf in recursive calls Date: Mon, 20 Nov 2017 19:59:18 +0000 Message-ID: <20171120195918.GB3917@ACM> References: <20171120181209.23553.97060@vcs0.savannah.gnu.org> <20171120181210.7946F20416@vcs0.savannah.gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1511208219 3568 195.159.176.226 (20 Nov 2017 20:03:39 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 20 Nov 2017 20:03:39 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 20 21:03:32 2017 Return-path: Envelope-to: ged-emacs-devel@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 1eGsHy-0000Me-8R for ged-emacs-devel@m.gmane.org; Mon, 20 Nov 2017 21:03:30 +0100 Original-Received: from localhost ([::1]:59463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGsI5-0004xY-Ly for ged-emacs-devel@m.gmane.org; Mon, 20 Nov 2017 15:03:37 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGsH3-0004mC-Dv for emacs-devel@gnu.org; Mon, 20 Nov 2017 15:02:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGsH0-0003OB-Or for emacs-devel@gnu.org; Mon, 20 Nov 2017 15:02:33 -0500 Original-Received: from ocolin.muc.de ([193.149.48.4]:47938 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1eGsH0-0003ND-Dm for emacs-devel@gnu.org; Mon, 20 Nov 2017 15:02:30 -0500 Original-Received: (qmail 57617 invoked by uid 3782); 20 Nov 2017 20:02:29 -0000 Original-Received: from acm.muc.de (p548C744B.dip0.t-ipconnect.de [84.140.116.75]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 20 Nov 2017 21:02:28 +0100 Original-Received: (qmail 16709 invoked by uid 1000); 20 Nov 2017 19:59:18 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:220310 Archived-At: Hello, Stefan. On Mon, Nov 20, 2017 at 13:41:54 -0500, Stefan Monnier wrote: > > + outer_raw_keybuf_count = raw_keybuf_count; > > + outer_raw_keybuf = raw_keybuf; > > + inner_raw_keybuf_count_buffer = 0; > > + raw_keybuf_count = &inner_raw_keybuf_count_buffer; > > + raw_keybuf = &inner_raw_keybuf_buffer; > Looks good, thanks (tho I think I would have bundled the buf and the > count into a struct, so it's clear that they're switched together). > > /* Calling read_char with COMMANDFLAG = -2 avoids > > redisplay in read_char and its subroutines. */ > > key = read_char (prevent_redisplay ? -2 : NILP (prompt), > > current_binding, last_nonmenu_event, > > &used_mouse_menu, NULL); > > + raw_keybuf_count = outer_raw_keybuf_count; > > + raw_keybuf = outer_raw_keybuf; > But here I worry: what if `read_char` exits non-locally because of > a signal or a throw? raw_keybuf{,_count} should then be re-initialised in command_loop_1 to the static buffer variables, just before the call to read_key_sequence. > Stefan -- Alan Mackenzie (Nuremberg, Germany).