changeset 108030:c964c5fcf1f2

Fix bug #5992. bidi.c (bidi_find_paragraph_start, bidi_at_paragraph_end): Don't use buffer-local values of paragraph-start and paragraph-separate. <paragraph_start_re, paragraph_separate_re>: Rename from fallback_paragraph_start_re and fallback_paragraph_separate_re.
author Eli Zaretskii <eliz@gnu.org>
date Wed, 21 Apr 2010 20:59:39 +0300
parents e61497621f0d
children c10fc3731b2c
files src/ChangeLog src/bidi.c
diffstat 2 files changed, 22 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Apr 21 13:53:03 2010 -0400
+++ b/src/ChangeLog	Wed Apr 21 20:59:39 2010 +0300
@@ -1,3 +1,11 @@
+2010-04-21  Eli Zaretskii  <eliz@gnu.org>
+
+	* bidi.c (bidi_find_paragraph_start, bidi_at_paragraph_end): Don't
+	use buffer-local values of paragraph-start and paragraph-separate.
+	<paragraph_start_re, paragraph_separate_re>: Rename from
+	fallback_paragraph_start_re and fallback_paragraph_separate_re.
+	(Bug#5992)
+
 2010-04-21  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* xsettings.c: Qmonospace_font_name, Qtool_bar_style and
--- a/src/bidi.c	Wed Apr 21 13:53:03 2010 -0400
+++ b/src/bidi.c	Wed Apr 21 20:59:39 2010 +0300
@@ -102,7 +102,7 @@
 
 int bidi_ignore_explicit_marks_for_paragraph_level = 1;
 
-static Lisp_Object fallback_paragraph_start_re, fallback_paragraph_separate_re;
+static Lisp_Object paragraph_start_re, paragraph_separate_re;
 static Lisp_Object Qparagraph_start, Qparagraph_separate;
 
 static void
@@ -401,16 +401,16 @@
 
   Qparagraph_start = intern ("paragraph-start");
   staticpro (&Qparagraph_start);
-  fallback_paragraph_start_re = Fsymbol_value (Qparagraph_start);
-  if (!STRINGP (fallback_paragraph_start_re))
-    fallback_paragraph_start_re = build_string ("\f\\|[ \t]*$");
-  staticpro (&fallback_paragraph_start_re);
+  paragraph_start_re = Fsymbol_value (Qparagraph_start);
+  if (!STRINGP (paragraph_start_re))
+    paragraph_start_re = build_string ("\f\\|[ \t]*$");
+  staticpro (&paragraph_start_re);
   Qparagraph_separate = intern ("paragraph-separate");
   staticpro (&Qparagraph_separate);
-  fallback_paragraph_separate_re = Fsymbol_value (Qparagraph_separate);
-  if (!STRINGP (fallback_paragraph_separate_re))
-    fallback_paragraph_separate_re = build_string ("[ \t\f]*$");
-  staticpro (&fallback_paragraph_separate_re);
+  paragraph_separate_re = Fsymbol_value (Qparagraph_separate);
+  if (!STRINGP (paragraph_separate_re))
+    paragraph_separate_re = build_string ("[ \t\f]*$");
+  staticpro (&paragraph_separate_re);
   bidi_initialized = 1;
 }
 
@@ -751,16 +751,12 @@
 bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT bytepos)
 {
   /* FIXME: Why Fbuffer_local_value rather than just Fsymbol_value?  */
-  Lisp_Object sep_re = Fbuffer_local_value (Qparagraph_separate,
-					    Fcurrent_buffer ());
-  Lisp_Object start_re = Fbuffer_local_value (Qparagraph_start,
-					      Fcurrent_buffer ());
+  Lisp_Object sep_re;
+  Lisp_Object start_re;
   EMACS_INT val;
 
-  if (!STRINGP (sep_re))
-    sep_re = fallback_paragraph_separate_re;
-  if (!STRINGP (start_re))
-    start_re = fallback_paragraph_start_re;
+  sep_re = paragraph_separate_re;
+  start_re = paragraph_start_re;
 
   val = fast_looking_at (sep_re, charpos, bytepos, ZV, ZV_BYTE, Qnil);
   if (val < 0)
@@ -829,12 +825,9 @@
 static EMACS_INT
 bidi_find_paragraph_start (EMACS_INT pos, EMACS_INT pos_byte)
 {
-  /* FIXME: Why Fbuffer_local_value rather than just Fsymbol_value?  */
-  Lisp_Object re = Fbuffer_local_value (Qparagraph_start, Fcurrent_buffer ());
+  Lisp_Object re = paragraph_start_re;
   EMACS_INT limit = ZV, limit_byte = ZV_BYTE;
 
-  if (!STRINGP (re))
-    re = fallback_paragraph_start_re;
   while (pos_byte > BEGV_BYTE
 	 && fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0)
     {