Subject: Re: bug#27761: Crash while using proof-general/company-coq on OS X

From: Eli Zaretskii <[email-masked]>
Date: Mon, 07 Aug 2017 20:51:53 +0300

> Date: Mon, 07 Aug 2017 15:16:08 +0900
> From: YAMAMOTO Mitsuharu <[email-masked]>
> Cc: [email-masked],
> 	[email-masked],
> 	[email-masked],
> 	[email-masked]
> 
> 1. % emacs -Q
> 2. (setq bidi-redisplay-reordering nil) C-j
> 3. (prettify-symbols-mode) C-j
> 4. (linum-mode) C-j
> 5. Type "lambda" (without quotations).
> 
> I hope this is also reproducible on your environment.

Thanks, it is.  The bug should now be fixed on master.

For the benefit of those who are still using Emacs 25, the patch is
below (it will probably apply with some offset and/or fuzz to the
Emacs 25 codebase).

diff --git a/src/xdisp.c b/src/xdisp.c
index 422912e..ad9b298 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -5248,6 +5248,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
 	  it->prev_stop = 0;
 	  it->base_level_stop = 0;
 	  it->string_from_display_prop_p = true;
+	  it->cmp_it.id = -1;
 	  /* Say that we haven't consumed the characters with
 	     `display' property yet.  The call to pop_it in
 	     set_iterator_to_next will clean this up.  */
@@ -5966,6 +5967,7 @@ get_overlay_strings_1 (struct it *it, ptrdiff_t charpos, bool compute_stop_p)
       it->multibyte_p = STRING_MULTIBYTE (it->string);
       it->method = GET_FROM_STRING;
       it->from_disp_prop_p = 0;
+      it->cmp_it.id = -1;
 
       /* Force paragraph direction to be that of the parent
 	 buffer.  */
@@ -20506,6 +20508,7 @@ push_prefix_prop (struct it *it, Lisp_Object prop)
       it->stop_charpos = 0;
       it->prev_stop = 0;
       it->base_level_stop = 0;
+      it->cmp_it.id = -1;
 
       /* Force paragraph direction to be that of the parent
 	 buffer/string.  */