From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Samuel Bronson Newsgroups: gmane.emacs.bugs Subject: bug#17413: 24.3; trapped in an (imaginary) recursive edit Date: Mon, 05 May 2014 22:20:11 -0400 Message-ID: <8738gn8x7o.fsf@naesten.mooo.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1399414156 2282 80.91.229.3 (6 May 2014 22:09:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 6 May 2014 22:09:16 +0000 (UTC) To: 17413@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 07 00:09:10 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WhnR8-0002FQ-2U for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 May 2014 00:02:06 +0200 Original-Received: from localhost ([::1]:60753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhV0F-0000Bt-LH for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 May 2014 22:21:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38848) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhV0C-0000Bm-KJ for bug-gnu-emacs@gnu.org; Mon, 05 May 2014 22:21:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WhV0B-00015f-HC for bug-gnu-emacs@gnu.org; Mon, 05 May 2014 22:21:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34817) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhV0B-00015S-Dj for bug-gnu-emacs@gnu.org; Mon, 05 May 2014 22:21:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WhV0A-0002Qu-Bk for bug-gnu-emacs@gnu.org; Mon, 05 May 2014 22:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Samuel Bronson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 May 2014 02:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 17413 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13993428319287 (code B ref -1); Tue, 06 May 2014 02:21:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 May 2014 02:20:31 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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) Original-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) Original-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 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:88708 Archived-At: --=-=-= 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! --=-=-=--