From debbugs-submit-bounces@debbugs.gnu.org Mon May 05 22:20:31 2014 Received: (at submit) by debbugs.gnu.org; 6 May 2014 02:20:31 +0000 Received: from localhost ([127.0.0.1]:52168 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WhUzd-0002Pi-OT for submit@debbugs.gnu.org; Mon, 05 May 2014 22:20:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36051) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WhUza-0002PR-Sc for submit@debbugs.gnu.org; Mon, 05 May 2014 22:20:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WhUzU-0000UK-DA for submit@debbugs.gnu.org; Mon, 05 May 2014 22:20:21 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:55717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhUzU-0000UD-9S for submit@debbugs.gnu.org; Mon, 05 May 2014 22:20:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhUzT-000092-2P for bug-gnu-emacs@gnu.org; Mon, 05 May 2014 22:20:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WhUzR-0000S7-PJ for bug-gnu-emacs@gnu.org; Mon, 05 May 2014 22:20:18 -0400 Received: from mail-qc0-x236.google.com ([2607:f8b0:400d:c01::236]:47384) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhUzR-0000Rd-Kx for bug-gnu-emacs@gnu.org; Mon, 05 May 2014 22:20:17 -0400 Received: by mail-qc0-f182.google.com with SMTP id e16so6271361qcx.27 for ; Mon, 05 May 2014 19:20:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=MZJa4DZxUOsCOLK/INVzlKhTOQRFbtBzvl0HXrxzsaA=; b=QA3uG0ax1dpTpMkjQIHCpOD75GYiGp8p0XasiL0tjKsf4wi5yLOo3P2F79BgyVAWX/ AwDpqwPWWNN06rcD+2zLWLaZ/FbbTTNl689vBwTb1pdRqh4bpPKwxykVxpEdEsR5OnYC qaYoPutlNrAW+d9cW3dO3SYr6x1cHQA2rQcNdFImwV1zmAhGRwIJZEAI8DSjxZTp26JK Z3zFu9cX5tx1xgkqq8I+sIfndyMuRX0AUlRH1zP95nXOuyALzij9rbqDq0imq2yZxKLS SeGc75gyOiCYnI1w8eqqGL/4/LfpklOBSBf3yYkqBHnq8EtaA2Ph34eew1nZL7EN8980 R4bg== X-Received: by 10.140.31.10 with SMTP id e10mr46219518qge.101.1399342816729; Mon, 05 May 2014 19:20:16 -0700 (PDT) Received: from hydrogen (naesten-pt.tunnel.tserv4.nyc4.ipv6.he.net. [2001:470:1f06:57::2]) by mx.google.com with ESMTPSA id l3sm20689372qao.33.2014.05.05.19.20.15 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 05 May 2014 19:20:15 -0700 (PDT) Received: from naesten by hydrogen with local (Exim 4.82) (envelope-from ) id 1WhUzM-00019q-AL for bug-gnu-emacs@gnu.org; Mon, 05 May 2014 22:20:12 -0400 From: Samuel Bronson To: bug-gnu-emacs@gnu.org Subject: 24.3; trapped in an (imaginary) recursive edit Date: Mon, 05 May 2014 22:20:11 -0400 Message-ID: <8738gn8x7o.fsf@naesten.mooo.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-=-= Content-Type: text/plain Tags: patch As the comment in temporarily_switch_to_single_kboard () says, it is possible for lisp code to call `recursive-edit' (or one of its callers) while the keyboard for the selected frame is locked. And it is indeed better to throw an error when this happens than to leave the user with a frozen screen. (I don't properly understand the circumstances I saw it in, but they involved emacs --daemon and a terminal which did not actually work.) One small problem: this happens *after* the line: command_loop_level++; but before the line: record_unwind_protect (recursive_edit_unwind, buffer); which registers the code that does the corresponding: command_loop_level--; So the user will be left with every indication that they're in a recursive edit, except that when they try to use C-M-c it will give them a cryptic error like "No catch for tag: exit, nil" in the status area instead of zapping those pesky square brackets. Here's a patch against master to fix that: --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: Patch diff --git a/src/keyboard.c b/src/keyboard.c index d52483e..a5a9ad9 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -825,22 +825,25 @@ This function is called by the editor initialization to begin editing. */) if (input_blocked_p ()) return Qnil; - command_loop_level++; - update_mode_lines = 17; - - if (command_loop_level + if (command_loop_level >= 0 && current_buffer != XBUFFER (XWINDOW (selected_window)->contents)) buffer = Fcurrent_buffer (); else buffer = Qnil; + /* Don't do anything interesting between the increment and the + record_unwind_protect! Otherwise, we could get distracted and + never decrement the counter again. */ + command_loop_level++; + update_mode_lines = 17; + record_unwind_protect (recursive_edit_unwind, buffer); + /* If we leave recursive_edit_1 below with a `throw' for instance, like it is done in the splash screen display, we have to make sure that we restore single_kboard as command_loop_1 would have done if it were left normally. */ if (command_loop_level > 0) temporarily_switch_to_single_kboard (SELECTED_FRAME ()); - record_unwind_protect (recursive_edit_unwind, buffer); recursive_edit_1 (); return unbind_to (count, Qnil); --=-=-= Content-Type: text/plain In GNU Emacs 24.3.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2013-12-22 on binet, modified by Debian Windowing system distributor `Colin Harrison', version 11.0.60900031 System Description: Debian GNU/Linux testing (jessie) Configured using: `configure '--build' 'i486-linux-gnu' '--build' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp' '--with-crt-dir=/usr/lib/i386-linux-gnu' '--with-x=yes' '--with-x-toolkit=lucid' '--with-toolkit-scroll-bars' '--without-gconf' '--without-gsettings' 'build_alias=i486-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall' 'LDFLAGS=-Wl,-z,relro' 'CPPFLAGS=-D_FORTIFY_SOURCE=2'' Important settings: value of $LC_COLLATE: C value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t -- Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread! --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue May 06 12:17:28 2014 Received: (at 17413-done) by debbugs.gnu.org; 6 May 2014 16:17:28 +0000 Received: from localhost ([127.0.0.1]:53019 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Whi3c-0002tZ-1a for submit@debbugs.gnu.org; Tue, 06 May 2014 12:17:28 -0400 Received: from relais.videotron.ca ([24.201.245.36]:61585) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Whi3Z-0002tR-J1 for 17413-done@debbugs.gnu.org; Tue, 06 May 2014 12:17:26 -0400 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from ceviche.home ([24.201.53.56]) by VL-VM-MR005.ip.videotron.ca (Oracle Communications Messaging Exchange Server 7u4-22.01 64bit (built Apr 21 2011)) with ESMTP id <0N5500K55UL0RYM0@VL-VM-MR005.ip.videotron.ca> for 17413-done@debbugs.gnu.org; Tue, 06 May 2014 12:17:24 -0400 (EDT) Received: by ceviche.home (Postfix, from userid 20848) id D3B1066094; Tue, 06 May 2014 12:17:24 -0400 (EDT) From: Stefan Monnier To: Samuel Bronson Subject: Re: bug#17413: 24.3; trapped in an (imaginary) recursive edit Message-id: References: <8738gn8x7o.fsf@naesten.mooo.com> Date: Tue, 06 May 2014 12:17:24 -0400 In-reply-to: <8738gn8x7o.fsf@naesten.mooo.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 17413-done Cc: 17413-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > One small problem: this happens *after* the line: > command_loop_level++; > but before the line: > record_unwind_protect (recursive_edit_unwind, buffer); > which registers the code that does the corresponding: > command_loop_level--; Oops, thanks for spotting this. Patch installed into the emacs-24 branch. Stefan From unknown Sat Sep 20 06:23:43 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 04 Jun 2014 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator