From: Eli Zaretskii <eliz@gnu.org>
To: bruce.connor.am@gmail.com
Cc: 15907@debbugs.gnu.org
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 [thread overview]
Message-ID: <83mwl4h68o.fsf@gnu.org> (raw)
In-Reply-To: <CAAdUY-KGJ++9D8uY8dK-R0_FPw1=XfHgQZkf+WuT2SwwVYGo7A@mail.gmail.com>
> Date: Sat, 16 Nov 2013 11:46:21 +0000
> From: Bruce Connor <bruce.connor.am@gmail.com>
>
> 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);
}
}
prev parent reply other threads:[~2013-11-16 12:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-15 21:23 bug#15907: 24.3; Emacs crash due to substitute-command-keys and after-change-functions Artur Malabarba
2013-11-16 9:31 ` Eli Zaretskii
2013-11-16 10:29 ` Eli Zaretskii
[not found] ` <CAAdUY-KGJ++9D8uY8dK-R0_FPw1=XfHgQZkf+WuT2SwwVYGo7A@mail.gmail.com>
2013-11-16 12:37 ` Eli Zaretskii [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83mwl4h68o.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=15907@debbugs.gnu.org \
--cc=bruce.connor.am@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.