]> code.delx.au - gnu-emacs/commitdiff
Avoid crashes at startup on systems that CANNOT_DUMP
authorEli Zaretskii <eliz@gnu.org>
Sat, 12 Mar 2016 09:51:03 +0000 (11:51 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 12 Mar 2016 09:51:03 +0000 (11:51 +0200)
* src/xdisp.c (syms_of_xdisp) <redisplay--inhibit-bidi>: New
boolean variable.
(init_iterator, reseat_to_string)
(Fcurrent_bidi_paragraph_direction)
(Fbidi_find_overridden_directionality): Use
redisplay--inhibit-bidi instead of purify-flag, to determine when
it's safe to reorder bidirectional text.

* lisp/loadup.el (redisplay--inhibit-bidi): Set to t at the
beginning of the file.  Reset to nil when charprop.el is
successfully loaded, or when we are going to dump, whichever
happens last.  (Bug#22975)

lisp/loadup.el
src/xdisp.c

index b620e6572239ce23b0963140da77ab7a0217e5a2..bd47bed31602e28fdbe0d141d9ff20f58ddccde9 100644 (file)
 
 ;;; Code:
 
+;; This is used in xdisp.c to determine when bidi reordering is safe.
+;; (It starts non-nil in temacs, but we set it non-nil here anyway, in
+;; case someone loads loadup one more time.)  We reset it after
+;; successfully loading charprop.el, which defines the Unicode tables
+;; bidi.c needs for its job.
+(setq redisplay--inhibit-bidi t)
+
 ;; Add subdirectories to the load-path for files that might get
 ;; autoloaded when bootstrapping.
 ;; This is because PATH_DUMPLOADSEARCH is just "../lisp".
 (load "case-table")
 ;; This file doesn't exist when building a development version of Emacs
 ;; from the repository.  It is generated just after temacs is built.
-(load "international/charprop.el" t)
+(if (load "international/charprop.el" t)
+    (setq redisplay--inhibit-bidi nil))
 (load "international/characters")
 (load "composite")
 
@@ -415,6 +423,9 @@ lost after dumping")))
 (if (null (garbage-collect))
     (setq pure-space-overflow t))
 
+;; Make sure we will attempt bidi reordering henceforth.
+(setq redisplay--inhibit-bidi nil)
+
 (if (member (car (last command-line-args)) '("dump" "bootstrap"))
     (progn
       (message "Dumping under the name emacs")
index e5ac6504067281da80964c1bf831fa6c1cca174e..ce992d42531763e8f33184c2daa6cc5e53cb703b 100644 (file)
@@ -2946,7 +2946,7 @@ init_iterator (struct it *it, struct window *w,
         character properties needed for reordering are not yet
         available.  */
       it->bidi_p =
-       NILP (Vpurify_flag)
+       !redisplay__inhibit_bidi
        && !NILP (BVAR (current_buffer, bidi_display_reordering))
        && it->multibyte_p;
 
@@ -6641,7 +6641,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string,
      loading loadup.el, as the necessary character property tables are
      not yet available.  */
   it->bidi_p =
-    NILP (Vpurify_flag)
+    !redisplay__inhibit_bidi
     && !NILP (BVAR (&buffer_defaults, bidi_display_reordering));
 
   if (s == NULL)
@@ -21230,7 +21230,7 @@ See also `bidi-paragraph-direction'.  */)
       || NILP (BVAR (buf, enable_multibyte_characters))
       /* When we are loading loadup.el, the character property tables
         needed for bidi iteration are not yet available.  */
-      || !NILP (Vpurify_flag))
+      || redisplay__inhibit_bidi)
     return Qleft_to_right;
   else if (!NILP (BVAR (buf, bidi_paragraph_direction)))
     return BVAR (buf, bidi_paragraph_direction);
@@ -21354,7 +21354,7 @@ the `bidi-class' property of a character.  */)
          /* When we are loading loadup.el, the character property
             tables needed for bidi iteration are not yet
             available.  */
-         || !NILP (Vpurify_flag))
+         || redisplay__inhibit_bidi)
        return Qnil;
 
       validate_subarray (object, from, to, SCHARS (object), &from_pos, &to_pos);
@@ -21382,7 +21382,7 @@ the `bidi-class' property of a character.  */)
          /* When we are loading loadup.el, the character property
             tables needed for bidi iteration are not yet
             available.  */
-         || !NILP (Vpurify_flag))
+         || redisplay__inhibit_bidi)
        return Qnil;
 
       set_buffer_temp (buf);
@@ -31806,6 +31806,12 @@ display table takes effect; in this case, Emacs does not consult
   DEFVAR_LISP ("redisplay--variables", Vredisplay__variables,
      doc: /* A hash-table of variables changing which triggers a thorough redisplay.  */);
   Vredisplay__variables = Qnil;
+
+  DEFVAR_BOOL ("redisplay--inhibit-bidi", redisplay__inhibit_bidi,
+     doc: /* Non-nil means it is not safe to attempt bidi reordering for display.  */);
+  /* Initialize to t, since we need to disable reordering until
+     loadup.el successfully loads charprop.el.  */
+  redisplay__inhibit_bidi = true;
 }