Commit d17f4dba authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

Don't let unusual after-change-functions overwrite " prin1" buffer in use.

 src/doc.c (Fsubstitute_command_keys): Inhibit modification hooks
 while we are using Vprin1_to_string_buffer.

Fixes: debbugs:15907
parent 3d6dec8d
2013-11-16 Eli Zaretskii <eliz@gnu.org> 2013-11-16 Eli Zaretskii <eliz@gnu.org>
* doc.c (Fsubstitute_command_keys): Inhibit modification hooks
while we are using Vprin1_to_string_buffer.
* keymap.c (describe_map): Don't crash if PT is 1 both before and * keymap.c (describe_map): Don't crash if PT is 1 both before and
after inserting the description string. (Bug#15907) after inserting the description string. (Bug#15907)
......
...@@ -850,6 +850,7 @@ Otherwise, return a new string, without any text properties. */) ...@@ -850,6 +850,7 @@ Otherwise, return a new string, without any text properties. */)
/* This is for computing the SHADOWS arg for describe_map_tree. */ /* This is for computing the SHADOWS arg for describe_map_tree. */
Lisp_Object active_maps = Fcurrent_active_maps (Qnil, Qnil); Lisp_Object active_maps = Fcurrent_active_maps (Qnil, Qnil);
Lisp_Object earlier_maps; Lisp_Object earlier_maps;
ptrdiff_t count = SPECPDL_INDEX ();
changed = 1; changed = 1;
strp += 2; /* skip \{ or \< */ strp += 2; /* skip \{ or \< */
...@@ -886,6 +887,10 @@ Otherwise, return a new string, without any text properties. */) ...@@ -886,6 +887,10 @@ Otherwise, return a new string, without any text properties. */)
/* Now switch to a temp buffer. */ /* Now switch to a temp buffer. */
oldbuf = current_buffer; oldbuf = current_buffer;
set_buffer_internal (XBUFFER (Vprin1_to_string_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)) if (NILP (tem))
{ {
...@@ -910,6 +915,7 @@ Otherwise, return a new string, without any text properties. */) ...@@ -910,6 +915,7 @@ Otherwise, return a new string, without any text properties. */)
tem = Fbuffer_string (); tem = Fbuffer_string ();
Ferase_buffer (); Ferase_buffer ();
set_buffer_internal (oldbuf); set_buffer_internal (oldbuf);
unbind_to (count, Qnil);
subst_string: subst_string:
start = SDATA (tem); start = SDATA (tem);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment