Lisp_Object Qinhibit_eval_during_redisplay;
Lisp_Object Qbuffer_position, Qposition, Qobject;
+Lisp_Object Qrisky_local_variable;
+
/* Holds the list (error). */
Lisp_Object list_of_error;
static int display_line P_ ((struct it *));
static int display_mode_lines P_ ((struct window *));
static int display_mode_line P_ ((struct window *, enum face_id, Lisp_Object));
-static int display_mode_element P_ ((struct it *, int, int, int, Lisp_Object, Lisp_Object));
+static int display_mode_element P_ ((struct it *, int, int, int, Lisp_Object, Lisp_Object, int));
static char *decode_mode_spec P_ ((struct window *, int, int, int, int *));
static void display_menu_bar P_ ((struct window *));
static int display_count_lines P_ ((int, int, int, int, int *));
/* Move iterator IT to a specified buffer or X position within one
line on the display without producing glyphs.
- Begin to skip at IT's current position. Skip to TO_CHARPOS or TO_X
- whichever is reached first.
-
- TO_CHARPOS <= 0 means no TO_CHARPOS is specified.
+ OP should be a bit mask including some or all of these bits:
+ MOVE_TO_X: Stop on reaching x-position TO_X.
+ MOVE_TO_POS: Stop on reaching buffer or string position TO_CHARPOS.
+ Regardless of OP's value, stop in reaching the end of the display line.
- TO_X < 0 means that no TO_X is specified. TO_X is normally a value
- 0 <= TO_X <= IT->last_visible_x. This means in particular, that
- TO_X includes the amount by which a window is horizontally
- scrolled.
+ TO_X is normally a value 0 <= TO_X <= IT->last_visible_x.
+ This means, in particular, that TO_X includes window's horizontal
+ scroll amount.
- Value is
+ The return value has several possible values that
+ say what condition caused the scan to stop:
MOVE_POS_MATCH_OR_ZV
- when TO_POS or ZV was reached.
frame_title_ptr = frame_title_buf;
init_iterator (&it, XWINDOW (f->selected_window), -1, -1,
NULL, DEFAULT_FACE_ID);
- display_mode_element (&it, 0, -1, -1, fmt, Qnil);
+ display_mode_element (&it, 0, -1, -1, fmt, Qnil, 0);
len = frame_title_ptr - frame_title_buf;
frame_title_ptr = NULL;
set_buffer_internal_1 (obuf);
kboard-local variables in the mode_line_format will get the right
values. */
push_frame_kboard (it.f);
- display_mode_element (&it, 0, 0, 0, format, Qnil);
+ display_mode_element (&it, 0, 0, 0, format, Qnil, 0);
pop_frame_kboard ();
/* Fill up with spaces. */
characters to display from ELT's representation. See
display_string for details.
- Returns the hpos of the end of the text generated by ELT. */
+ Returns the hpos of the end of the text generated by ELT.
+
+ PROPS is a property list to add to any string we encounter.
+
+ If RISKY is nonzero, remove (disregard) any properties in any string
+ we encounter, and ignore :eval and :propertize. */
static int
-display_mode_element (it, depth, field_width, precision, elt, props)
+display_mode_element (it, depth, field_width, precision, elt, props, risky)
struct it *it;
int depth;
int field_width, precision;
Lisp_Object elt, props;
+ int risky;
{
int n = 0, field, prec;
int literal = 0;
unsigned char c;
unsigned char *this, *lisp_string;
- if (!NILP (props))
+ if (!NILP (props) || risky)
{
Lisp_Object oprops, aelt;
oprops = Ftext_properties_at (make_number (0), elt);
- if (NILP (Fequal (props, oprops)))
+
+ if (NILP (Fequal (props, oprops)) || risky)
{
/* If the starting string has properties,
merge the specified ones onto the existing ones. */
- if (! NILP (oprops))
+ if (! NILP (oprops) && !risky)
{
Lisp_Object tem;
if (c == 'M')
n += display_mode_element (it, depth, field, prec,
- Vglobal_mode_string, props);
+ Vglobal_mode_string, props,
+ risky);
else if (c != 0)
{
int multibyte;
literally. */
{
register Lisp_Object tem;
+
+ /* If the variable is not marked as risky to set
+ then its contents are risky to use. */
+ if (NILP (Fget (elt, Qrisky_local_variable)))
+ risky = 1;
+
tem = Fboundp (elt);
if (!NILP (tem))
{
/* An element of the form (:eval FORM) means evaluate FORM
and use the result as mode line elements. */
+ if (risky)
+ break;
+
if (CONSP (XCDR (elt)))
{
Lisp_Object spec;
spec = safe_eval (XCAR (XCDR (elt)));
n += display_mode_element (it, depth, field_width - n,
- precision - n, spec, props);
+ precision - n, spec, props,
+ risky);
}
}
else if (EQ (car, QCpropertize))
{
+ /* An element of the form (:propertize ELT PROPS...)
+ means display ELT but applying properties PROPS. */
+
+ if (risky)
+ break;
+
if (CONSP (XCDR (elt)))
- {
- /* An element of the form (:propertize ELT PROPS...)
- means display ELT but applying properties PROPS. */
- n += display_mode_element (it, depth, field_width - n,
- precision - n, XCAR (XCDR (elt)),
- XCDR (XCDR (elt)));
- }
+ n += display_mode_element (it, depth, field_width - n,
+ precision - n, XCAR (XCDR (elt)),
+ XCDR (XCDR (elt)), risky);
}
else if (SYMBOLP (car))
{
&& (precision <= 0 || n < precision))
{
n += display_mode_element (it, depth, field_width - n,
- precision - n, XCAR (elt), props);
+ precision - n, XCAR (elt),
+ props, risky);
elt = XCDR (elt);
}
}
staticpro (&Qbuffer_position);
Qobject = intern ("object");
staticpro (&Qobject);
+ Qrisky_local_variable = intern ("risky-local-variable");
+ staticpro (&Qrisky_local_variable);
list_of_error = Fcons (intern ("error"), Qnil);
staticpro (&list_of_error);