aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2007-11-09 09:45:30 +0000
committerMiles Bader2007-11-09 09:45:30 +0000
commitc12ecb0af9679cc0e2fa0409931c34c035763469 (patch)
treebd118c7ebc571de0dab542f48ad0c1648c6ccf72 /src
parente83d1fe87564d06d2fcbb4006dfd9133bc340aa8 (diff)
parent9d2185d10e3da9062672d96d3b59fcea31ff17ed (diff)
downloademacs-c12ecb0af9679cc0e2fa0409931c34c035763469.tar.gz
emacs-c12ecb0af9679cc0e2fa0409931c34c035763469.zip
Merge from emacs--rel--22
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-923
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog57
-rw-r--r--src/dispextern.h40
-rw-r--r--src/emacs.c5
-rw-r--r--src/macfns.c4
-rw-r--r--src/textprop.c2
-rw-r--r--src/unexmacosx.c38
-rw-r--r--src/xdisp.c111
-rw-r--r--src/xfaces.c79
8 files changed, 284 insertions, 52 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d6a6b80f89c..90338e217b3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,60 @@
12007-11-09 Chong Yidong <cyd@stupidchicken.com>
2
3 * dispextern.h (struct it): Don't define OVERLAY_STRING_CHUNK_SIZE
4 twice.
5
6 * xdisp.c (handle_face_prop): Fix last change.
7
82007-11-09 Richard Stallman <rms@gnu.org>
9
10 * xdisp.c (handle_face_prop): Test for strings that came from overlays,
11 not just for after-strings and before-strings.
12 Call face_for_overlay_string and pass the overlay to it.
13 (handle_display_prop): Determine whether property came from an overlay.
14 Pass OVERLAY arg to handle_single_display_spec.
15 (handle_single_display_spec): New arg OVERLAY sets it->from_overlay.
16 (load_overlay_strings): Fill in it->string_overlays.
17 (get_overlay_strings_1, push_it, pop_it): Handle it->from_overlays.
18
19 * xfaces.c (face_for_overlay_string): Function renamed from
20 face_at_buffer_position_no_overlays, and add arg OVERLAY.
21
22 * dispextern.h (struct it): New elt string_overlays.
23 New elt from_overlay, also in stack.
24 Rearrange a few elements.
25 (face_for_overlay_string): Decl renamed from
26 face_at_buffer_position_no_overlays, and add argument.
27
282007-11-09 Richard Stallman <rms@gnu.org>
29
30 * xdisp.c (handle_face_prop): Use face_at_buffer_position_no_overlays
31 to get the base face for an overlay string.
32
33 * dispextern.h (face_at_buffer_position_no_overlays): Add decl.
34
35 * xfaces.c (face_at_buffer_position_no_overlays): New function.
36
37 * xdisp.c (handle_stop): Move some code out of loop.
38
392007-11-09 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
40
41 * macfns.c [USE_ATSUI] (Fmac_atsu_font_face_attributes):
42 Fix conversion from Lisp object to ATSUFontID.
43
442007-11-09 Jason Rumney <jasonr@gnu.org>
45
46 * xdisp.c (Fformat_mode_line): Do nothing when noninteractive.
47
482007-11-09 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
49
50 * unexmacosx.c (unexec_regions_recorder, unexec_regions_merge):
51 Don't assume regions are aligned to page boundary.
52 (print_load_command_name): Add LC_UUID if defined.
53
542007-11-09 Richard Stallman <rms@gnu.org>
55
56 * emacs.c (syms_of_emacs) <installation-directory>: Reflow docstring.
57
12007-11-07 Jason Rumney <jasonr@gnu.org> 582007-11-07 Jason Rumney <jasonr@gnu.org>
2 59
3 * s/windows95.h: Remove. 60 * s/windows95.h: Remove.
diff --git a/src/dispextern.h b/src/dispextern.h
index fd4d8ebec9d..8e792a50fb4 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1803,6 +1803,9 @@ struct it_slice
1803 Lisp_Object height; 1803 Lisp_Object height;
1804}; 1804};
1805 1805
1806/* Input sources for fetching characters or data to display.
1807 The input source is found in the `method' field. */
1808
1806enum it_method { 1809enum it_method {
1807 GET_FROM_BUFFER = 0, 1810 GET_FROM_BUFFER = 0,
1808 GET_FROM_DISPLAY_VECTOR, 1811 GET_FROM_DISPLAY_VECTOR,
@@ -1904,20 +1907,27 @@ struct it
1904 position in overlay strings etc. */ 1907 position in overlay strings etc. */
1905 struct display_pos current; 1908 struct display_pos current;
1906 1909
1910 /* Total number of overlay strings to process. This can be >
1911 OVERLAY_STRING_CHUNK_SIZE. */
1912 int n_overlay_strings;
1913
1907 /* Vector of overlays to process. Overlay strings are processed 1914 /* Vector of overlays to process. Overlay strings are processed
1908 OVERLAY_STRING_CHUNK_SIZE at a time. */ 1915 OVERLAY_STRING_CHUNK_SIZE at a time. */
1909#define OVERLAY_STRING_CHUNK_SIZE 16 1916#define OVERLAY_STRING_CHUNK_SIZE 16
1910 Lisp_Object overlay_strings[OVERLAY_STRING_CHUNK_SIZE]; 1917 Lisp_Object overlay_strings[OVERLAY_STRING_CHUNK_SIZE];
1911 1918
1912 /* Total number of overlay strings to process. This can be > 1919 /* For each overlay string, the overlay it came from. */
1913 OVERLAY_STRING_CHUNK_SIZE. */ 1920 Lisp_Object string_overlays[OVERLAY_STRING_CHUNK_SIZE];
1914 int n_overlay_strings;
1915 1921
1916 /* If non-nil, a Lisp string being processed. If 1922 /* If non-nil, a Lisp string being processed. If
1917 current.overlay_string_index >= 0, this is an overlay string from 1923 current.overlay_string_index >= 0, this is an overlay string from
1918 pos. */ 1924 pos. */
1919 Lisp_Object string; 1925 Lisp_Object string;
1920 1926
1927 /* If non-nil, we are processing a string that came
1928 from a `display' property given by an overlay. */
1929 Lisp_Object from_overlay;
1930
1921 /* Stack of saved values. New entries are pushed when we begin to 1931 /* Stack of saved values. New entries are pushed when we begin to
1922 process an overlay string or a string from a `glyph' property. 1932 process an overlay string or a string from a `glyph' property.
1923 Entries are popped when we return to deliver display elements 1933 Entries are popped when we return to deliver display elements
@@ -1953,6 +1963,7 @@ struct it
1953 /* current text and display positions. */ 1963 /* current text and display positions. */
1954 struct text_pos position; 1964 struct text_pos position;
1955 struct display_pos current; 1965 struct display_pos current;
1966 Lisp_Object from_overlay;
1956 enum glyph_row_area area; 1967 enum glyph_row_area area;
1957 enum it_method method; 1968 enum it_method method;
1958 unsigned multibyte_p : 1; 1969 unsigned multibyte_p : 1;
@@ -1969,13 +1980,6 @@ struct it
1969 /* Stack pointer. */ 1980 /* Stack pointer. */
1970 int sp; 1981 int sp;
1971 1982
1972 /* Setting of buffer-local variable selective-display-ellipsis. */
1973 unsigned selective_display_ellipsis_p : 1;
1974
1975 /* 1 means control characters are translated into the form `^C'
1976 where the `^' can be replaced by a display table entry. */
1977 unsigned ctl_arrow_p : 1;
1978
1979 /* -1 means selective display hides everything between a \r and the 1983 /* -1 means selective display hides everything between a \r and the
1980 next newline; > 0 means hide lines indented more than that value. */ 1984 next newline; > 0 means hide lines indented more than that value. */
1981 int selective; 1985 int selective;
@@ -1987,6 +1991,16 @@ struct it
1987 /* Face to use. */ 1991 /* Face to use. */
1988 int face_id; 1992 int face_id;
1989 1993
1994 /* Setting of buffer-local variable selective-display-ellipsis. */
1995 unsigned selective_display_ellipsis_p : 1;
1996
1997 /* 1 means control characters are translated into the form `^C'
1998 where the `^' can be replaced by a display table entry. */
1999 unsigned ctl_arrow_p : 1;
2000
2001 /* 1 means lines are truncated. */
2002 unsigned truncate_lines_p : 1;
2003
1990 /* Non-zero means that the current face has a box. */ 2004 /* Non-zero means that the current face has a box. */
1991 unsigned face_box_p : 1; 2005 unsigned face_box_p : 1;
1992 2006
@@ -2066,9 +2080,6 @@ struct it
2066 Lisp_Object object; 2080 Lisp_Object object;
2067 struct text_pos position; 2081 struct text_pos position;
2068 2082
2069 /* 1 means lines are truncated. */
2070 unsigned truncate_lines_p : 1;
2071
2072 /* Number of columns per \t. */ 2083 /* Number of columns per \t. */
2073 short tab_width; 2084 short tab_width;
2074 2085
@@ -2845,6 +2856,9 @@ void free_frame_faces P_ ((struct frame *));
2845void recompute_basic_faces P_ ((struct frame *)); 2856void recompute_basic_faces P_ ((struct frame *));
2846int face_at_buffer_position P_ ((struct window *, int, int, int, int *, 2857int face_at_buffer_position P_ ((struct window *, int, int, int, int *,
2847 int, int)); 2858 int, int));
2859int face_for_overlay_string P_ ((struct window *, int, int,
2860 int, int *,
2861 int, int, Lisp_Object));
2848int face_at_string_position P_ ((struct window *, Lisp_Object, int, int, int, 2862int face_at_string_position P_ ((struct window *, Lisp_Object, int, int, int,
2849 int, int *, enum face_id, int)); 2863 int, int *, enum face_id, int));
2850int merge_faces P_ ((struct frame *, Lisp_Object, int, int)); 2864int merge_faces P_ ((struct frame *, Lisp_Object, int, int));
diff --git a/src/emacs.c b/src/emacs.c
index 2d47114e16d..8a51b8cb8e4 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -2510,8 +2510,9 @@ The value is nil if that directory's name is not known. */);
2510 2510
2511 DEFVAR_LISP ("installation-directory", &Vinstallation_directory, 2511 DEFVAR_LISP ("installation-directory", &Vinstallation_directory,
2512 doc: /* A directory within which to look for the `lib-src' and `etc' directories. 2512 doc: /* A directory within which to look for the `lib-src' and `etc' directories.
2513This is non-nil when we can't find those directories in their standard installed 2513This is non-nil when we can't find those directories in their standard
2514locations, but we can find them near where the Emacs executable was found. */); 2514installed locations, but we can find them near where the Emacs executable
2515was found. */);
2515 Vinstallation_directory = Qnil; 2516 Vinstallation_directory = Qnil;
2516 2517
2517 DEFVAR_LISP ("system-messages-locale", &Vsystem_messages_locale, 2518 DEFVAR_LISP ("system-messages-locale", &Vsystem_messages_locale,
diff --git a/src/macfns.c b/src/macfns.c
index 56ef81c9701..9161a0b6c6e 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -4644,8 +4644,8 @@ ID is specified by either an integer or a float. */)
4644 Lisp_Object result; 4644 Lisp_Object result;
4645 4645
4646 check_mac (); 4646 check_mac ();
4647 CHECK_NUMBER_OR_FLOAT(id); 4647 CHECK_NUMBER_OR_FLOAT (id);
4648 font_id = NUMBERP (id) ? XINT (id) : (ATSUFontID) XFLOAT (id); 4648 font_id = INTEGERP (id) ? XINT (id) : XFLOAT_DATA (id);
4649 BLOCK_INPUT; 4649 BLOCK_INPUT;
4650 result = mac_atsu_font_face_attributes (font_id); 4650 result = mac_atsu_font_face_attributes (font_id);
4651 UNBLOCK_INPUT; 4651 UNBLOCK_INPUT;
diff --git a/src/textprop.c b/src/textprop.c
index e8ba1d87afc..f7b50755ed1 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -713,7 +713,7 @@ POSITION is at the end of OBJECT, both car and cdr are nil. */)
713 Lisp_Object overlay; 713 Lisp_Object overlay;
714 Lisp_Object val 714 Lisp_Object val
715 = get_char_property_and_overlay (position, prop, object, &overlay); 715 = get_char_property_and_overlay (position, prop, object, &overlay);
716 return Fcons(val, overlay); 716 return Fcons (val, overlay);
717} 717}
718 718
719 719
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index e9664f94bbc..3646aec6983 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -443,15 +443,13 @@ unexec_regions_recorder (task_t task, void *rr, unsigned type,
443 443
444 while (num && num_unexec_regions < MAX_UNEXEC_REGIONS) 444 while (num && num_unexec_regions < MAX_UNEXEC_REGIONS)
445 { 445 {
446 /* Subtract the size of trailing null pages from filesize. It 446 /* Subtract the size of trailing null bytes from filesize. It
447 can be smaller than vmsize in segment commands. In such a 447 can be smaller than vmsize in segment commands. In such a
448 case, trailing pages are initialized with zeros. */ 448 case, trailing bytes are initialized with zeros. */
449 for (p = ranges->address + ranges->size; p > ranges->address; 449 for (p = ranges->address + ranges->size; p > ranges->address; p--)
450 p -= sizeof (int)) 450 if (*(((char *) p)-1))
451 if (*(((int *) p)-1)) 451 break;
452 break; 452 filesize = p - ranges->address;
453 filesize = ROUNDUP_TO_PAGE_BOUNDARY (p - ranges->address);
454 assert (filesize <= ranges->size);
455 453
456 unexec_regions[num_unexec_regions].filesize = filesize; 454 unexec_regions[num_unexec_regions].filesize = filesize;
457 unexec_regions[num_unexec_regions++].range = *ranges; 455 unexec_regions[num_unexec_regions++].range = *ranges;
@@ -503,11 +501,19 @@ unexec_regions_merge ()
503{ 501{
504 int i, n; 502 int i, n;
505 unexec_region_info r; 503 unexec_region_info r;
504 vm_size_t padsize;
506 505
507 qsort (unexec_regions, num_unexec_regions, sizeof (unexec_regions[0]), 506 qsort (unexec_regions, num_unexec_regions, sizeof (unexec_regions[0]),
508 &unexec_regions_sort_compare); 507 &unexec_regions_sort_compare);
509 n = 0; 508 n = 0;
510 r = unexec_regions[0]; 509 r = unexec_regions[0];
510 padsize = r.range.address & (pagesize - 1);
511 if (padsize)
512 {
513 r.range.address -= padsize;
514 r.range.size += padsize;
515 r.filesize += padsize;
516 }
511 for (i = 1; i < num_unexec_regions; i++) 517 for (i = 1; i < num_unexec_regions; i++)
512 { 518 {
513 if (r.range.address + r.range.size == unexec_regions[i].range.address 519 if (r.range.address + r.range.size == unexec_regions[i].range.address
@@ -520,6 +526,17 @@ unexec_regions_merge ()
520 { 526 {
521 unexec_regions[n++] = r; 527 unexec_regions[n++] = r;
522 r = unexec_regions[i]; 528 r = unexec_regions[i];
529 padsize = r.range.address & (pagesize - 1);
530 if (padsize)
531 {
532 if ((unexec_regions[n-1].range.address
533 + unexec_regions[n-1].range.size) == r.range.address)
534 unexec_regions[n-1].range.size -= padsize;
535
536 r.range.address -= padsize;
537 r.range.size += padsize;
538 r.filesize += padsize;
539 }
523 } 540 }
524 } 541 }
525 unexec_regions[n++] = r; 542 unexec_regions[n++] = r;
@@ -562,6 +579,11 @@ print_load_command_name (int lc)
562 case LC_TWOLEVEL_HINTS: 579 case LC_TWOLEVEL_HINTS:
563 printf ("LC_TWOLEVEL_HINTS"); 580 printf ("LC_TWOLEVEL_HINTS");
564 break; 581 break;
582#ifdef LC_UUID
583 case LC_UUID:
584 printf ("LC_UUID ");
585 break;
586#endif
565 default: 587 default:
566 printf ("unknown "); 588 printf ("unknown ");
567 } 589 }
diff --git a/src/xdisp.c b/src/xdisp.c
index 43e5a953e50..ed8d54cfaef 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -954,8 +954,8 @@ static void compute_string_pos P_ ((struct text_pos *, struct text_pos,
954static int face_before_or_after_it_pos P_ ((struct it *, int)); 954static int face_before_or_after_it_pos P_ ((struct it *, int));
955static int next_overlay_change P_ ((int)); 955static int next_overlay_change P_ ((int));
956static int handle_single_display_spec P_ ((struct it *, Lisp_Object, 956static int handle_single_display_spec P_ ((struct it *, Lisp_Object,
957 Lisp_Object, struct text_pos *, 957 Lisp_Object, Lisp_Object,
958 int)); 958 struct text_pos *, int));
959static int underlying_face_id P_ ((struct it *)); 959static int underlying_face_id P_ ((struct it *));
960static int in_ellipses_for_invisible_text_p P_ ((struct display_pos *, 960static int in_ellipses_for_invisible_text_p P_ ((struct display_pos *,
961 struct window *)); 961 struct window *));
@@ -3060,16 +3060,18 @@ handle_stop (it)
3060 if (it->method == GET_FROM_DISPLAY_VECTOR) 3060 if (it->method == GET_FROM_DISPLAY_VECTOR)
3061 handle_overlay_change_p = 0; 3061 handle_overlay_change_p = 0;
3062 3062
3063 /* Handle overlay changes. */ 3063 /* Handle overlay changes.
3064 This sets HANDLED to HANDLED_RECOMPUTE_PROPS
3065 if it finds overlays. */
3064 if (handle_overlay_change_p) 3066 if (handle_overlay_change_p)
3065 handled = handle_overlay_change (it); 3067 handled = handle_overlay_change (it);
3066
3067 /* Determine where to stop next. */
3068 if (handled == HANDLED_NORMALLY)
3069 compute_stop_pos (it);
3070 } 3068 }
3071 } 3069 }
3072 while (handled == HANDLED_RECOMPUTE_PROPS); 3070 while (handled == HANDLED_RECOMPUTE_PROPS);
3071
3072 /* Determine where to stop next. */
3073 if (handled == HANDLED_NORMALLY)
3074 compute_stop_pos (it);
3073} 3075}
3074 3076
3075 3077
@@ -3350,18 +3352,58 @@ handle_face_prop (it)
3350 else 3352 else
3351 { 3353 {
3352 int base_face_id, bufpos; 3354 int base_face_id, bufpos;
3355 int i;
3356 Lisp_Object from_overlay
3357 = (it->current.overlay_string_index >= 0
3358 ? it->string_overlays[it->current.overlay_string_index]
3359 : Qnil);
3360
3361 /* See if we got to this string directly or indirectly from
3362 an overlay property. That includes the before-string or
3363 after-string of an overlay, strings in display properties
3364 provided by an overlay, their text properties, etc.
3365
3366 FROM_OVERLAY is the overlay that brought us here, or nil if none. */
3367 if (! NILP (from_overlay))
3368 for (i = it->sp - 1; i >= 0; i--)
3369 {
3370 if (it->stack[i].current.overlay_string_index >= 0)
3371 from_overlay
3372 = it->string_overlays[it->stack[i].current.overlay_string_index];
3373 else if (! NILP (it->stack[i].from_overlay))
3374 from_overlay = it->stack[i].from_overlay;
3353 3375
3354 if (it->current.overlay_string_index >= 0) 3376 if (!NILP (from_overlay))
3355 bufpos = IT_CHARPOS (*it); 3377 break;
3378 }
3379
3380 if (! NILP (from_overlay))
3381 {
3382 bufpos = IT_CHARPOS (*it);
3383 /* For a string from an overlay, the base face depends
3384 only on text properties and ignores overlays. */
3385 base_face_id
3386 = face_for_overlay_string (it->w,
3387 IT_CHARPOS (*it),
3388 it->region_beg_charpos,
3389 it->region_end_charpos,
3390 &next_stop,
3391 (IT_CHARPOS (*it)
3392 + TEXT_PROP_DISTANCE_LIMIT),
3393 0,
3394 from_overlay);
3395 }
3356 else 3396 else
3357 bufpos = 0; 3397 {
3398 bufpos = 0;
3358 3399
3359 /* For strings from a buffer, i.e. overlay strings or strings 3400 /* For strings from a `display' property, use the face at
3360 from a `display' property, use the face at IT's current 3401 IT's current buffer position as the base face to merge
3361 buffer position as the base face to merge with, so that 3402 with, so that overlay strings appear in the same face as
3362 overlay strings appear in the same face as surrounding 3403 surrounding text, unless they specify their own
3363 text, unless they specify their own faces. */ 3404 faces. */
3364 base_face_id = underlying_face_id (it); 3405 base_face_id = underlying_face_id (it);
3406 }
3365 3407
3366 new_face_id = face_at_string_position (it->w, 3408 new_face_id = face_at_string_position (it->w,
3367 it->string, 3409 it->string,
@@ -3772,7 +3814,7 @@ static enum prop_handled
3772handle_display_prop (it) 3814handle_display_prop (it)
3773 struct it *it; 3815 struct it *it;
3774{ 3816{
3775 Lisp_Object prop, object; 3817 Lisp_Object prop, object, overlay;
3776 struct text_pos *position; 3818 struct text_pos *position;
3777 /* Nonzero if some property replaces the display of the text itself. */ 3819 /* Nonzero if some property replaces the display of the text itself. */
3778 int display_replaced_p = 0; 3820 int display_replaced_p = 0;
@@ -3800,10 +3842,12 @@ handle_display_prop (it)
3800 if (!it->string_from_display_prop_p) 3842 if (!it->string_from_display_prop_p)
3801 it->area = TEXT_AREA; 3843 it->area = TEXT_AREA;
3802 3844
3803 prop = Fget_char_property (make_number (position->charpos), 3845 prop = get_char_property_and_overlay (make_number (position->charpos),
3804 Qdisplay, object); 3846 Qdisplay, object, &overlay);
3805 if (NILP (prop)) 3847 if (NILP (prop))
3806 return HANDLED_NORMALLY; 3848 return HANDLED_NORMALLY;
3849 /* Now OVERLAY is the overlay that gave us this property, or nil
3850 if it was a text property. */
3807 3851
3808 if (!STRINGP (it->string)) 3852 if (!STRINGP (it->string))
3809 object = it->w->buffer; 3853 object = it->w->buffer;
@@ -3825,7 +3869,7 @@ handle_display_prop (it)
3825 { 3869 {
3826 for (; CONSP (prop); prop = XCDR (prop)) 3870 for (; CONSP (prop); prop = XCDR (prop))
3827 { 3871 {
3828 if (handle_single_display_spec (it, XCAR (prop), object, 3872 if (handle_single_display_spec (it, XCAR (prop), object, overlay,
3829 position, display_replaced_p)) 3873 position, display_replaced_p))
3830 { 3874 {
3831 display_replaced_p = 1; 3875 display_replaced_p = 1;
@@ -3840,7 +3884,7 @@ handle_display_prop (it)
3840 { 3884 {
3841 int i; 3885 int i;
3842 for (i = 0; i < ASIZE (prop); ++i) 3886 for (i = 0; i < ASIZE (prop); ++i)
3843 if (handle_single_display_spec (it, AREF (prop, i), object, 3887 if (handle_single_display_spec (it, AREF (prop, i), object, overlay,
3844 position, display_replaced_p)) 3888 position, display_replaced_p))
3845 { 3889 {
3846 display_replaced_p = 1; 3890 display_replaced_p = 1;
@@ -3852,7 +3896,8 @@ handle_display_prop (it)
3852 } 3896 }
3853 else 3897 else
3854 { 3898 {
3855 int ret = handle_single_display_spec (it, prop, object, position, 0); 3899 int ret = handle_single_display_spec (it, prop, object, overlay,
3900 position, 0);
3856 if (ret < 0) /* Replaced by "", i.e. nothing. */ 3901 if (ret < 0) /* Replaced by "", i.e. nothing. */
3857 return HANDLED_RECOMPUTE_PROPS; 3902 return HANDLED_RECOMPUTE_PROPS;
3858 if (ret) 3903 if (ret)
@@ -3894,6 +3939,9 @@ display_prop_end (it, object, start_pos)
3894 replaced text display with something else, for example an image; 3939 replaced text display with something else, for example an image;
3895 we ignore such properties after the first one has been processed. 3940 we ignore such properties after the first one has been processed.
3896 3941
3942 OVERLAY is the overlay this `display' property came from,
3943 or nil if it was a text property.
3944
3897 If PROP is a `space' or `image' specification, and in some other 3945 If PROP is a `space' or `image' specification, and in some other
3898 cases too, set *POSITION to the position where the `display' 3946 cases too, set *POSITION to the position where the `display'
3899 property ends. 3947 property ends.
@@ -3903,11 +3951,12 @@ display_prop_end (it, object, start_pos)
3903 "something" is "nothing". */ 3951 "something" is "nothing". */
3904 3952
3905static int 3953static int
3906handle_single_display_spec (it, spec, object, position, 3954handle_single_display_spec (it, spec, object, overlay, position,
3907 display_replaced_before_p) 3955 display_replaced_before_p)
3908 struct it *it; 3956 struct it *it;
3909 Lisp_Object spec; 3957 Lisp_Object spec;
3910 Lisp_Object object; 3958 Lisp_Object object;
3959 Lisp_Object overlay;
3911 struct text_pos *position; 3960 struct text_pos *position;
3912 int display_replaced_before_p; 3961 int display_replaced_before_p;
3913{ 3962{
@@ -4017,7 +4066,7 @@ handle_single_display_spec (it, spec, object, position,
4017 return 0; 4066 return 0;
4018 } 4067 }
4019 4068
4020 /* Handle `(space_width WIDTH)'. */ 4069 /* Handle `(space-width WIDTH)'. */
4021 if (CONSP (spec) 4070 if (CONSP (spec)
4022 && EQ (XCAR (spec), Qspace_width) 4071 && EQ (XCAR (spec), Qspace_width)
4023 && CONSP (XCDR (spec))) 4072 && CONSP (XCDR (spec)))
@@ -4141,6 +4190,7 @@ handle_single_display_spec (it, spec, object, position,
4141 it->position = start_pos; 4190 it->position = start_pos;
4142 it->object = NILP (object) ? it->w->buffer : object; 4191 it->object = NILP (object) ? it->w->buffer : object;
4143 it->method = GET_FROM_IMAGE; 4192 it->method = GET_FROM_IMAGE;
4193 it->from_overlay = Qnil;
4144 it->face_id = face_id; 4194 it->face_id = face_id;
4145 4195
4146 /* Say that we haven't consumed the characters with 4196 /* Say that we haven't consumed the characters with
@@ -4211,6 +4261,7 @@ handle_single_display_spec (it, spec, object, position,
4211 it->position = *position; 4261 it->position = *position;
4212 push_it (it); 4262 push_it (it);
4213 it->position = save_pos; 4263 it->position = save_pos;
4264 it->from_overlay = overlay;
4214 4265
4215 if (NILP (location)) 4266 if (NILP (location))
4216 it->area = TEXT_AREA; 4267 it->area = TEXT_AREA;
@@ -4854,7 +4905,10 @@ load_overlay_strings (it, charpos)
4854 i = 0; 4905 i = 0;
4855 j = it->current.overlay_string_index; 4906 j = it->current.overlay_string_index;
4856 while (i < OVERLAY_STRING_CHUNK_SIZE && j < n) 4907 while (i < OVERLAY_STRING_CHUNK_SIZE && j < n)
4857 it->overlay_strings[i++] = entries[j++].string; 4908 {
4909 it->overlay_strings[i++] = entries[j++].string;
4910 it->string_overlays[i++] = entries[j++].overlay;
4911 }
4858 4912
4859 CHECK_IT (it); 4913 CHECK_IT (it);
4860} 4914}
@@ -4900,6 +4954,7 @@ get_overlay_strings_1 (it, charpos, compute_stop_p)
4900 string. */ 4954 string. */
4901 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; 4955 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0;
4902 it->string = it->overlay_strings[0]; 4956 it->string = it->overlay_strings[0];
4957 it->from_overlay = Qnil;
4903 it->stop_charpos = 0; 4958 it->stop_charpos = 0;
4904 xassert (STRINGP (it->string)); 4959 xassert (STRINGP (it->string));
4905 it->end_charpos = SCHARS (it->string); 4960 it->end_charpos = SCHARS (it->string);
@@ -4953,6 +5008,7 @@ push_it (it)
4953 p->face_id = it->face_id; 5008 p->face_id = it->face_id;
4954 p->string = it->string; 5009 p->string = it->string;
4955 p->method = it->method; 5010 p->method = it->method;
5011 p->from_overlay = it->from_overlay;
4956 switch (p->method) 5012 switch (p->method)
4957 { 5013 {
4958 case GET_FROM_IMAGE: 5014 case GET_FROM_IMAGE:
@@ -5006,6 +5062,7 @@ pop_it (it)
5006 it->current = p->current; 5062 it->current = p->current;
5007 it->position = p->position; 5063 it->position = p->position;
5008 it->string = p->string; 5064 it->string = p->string;
5065 it->from_overlay = p->from_overlay;
5009 if (NILP (it->string)) 5066 if (NILP (it->string))
5010 SET_TEXT_POS (it->current.string_pos, -1, -1); 5067 SET_TEXT_POS (it->current.string_pos, -1, -1);
5011 it->method = p->method; 5068 it->method = p->method;
@@ -17388,7 +17445,9 @@ are the selected window and the window's buffer). */)
17388 buffer = w->buffer; 17445 buffer = w->buffer;
17389 CHECK_BUFFER (buffer); 17446 CHECK_BUFFER (buffer);
17390 17447
17391 if (NILP (format)) 17448 /* Make formatting the modeline a non-op when noninteractive, otherwise
17449 there will be problems later caused by a partially initialized frame. */
17450 if (NILP (format) || noninteractive)
17392 return empty_unibyte_string; 17451 return empty_unibyte_string;
17393 17452
17394 if (no_props) 17453 if (no_props)
diff --git a/src/xfaces.c b/src/xfaces.c
index 5e396d8bf6e..36bbacb84ce 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -7732,6 +7732,85 @@ face_at_buffer_position (w, pos, region_beg, region_end,
7732 return lookup_face (f, attrs, 0, NULL); 7732 return lookup_face (f, attrs, 0, NULL);
7733} 7733}
7734 7734
7735/* Return the face ID at buffer position POS for displaying ASCII
7736 characters associated with overlay strings for overlay OVERLAY.
7737
7738 Like face_at_buffer_position except for OVERLAY. Currently it
7739 simply disregards the `face' properties of all overlays. */
7740
7741int
7742face_for_overlay_string (w, pos, region_beg, region_end,
7743 endptr, limit, mouse, overlay)
7744 struct window *w;
7745 int pos;
7746 int region_beg, region_end;
7747 int *endptr;
7748 int limit;
7749 int mouse;
7750 Lisp_Object overlay;
7751{
7752 struct frame *f = XFRAME (w->frame);
7753 Lisp_Object attrs[LFACE_VECTOR_SIZE];
7754 Lisp_Object prop, position;
7755 int i, noverlays;
7756 Lisp_Object *overlay_vec;
7757 Lisp_Object frame;
7758 int endpos;
7759 Lisp_Object propname = mouse ? Qmouse_face : Qface;
7760 Lisp_Object limit1, end;
7761 struct face *default_face;
7762
7763 /* W must display the current buffer. We could write this function
7764 to use the frame and buffer of W, but right now it doesn't. */
7765 /* xassert (XBUFFER (w->buffer) == current_buffer); */
7766
7767 XSETFRAME (frame, f);
7768 XSETFASTINT (position, pos);
7769
7770 endpos = ZV;
7771 if (pos < region_beg && region_beg < endpos)
7772 endpos = region_beg;
7773
7774 /* Get the `face' or `mouse_face' text property at POS, and
7775 determine the next position at which the property changes. */
7776 prop = Fget_text_property (position, propname, w->buffer);
7777 XSETFASTINT (limit1, (limit < endpos ? limit : endpos));
7778 end = Fnext_single_property_change (position, propname, w->buffer, limit1);
7779 if (INTEGERP (end))
7780 endpos = XINT (end);
7781
7782 *endptr = endpos;
7783
7784 default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
7785
7786 /* Optimize common cases where we can use the default face. */
7787 if (NILP (prop)
7788 && !(pos >= region_beg && pos < region_end))
7789 return DEFAULT_FACE_ID;
7790
7791 /* Begin with attributes from the default face. */
7792 bcopy (default_face->lface, attrs, sizeof attrs);
7793
7794 /* Merge in attributes specified via text properties. */
7795 if (!NILP (prop))
7796 merge_face_ref (f, prop, attrs, 1, 0);
7797
7798 /* If in the region, merge in the region face. */
7799 if (pos >= region_beg && pos < region_end)
7800 {
7801 merge_named_face (f, Qregion, attrs, 0);
7802
7803 if (region_end < endpos)
7804 endpos = region_end;
7805 }
7806
7807 *endptr = endpos;
7808
7809 /* Look up a realized face with the given face attributes,
7810 or realize a new one for ASCII characters. */
7811 return lookup_face (f, attrs, 0, NULL);
7812}
7813
7735 7814
7736/* Compute the face at character position POS in Lisp string STRING on 7815/* Compute the face at character position POS in Lisp string STRING on
7737 window W, for ASCII characters. 7816 window W, for ASCII characters.