Avoid crashes at startup on systems that CANNOT_DUMP

* 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)
This commit is contained in:
Eli Zaretskii 2016-03-12 11:51:03 +02:00
parent 6d8e1f0276
commit 48196164aa
2 changed files with 23 additions and 6 deletions

View file

@ -47,6 +47,13 @@
;;; 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".
@ -162,7 +169,8 @@
(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")

View 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;
}