aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader <[email protected]>2007-11-09 09:45:30 +0000
committerMiles Bader <[email protected]>2007-11-09 09:45:30 +0000
commitc12ecb0af9679cc0e2fa0409931c34c035763469 (patch)
treebd118c7ebc571de0dab542f48ad0c1648c6ccf72 /src
parente83d1fe87564d06d2fcbb4006dfd9133bc340aa8 (diff)
parent9d2185d10e3da9062672d96d3b59fcea31ff17ed (diff)
Merge from emacs--rel--22
Revision: [email protected]/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 d6a6b80f89..90338e217b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,60 @@
+2007-11-09 Chong Yidong <[email protected]>
+
+ * dispextern.h (struct it): Don't define OVERLAY_STRING_CHUNK_SIZE
+ twice.
+
+ * xdisp.c (handle_face_prop): Fix last change.
+
+2007-11-09 Richard Stallman <[email protected]>
+
+ * xdisp.c (handle_face_prop): Test for strings that came from overlays,
+ not just for after-strings and before-strings.
+ Call face_for_overlay_string and pass the overlay to it.
+ (handle_display_prop): Determine whether property came from an overlay.
+ Pass OVERLAY arg to handle_single_display_spec.
+ (handle_single_display_spec): New arg OVERLAY sets it->from_overlay.
+ (load_overlay_strings): Fill in it->string_overlays.
+ (get_overlay_strings_1, push_it, pop_it): Handle it->from_overlays.
+
+ * xfaces.c (face_for_overlay_string): Function renamed from
+ face_at_buffer_position_no_overlays, and add arg OVERLAY.
+
+ * dispextern.h (struct it): New elt string_overlays.
+ New elt from_overlay, also in stack.
+ Rearrange a few elements.
+ (face_for_overlay_string): Decl renamed from
+ face_at_buffer_position_no_overlays, and add argument.
+
+2007-11-09 Richard Stallman <[email protected]>
+
+ * xdisp.c (handle_face_prop): Use face_at_buffer_position_no_overlays
+ to get the base face for an overlay string.
+
+ * dispextern.h (face_at_buffer_position_no_overlays): Add decl.
+
+ * xfaces.c (face_at_buffer_position_no_overlays): New function.
+
+ * xdisp.c (handle_stop): Move some code out of loop.
+
+2007-11-09 YAMAMOTO Mitsuharu <[email protected]>
+
+ * macfns.c [USE_ATSUI] (Fmac_atsu_font_face_attributes):
+ Fix conversion from Lisp object to ATSUFontID.
+
+2007-11-09 Jason Rumney <[email protected]>
+
+ * xdisp.c (Fformat_mode_line): Do nothing when noninteractive.
+
+2007-11-09 YAMAMOTO Mitsuharu <[email protected]>
+
+ * unexmacosx.c (unexec_regions_recorder, unexec_regions_merge):
+ Don't assume regions are aligned to page boundary.
+ (print_load_command_name): Add LC_UUID if defined.
+
+2007-11-09 Richard Stallman <[email protected]>
+
+ * emacs.c (syms_of_emacs) <installation-directory>: Reflow docstring.
+
2007-11-07 Jason Rumney <[email protected]>
* s/windows95.h: Remove.
diff --git a/src/dispextern.h b/src/dispextern.h
index fd4d8ebec9..8e792a50fb 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1803,6 +1803,9 @@ struct it_slice
Lisp_Object height;
};
+/* Input sources for fetching characters or data to display.
+ The input source is found in the `method' field. */
+
enum it_method {
GET_FROM_BUFFER = 0,
GET_FROM_DISPLAY_VECTOR,
@@ -1904,20 +1907,27 @@ struct it
position in overlay strings etc. */
struct display_pos current;
+ /* Total number of overlay strings to process. This can be >
+ OVERLAY_STRING_CHUNK_SIZE. */
+ int n_overlay_strings;
+
/* Vector of overlays to process. Overlay strings are processed
OVERLAY_STRING_CHUNK_SIZE at a time. */
#define OVERLAY_STRING_CHUNK_SIZE 16
Lisp_Object overlay_strings[OVERLAY_STRING_CHUNK_SIZE];
- /* Total number of overlay strings to process. This can be >
- OVERLAY_STRING_CHUNK_SIZE. */
- int n_overlay_strings;
+ /* For each overlay string, the overlay it came from. */
+ Lisp_Object string_overlays[OVERLAY_STRING_CHUNK_SIZE];
/* If non-nil, a Lisp string being processed. If
current.overlay_string_index >= 0, this is an overlay string from
pos. */
Lisp_Object string;
+ /* If non-nil, we are processing a string that came
+ from a `display' property given by an overlay. */
+ Lisp_Object from_overlay;
+
/* Stack of saved values. New entries are pushed when we begin to
process an overlay string or a string from a `glyph' property.
Entries are popped when we return to deliver display elements
@@ -1953,6 +1963,7 @@ struct it
/* current text and display positions. */
struct text_pos position;
struct display_pos current;
+ Lisp_Object from_overlay;
enum glyph_row_area area;
enum it_method method;
unsigned multibyte_p : 1;
@@ -1969,13 +1980,6 @@ struct it
/* Stack pointer. */
int sp;
- /* Setting of buffer-local variable selective-display-ellipsis. */
- unsigned selective_display_ellipsis_p : 1;
-
- /* 1 means control characters are translated into the form `^C'
- where the `^' can be replaced by a display table entry. */
- unsigned ctl_arrow_p : 1;
-
/* -1 means selective display hides everything between a \r and the
next newline; > 0 means hide lines indented more than that value. */
int selective;
@@ -1987,6 +1991,16 @@ struct it
/* Face to use. */
int face_id;
+ /* Setting of buffer-local variable selective-display-ellipsis. */
+ unsigned selective_display_ellipsis_p : 1;
+
+ /* 1 means control characters are translated into the form `^C'
+ where the `^' can be replaced by a display table entry. */
+ unsigned ctl_arrow_p : 1;
+
+ /* 1 means lines are truncated. */
+ unsigned truncate_lines_p : 1;
+
/* Non-zero means that the current face has a box. */
unsigned face_box_p : 1;
@@ -2066,9 +2080,6 @@ struct it
Lisp_Object object;
struct text_pos position;
- /* 1 means lines are truncated. */
- unsigned truncate_lines_p : 1;
-
/* Number of columns per \t. */
short tab_width;
@@ -2845,6 +2856,9 @@ void free_frame_faces P_ ((struct frame *));
void recompute_basic_faces P_ ((struct frame *));
int face_at_buffer_position P_ ((struct window *, int, int, int, int *,
int, int));
+int face_for_overlay_string P_ ((struct window *, int, int,
+ int, int *,
+ int, int, Lisp_Object));
int face_at_string_position P_ ((struct window *, Lisp_Object, int, int, int,
int, int *, enum face_id, int));
int merge_faces P_ ((struct frame *, Lisp_Object, int, int));
diff --git a/src/emacs.c b/src/emacs.c
index 2d47114e16..8a51b8cb8e 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. */);
DEFVAR_LISP ("installation-directory", &Vinstallation_directory,
doc: /* A directory within which to look for the `lib-src' and `etc' directories.
-This is non-nil when we can't find those directories in their standard installed
-locations, but we can find them near where the Emacs executable was found. */);
+This is non-nil when we can't find those directories in their standard
+installed locations, but we can find them near where the Emacs executable
+was found. */);
Vinstallation_directory = Qnil;
DEFVAR_LISP ("system-messages-locale", &Vsystem_messages_locale,
diff --git a/src/macfns.c b/src/macfns.c
index 56ef81c970..9161a0b6c6 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -4644,8 +4644,8 @@ ID is specified by either an integer or a float. */)
Lisp_Object result;
check_mac ();
- CHECK_NUMBER_OR_FLOAT(id);
- font_id = NUMBERP (id) ? XINT (id) : (ATSUFontID) XFLOAT (id);
+ CHECK_NUMBER_OR_FLOAT (id);
+ font_id = INTEGERP (id) ? XINT (id) : XFLOAT_DATA (id);
BLOCK_INPUT;
result = mac_atsu_font_face_attributes (font_id);
UNBLOCK_INPUT;
diff --git a/src/textprop.c b/src/textprop.c
index e8ba1d87af..f7b50755ed 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. */)
Lisp_Object overlay;
Lisp_Object val
= get_char_property_and_overlay (position, prop, object, &overlay);
- return Fcons(val, overlay);
+ return Fcons (val, overlay);
}
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index e9664f94bb..3646aec698 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -443,15 +443,13 @@ unexec_regions_recorder (task_t task, void *rr, unsigned type,
while (num && num_unexec_regions < MAX_UNEXEC_REGIONS)
{
- /* Subtract the size of trailing null pages from filesize. It
+ /* Subtract the size of trailing null bytes from filesize. It
can be smaller than vmsize in segment commands. In such a
- case, trailing pages are initialized with zeros. */
- for (p = ranges->address + ranges->size; p > ranges->address;
- p -= sizeof (int))
- if (*(((int *) p)-1))
- break;
- filesize = ROUNDUP_TO_PAGE_BOUNDARY (p - ranges->address);
- assert (filesize <= ranges->size);
+ case, trailing bytes are initialized with zeros. */
+ for (p = ranges->address + ranges->size; p > ranges->address; p--)
+ if (*(((char *) p)-1))
+ break;
+ filesize = p - ranges->address;
unexec_regions[num_unexec_regions].filesize = filesize;
unexec_regions[num_unexec_regions++].range = *ranges;
@@ -503,11 +501,19 @@ unexec_regions_merge ()
{
int i, n;
unexec_region_info r;
+ vm_size_t padsize;
qsort (unexec_regions, num_unexec_regions, sizeof (unexec_regions[0]),
&unexec_regions_sort_compare);
n = 0;
r = unexec_regions[0];
+ padsize = r.range.address & (pagesize - 1);
+ if (padsize)
+ {
+ r.range.address -= padsize;
+ r.range.size += padsize;
+ r.filesize += padsize;
+ }
for (i = 1; i < num_unexec_regions; i++)
{
if (r.range.address + r.range.size == unexec_regions[i].range.address
@@ -520,6 +526,17 @@ unexec_regions_merge ()
{
unexec_regions[n++] = r;
r = unexec_regions[i];
+ padsize = r.range.address & (pagesize - 1);
+ if (padsize)
+ {
+ if ((unexec_regions[n-1].range.address
+ + unexec_regions[n-1].range.size) == r.range.address)
+ unexec_regions[n-1].range.size -= padsize;
+
+ r.range.address -= padsize;
+ r.range.size += padsize;
+ r.filesize += padsize;
+ }
}
}
unexec_regions[n++] = r;
@@ -562,6 +579,11 @@ print_load_command_name (int lc)
case LC_TWOLEVEL_HINTS:
printf ("LC_TWOLEVEL_HINTS");
break;
+#ifdef LC_UUID
+ case LC_UUID:
+ printf ("LC_UUID ");
+ break;
+#endif
default:
printf ("unknown ");
}
diff --git a/src/xdisp.c b/src/xdisp.c
index 43e5a953e5..ed8d54cfae 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,
static int face_before_or_after_it_pos P_ ((struct it *, int));
static int next_overlay_change P_ ((int));
static int handle_single_display_spec P_ ((struct it *, Lisp_Object,
- Lisp_Object, struct text_pos *,
- int));
+ Lisp_Object, Lisp_Object,
+ struct text_pos *, int));
static int underlying_face_id P_ ((struct it *));
static int in_ellipses_for_invisible_text_p P_ ((struct display_pos *,
struct window *));
@@ -3060,16 +3060,18 @@ handle_stop (it)
if (it->method == GET_FROM_DISPLAY_VECTOR)
handle_overlay_change_p = 0;
- /* Handle overlay changes. */
+ /* Handle overlay changes.
+ This sets HANDLED to HANDLED_RECOMPUTE_PROPS
+ if it finds overlays. */
if (handle_overlay_change_p)
handled = handle_overlay_change (it);
-
- /* Determine where to stop next. */
- if (handled == HANDLED_NORMALLY)
- compute_stop_pos (it);
}
}
while (handled == HANDLED_RECOMPUTE_PROPS);
+
+ /* Determine where to stop next. */
+ if (handled == HANDLED_NORMALLY)
+ compute_stop_pos (it);
}
@@ -3350,18 +3352,58 @@ handle_face_prop (it)
else
{
int base_face_id, bufpos;
+ int i;
+ Lisp_Object from_overlay
+ = (it->current.overlay_string_index >= 0
+ ? it->string_overlays[it->current.overlay_string_index]
+ : Qnil);
+
+ /* See if we got to this string directly or indirectly from
+ an overlay property. That includes the before-string or
+ after-string of an overlay, strings in display properties
+ provided by an overlay, their text properties, etc.
+
+ FROM_OVERLAY is the overlay that brought us here, or nil if none. */
+ if (! NILP (from_overlay))
+ for (i = it->sp - 1; i >= 0; i--)
+ {
+ if (it->stack[i].current.overlay_string_index >= 0)
+ from_overlay
+ = it->string_overlays[it->stack[i].current.overlay_string_index];
+ else if (! NILP (it->stack[i].from_overlay))
+ from_overlay = it->stack[i].from_overlay;
- if (it->current.overlay_string_index >= 0)
- bufpos = IT_CHARPOS (*it);
+ if (!NILP (from_overlay))
+ break;
+ }
+
+ if (! NILP (from_overlay))
+ {
+ bufpos = IT_CHARPOS (*it);
+ /* For a string from an overlay, the base face depends
+ only on text properties and ignores overlays. */
+ base_face_id
+ = face_for_overlay_string (it->w,
+ IT_CHARPOS (*it),
+ it->region_beg_charpos,
+ it->region_end_charpos,
+ &next_stop,
+ (IT_CHARPOS (*it)
+ + TEXT_PROP_DISTANCE_LIMIT),
+ 0,
+ from_overlay);
+ }
else
- bufpos = 0;
+ {
+ bufpos = 0;
- /* For strings from a buffer, i.e. overlay strings or strings
- from a `display' property, use the face at IT's current
- buffer position as the base face to merge with, so that
- overlay strings appear in the same face as surrounding
- text, unless they specify their own faces. */
- base_face_id = underlying_face_id (it);
+ /* For strings from a `display' property, use the face at
+ IT's current buffer position as the base face to merge
+ with, so that overlay strings appear in the same face as
+ surrounding text, unless they specify their own
+ faces. */
+ base_face_id = underlying_face_id (it);
+ }
new_face_id = face_at_string_position (it->w,
it->string,
@@ -3772,7 +3814,7 @@ static enum prop_handled
handle_display_prop (it)
struct it *it;
{
- Lisp_Object prop, object;
+ Lisp_Object prop, object, overlay;
struct text_pos *position;
/* Nonzero if some property replaces the display of the text itself. */
int display_replaced_p = 0;
@@ -3800,10 +3842,12 @@ handle_display_prop (it)
if (!it->string_from_display_prop_p)
it->area = TEXT_AREA;
- prop = Fget_char_property (make_number (position->charpos),
- Qdisplay, object);
+ prop = get_char_property_and_overlay (make_number (position->charpos),
+ Qdisplay, object, &overlay);
if (NILP (prop))
return HANDLED_NORMALLY;
+ /* Now OVERLAY is the overlay that gave us this property, or nil
+ if it was a text property. */
if (!STRINGP (it->string))
object = it->w->buffer;
@@ -3825,7 +3869,7 @@ handle_display_prop (it)
{
for (; CONSP (prop); prop = XCDR (prop))
{
- if (handle_single_display_spec (it, XCAR (prop), object,
+ if (handle_single_display_spec (it, XCAR (prop), object, overlay,
position, display_replaced_p))
{
display_replaced_p = 1;
@@ -3840,7 +3884,7 @@ handle_display_prop (it)
{
int i;
for (i = 0; i < ASIZE (prop); ++i)
- if (handle_single_display_spec (it, AREF (prop, i), object,
+ if (handle_single_display_spec (it, AREF (prop, i), object, overlay,
position, display_replaced_p))
{
display_replaced_p = 1;
@@ -3852,7 +3896,8 @@ handle_display_prop (it)
}
else
{
- int ret = handle_single_display_spec (it, prop, object, position, 0);
+ int ret = handle_single_display_spec (it, prop, object, overlay,
+ position, 0);
if (ret < 0) /* Replaced by "", i.e. nothing. */
return HANDLED_RECOMPUTE_PROPS;
if (ret)
@@ -3894,6 +3939,9 @@ display_prop_end (it, object, start_pos)
replaced text display with something else, for example an image;
we ignore such properties after the first one has been processed.
+ OVERLAY is the overlay this `display' property came from,
+ or nil if it was a text property.
+
If PROP is a `space' or `image' specification, and in some other
cases too, set *POSITION to the position where the `display'
property ends.
@@ -3903,11 +3951,12 @@ display_prop_end (it, object, start_pos)
"something" is "nothing". */
static int
-handle_single_display_spec (it, spec, object, position,
+handle_single_display_spec (it, spec, object, overlay, position,
display_replaced_before_p)
struct it *it;
Lisp_Object spec;
Lisp_Object object;
+ Lisp_Object overlay;
struct text_pos *position;
int display_replaced_before_p;
{
@@ -4017,7 +4066,7 @@ handle_single_display_spec (it, spec, object, position,
return 0;
}
- /* Handle `(space_width WIDTH)'. */
+ /* Handle `(space-width WIDTH)'. */
if (CONSP (spec)
&& EQ (XCAR (spec), Qspace_width)
&& CONSP (XCDR (spec)))
@@ -4141,6 +4190,7 @@ handle_single_display_spec (it, spec, object, position,
it->position = start_pos;
it->object = NILP (object) ? it->w->buffer : object;
it->method = GET_FROM_IMAGE;
+ it->from_overlay = Qnil;
it->face_id = face_id;
/* Say that we haven't consumed the characters with
@@ -4211,6 +4261,7 @@ handle_single_display_spec (it, spec, object, position,
it->position = *position;
push_it (it);
it->position = save_pos;
+ it->from_overlay = overlay;
if (NILP (location))
it->area = TEXT_AREA;
@@ -4854,7 +4905,10 @@ load_overlay_strings (it, charpos)
i = 0;
j = it->current.overlay_string_index;
while (i < OVERLAY_STRING_CHUNK_SIZE && j < n)
- it->overlay_strings[i++] = entries[j++].string;
+ {
+ it->overlay_strings[i++] = entries[j++].string;
+ it->string_overlays[i++] = entries[j++].overlay;
+ }
CHECK_IT (it);
}
@@ -4900,6 +4954,7 @@ get_overlay_strings_1 (it, charpos, compute_stop_p)
string. */
IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0;
it->string = it->overlay_strings[0];
+ it->from_overlay = Qnil;
it->stop_charpos = 0;
xassert (STRINGP (it->string));
it->end_charpos = SCHARS (it->string);
@@ -4953,6 +5008,7 @@ push_it (it)
p->face_id = it->face_id;
p->string = it->string;
p->method = it->method;
+ p->from_overlay = it->from_overlay;
switch (p->method)
{
case GET_FROM_IMAGE:
@@ -5006,6 +5062,7 @@ pop_it (it)
it->current = p->current;
it->position = p->position;
it->string = p->string;
+ it->from_overlay = p->from_overlay;
if (NILP (it->string))
SET_TEXT_POS (it->current.string_pos, -1, -1);
it->method = p->method;
@@ -17388,7 +17445,9 @@ are the selected window and the window's buffer). */)
buffer = w->buffer;
CHECK_BUFFER (buffer);
- if (NILP (format))
+ /* Make formatting the modeline a non-op when noninteractive, otherwise
+ there will be problems later caused by a partially initialized frame. */
+ if (NILP (format) || noninteractive)
return empty_unibyte_string;
if (no_props)
diff --git a/src/xfaces.c b/src/xfaces.c
index 5e396d8bf6..36bbacb84c 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -7732,6 +7732,85 @@ face_at_buffer_position (w, pos, region_beg, region_end,
return lookup_face (f, attrs, 0, NULL);
}
+/* Return the face ID at buffer position POS for displaying ASCII
+ characters associated with overlay strings for overlay OVERLAY.
+
+ Like face_at_buffer_position except for OVERLAY. Currently it
+ simply disregards the `face' properties of all overlays. */
+
+int
+face_for_overlay_string (w, pos, region_beg, region_end,
+ endptr, limit, mouse, overlay)
+ struct window *w;
+ int pos;
+ int region_beg, region_end;
+ int *endptr;
+ int limit;
+ int mouse;
+ Lisp_Object overlay;
+{
+ struct frame *f = XFRAME (w->frame);
+ Lisp_Object attrs[LFACE_VECTOR_SIZE];
+ Lisp_Object prop, position;
+ int i, noverlays;
+ Lisp_Object *overlay_vec;
+ Lisp_Object frame;
+ int endpos;
+ Lisp_Object propname = mouse ? Qmouse_face : Qface;
+ Lisp_Object limit1, end;
+ struct face *default_face;
+
+ /* W must display the current buffer. We could write this function
+ to use the frame and buffer of W, but right now it doesn't. */
+ /* xassert (XBUFFER (w->buffer) == current_buffer); */
+
+ XSETFRAME (frame, f);
+ XSETFASTINT (position, pos);
+
+ endpos = ZV;
+ if (pos < region_beg && region_beg < endpos)
+ endpos = region_beg;
+
+ /* Get the `face' or `mouse_face' text property at POS, and
+ determine the next position at which the property changes. */
+ prop = Fget_text_property (position, propname, w->buffer);
+ XSETFASTINT (limit1, (limit < endpos ? limit : endpos));
+ end = Fnext_single_property_change (position, propname, w->buffer, limit1);
+ if (INTEGERP (end))
+ endpos = XINT (end);
+
+ *endptr = endpos;
+
+ default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
+
+ /* Optimize common cases where we can use the default face. */
+ if (NILP (prop)
+ && !(pos >= region_beg && pos < region_end))
+ return DEFAULT_FACE_ID;
+
+ /* Begin with attributes from the default face. */
+ bcopy (default_face->lface, attrs, sizeof attrs);
+
+ /* Merge in attributes specified via text properties. */
+ if (!NILP (prop))
+ merge_face_ref (f, prop, attrs, 1, 0);
+
+ /* If in the region, merge in the region face. */
+ if (pos >= region_beg && pos < region_end)
+ {
+ merge_named_face (f, Qregion, attrs, 0);
+
+ if (region_end < endpos)
+ endpos = region_end;
+ }
+
+ *endptr = endpos;
+
+ /* Look up a realized face with the given face attributes,
+ or realize a new one for ASCII characters. */
+ return lookup_face (f, attrs, 0, NULL);
+}
+
/* Compute the face at character position POS in Lisp string STRING on
window W, for ASCII characters.