From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#15907: 24.3; Emacs crash due to substitute-command-keys and after-change-functions Date: Sat, 16 Nov 2013 14:37:59 +0200 Message-ID: <83mwl4h68o.fsf@gnu.org> References: <20131115.212301.505338034.artur.malabarba@gmail.com> <83siuwhevv.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1384605558 24442 80.91.229.3 (16 Nov 2013 12:39:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 16 Nov 2013 12:39:18 +0000 (UTC) Cc: 15907@debbugs.gnu.org To: bruce.connor.am@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 16 13:39:20 2013 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 1Vhf9k-0005HX-HZ for geb-bug-gnu-emacs@m.gmane.org; Sat, 16 Nov 2013 13:39:20 +0100 Original-Received: from localhost ([::1]:35632 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vhf9k-00052p-6b for geb-bug-gnu-emacs@m.gmane.org; Sat, 16 Nov 2013 07:39:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vhf9a-00052d-NG for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2013 07:39:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vhf9T-0000bk-Bh for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2013 07:39:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42783) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vhf9T-0000bc-8B for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2013 07:39:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Vhf9S-00069e-BA for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2013 07:39: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: Sat, 16 Nov 2013 12:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15907 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15907-submit@debbugs.gnu.org id=B15907.138460550123604 (code B ref 15907); Sat, 16 Nov 2013 12:39:02 +0000 Original-Received: (at 15907) by debbugs.gnu.org; 16 Nov 2013 12:38:21 +0000 Original-Received: from localhost ([127.0.0.1]:56802 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vhf8m-00068d-Ha for submit@debbugs.gnu.org; Sat, 16 Nov 2013 07:38:21 -0500 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:40890) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vhf8j-00068M-KL for 15907@debbugs.gnu.org; Sat, 16 Nov 2013 07:38:19 -0500 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MWC00400W3FBK00@a-mtaout23.012.net.il> for 15907@debbugs.gnu.org; Sat, 16 Nov 2013 14:38:10 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MWC004IKWFM8Y80@a-mtaout23.012.net.il>; Sat, 16 Nov 2013 14:38:10 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il 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:80640 Archived-At: > Date: Sat, 16 Nov 2013 11:46:21 +0000 > From: Bruce Connor > > The real life use case was that having smart-mode-line active meant emacs > would crash everytime I hit "C-h m". > > However, I patched smart-mode-line with a work around for this yesterday, > so it's not a use case anymore. I just figured "format" was such a basic > function that it was good to report it anyway. You may wish patching your Emacs with the patch below instead. The problem was not in 'format', but in substitute-command-keys, btw. Here's how I fixed that: === modified file 'src/doc.c' --- src/doc.c 2013-08-11 01:30:20 +0000 +++ src/doc.c 2013-11-16 10:20:32 +0000 @@ -850,6 +850,7 @@ Otherwise, return a new string, without /* This is for computing the SHADOWS arg for describe_map_tree. */ Lisp_Object active_maps = Fcurrent_active_maps (Qnil, Qnil); Lisp_Object earlier_maps; + ptrdiff_t count = SPECPDL_INDEX (); changed = 1; strp += 2; /* skip \{ or \< */ @@ -886,6 +887,10 @@ Otherwise, return a new string, without /* Now switch to a temp buffer. */ oldbuf = current_buffer; set_buffer_internal (XBUFFER (Vprin1_to_string_buffer)); + /* This is for an unusual case where some after-change + function uses 'format' or 'prin1' or something else that + will thrash Vprin1_to_string_buffer we are using. */ + specbind (Qinhibit_modification_hooks, Qt); if (NILP (tem)) { @@ -910,6 +915,7 @@ Otherwise, return a new string, without tem = Fbuffer_string (); Ferase_buffer (); set_buffer_internal (oldbuf); + unbind_to (count, Qnil); subst_string: start = SDATA (tem); === modified file 'src/keymap.c' --- src/keymap.c 2013-08-11 01:30:20 +0000 +++ src/keymap.c 2013-11-16 09:24:19 +0000 @@ -3383,9 +3383,12 @@ describe_map (Lisp_Object map, Lisp_Obje if (vect[i].shadowed) { - SET_PT (PT - 1); + ptrdiff_t pt = max (PT - 1, BEG); + + SET_PT (pt); insert_string ("\n (that binding is currently shadowed by another mode)"); - SET_PT (PT + 1); + pt = min (PT + 1, Z); + SET_PT (pt); } }