[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/xdisp.c
From: |
Richard M. Stallman |
Subject: |
[Emacs-diffs] Changes to emacs/src/xdisp.c |
Date: |
Wed, 13 Feb 2002 11:15:54 -0500 |
Index: emacs/src/xdisp.c
diff -c emacs/src/xdisp.c:1.726 emacs/src/xdisp.c:1.727
*** emacs/src/xdisp.c:1.726 Mon Feb 11 09:43:46 2002
--- emacs/src/xdisp.c Wed Feb 13 11:15:52 2002
***************
*** 220,226 ****
Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions;
Lisp_Object Qredisplay_end_trigger_functions;
Lisp_Object Qinhibit_point_motion_hooks;
! Lisp_Object QCeval, Qwhen, QCfile, QCdata;
Lisp_Object Qfontified;
Lisp_Object Qgrow_only;
Lisp_Object Qinhibit_eval_during_redisplay;
--- 220,226 ----
Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions;
Lisp_Object Qredisplay_end_trigger_functions;
Lisp_Object Qinhibit_point_motion_hooks;
! Lisp_Object QCeval, Qwhen, QCfile, QCdata, QCpropertize;
Lisp_Object Qfontified;
Lisp_Object Qgrow_only;
Lisp_Object Qinhibit_eval_during_redisplay;
***************
*** 746,752 ****
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));
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 *));
--- 746,752 ----
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 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 *));
***************
*** 7249,7255 ****
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);
len = frame_title_ptr - frame_title_buf;
frame_title_ptr = NULL;
set_buffer_internal_1 (obuf);
--- 7249,7255 ----
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);
len = frame_title_ptr - frame_title_buf;
frame_title_ptr = NULL;
set_buffer_internal_1 (obuf);
***************
*** 13479,13485 ****
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);
pop_frame_kboard ();
/* Fill up with spaces. */
--- 13479,13485 ----
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);
pop_frame_kboard ();
/* Fill up with spaces. */
***************
*** 13505,13510 ****
--- 13505,13513 ----
return it.glyph_row->height;
}
+ /* Alist that caches the results of :propertize.
+ Each element is (PROPERTIZED-STRING . PROPERTY-LIST). */
+ Lisp_Object mode_line_proptrans_alist;
/* Contribute ELT to the mode line for window IT->w. How it
translates into text depends on its data type.
***************
*** 13522,13534 ****
Returns the hpos of the end of the text generated by ELT. */
static int
! display_mode_element (it, depth, field_width, precision, elt)
struct it *it;
int depth;
int field_width, precision;
! Lisp_Object elt;
{
int n = 0, field, prec;
tail_recurse:
if (depth > 10)
--- 13525,13538 ----
Returns the hpos of the end of the text generated by ELT. */
static int
! display_mode_element (it, depth, field_width, precision, elt, props)
struct it *it;
int depth;
int field_width, precision;
! Lisp_Object elt, props;
{
int n = 0, field, prec;
+ int literal = 0;
tail_recurse:
if (depth > 10)
***************
*** 13545,13550 ****
--- 13549,13586 ----
unsigned char *this = XSTRING (elt)->data;
unsigned char *lisp_string = this;
+ if (!NILP (props))
+ {
+ Lisp_Object oprops, aelt;
+ oprops = Ftext_properties_at (make_number (0), elt);
+ if (NILP (Fequal (props, oprops)))
+ {
+ aelt = Fassoc (elt, mode_line_proptrans_alist);
+ if (! NILP (aelt) && !NILP (Fequal (props, XCDR (aelt))))
+ elt = XCAR (aelt);
+ else
+ {
+ elt = Fcopy_sequence (elt);
+ Fset_text_properties (0, Flength (elt), props, elt);
+ mode_line_proptrans_alist
+ = Fcons (Fcons (elt, props),
+ mode_line_proptrans_alist);
+ }
+ }
+ }
+
+ if (literal)
+ {
+ prec = precision - n;
+ if (frame_title_ptr)
+ n += store_frame_title (XSTRING (elt)->data, -1, prec);
+ else
+ n += display_string (NULL, elt, Qnil, 0, 0, it,
+ 0, prec, 0, STRING_MULTIBYTE (elt));
+
+ break;
+ }
+
while ((precision <= 0 || n < precision)
&& *this
&& (frame_title_ptr
***************
*** 13597,13603 ****
if (c == 'M')
n += display_mode_element (it, depth, field, prec,
! Vglobal_mode_string);
else if (c != 0)
{
int multibyte;
--- 13633,13639 ----
if (c == 'M')
n += display_mode_element (it, depth, field, prec,
! Vglobal_mode_string, props);
else if (c != 0)
{
int multibyte;
***************
*** 13661,13675 ****
/* If value is a string, output that string literally:
don't check for % within it. */
if (STRINGP (tem))
! {
! prec = precision - n;
! if (frame_title_ptr)
! n += store_frame_title (XSTRING (tem)->data, -1, prec);
! else
! n += display_string (NULL, tem, Qnil, 0, 0, it,
! 0, prec, 0, STRING_MULTIBYTE (tem));
! }
! else if (!EQ (tem, elt))
{
/* Give up right away for nil or t. */
elt = tem;
--- 13697,13705 ----
/* If value is a string, output that string literally:
don't check for % within it. */
if (STRINGP (tem))
! literal = 1;
!
! if (!EQ (tem, elt))
{
/* Give up right away for nil or t. */
elt = tem;
***************
*** 13683,13689 ****
{
register Lisp_Object car, tem;
! /* A cons cell: three distinct cases.
If first element is a string or a cons, process all the elements
and effectively concatenate them.
If first element is a negative number, truncate displaying cdr to
--- 13713,13720 ----
{
register Lisp_Object car, tem;
! /* A cons cell: five distinct cases.
! If first element is :eval or :propertize, do something special.
If first element is a string or a cons, process all the elements
and effectively concatenate them.
If first element is a negative number, truncate displaying cdr to
***************
*** 13692,13709 ****
If first element is a symbol, process the cadr or caddr recursively
according to whether the symbol's value is non-nil or nil. */
car = XCAR (elt);
! if (EQ (car, QCeval) && CONSP (XCDR (elt)))
{
/* An element of the form (:eval FORM) means evaluate FORM
and use the result as mode line elements. */
- struct gcpro gcpro1;
- Lisp_Object spec;
! spec = safe_eval (XCAR (XCDR (elt)));
! GCPRO1 (spec);
! n += display_mode_element (it, depth, field_width - n,
! precision - n, spec);
! UNGCPRO;
}
else if (SYMBOLP (car))
{
--- 13723,13751 ----
If first element is a symbol, process the cadr or caddr recursively
according to whether the symbol's value is non-nil or nil. */
car = XCAR (elt);
! if (EQ (car, QCeval))
{
/* An element of the form (:eval FORM) means evaluate FORM
and use the result as mode line elements. */
! 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);
! }
! }
! else if (EQ (car, QCpropertize))
! {
! 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)));
! }
}
else if (SYMBOLP (car))
{
***************
*** 13768,13774 ****
&& (precision <= 0 || n < precision))
{
n += display_mode_element (it, depth, field_width - n,
! precision - n, XCAR (elt));
elt = XCDR (elt);
}
}
--- 13810,13816 ----
&& (precision <= 0 || n < precision))
{
n += display_mode_element (it, depth, field_width - n,
! precision - n, XCAR (elt), props);
elt = XCDR (elt);
}
}
***************
*** 14727,14732 ****
--- 14769,14776 ----
staticpro (&QCrelative_height);
QCeval = intern (":eval");
staticpro (&QCeval);
+ QCpropertize = intern (":propertize");
+ staticpro (&QCpropertize);
Qwhen = intern ("when");
staticpro (&Qwhen);
QCfile = intern (":file");
***************
*** 14771,14776 ****
--- 14815,14823 ----
Vmessages_buffer_name = build_string ("*Messages*");
staticpro (&Vmessages_buffer_name);
+
+ mode_line_proptrans_alist = Qnil;
+ staticpro (&mode_line_proptrans_alist);
DEFVAR_LISP ("show-trailing-whitespace", &Vshow_trailing_whitespace,
doc: /* Non-nil means highlight trailing whitespace.
- [Emacs-diffs] Changes to emacs/src/xdisp.c, Kim F. Storm, 2002/02/08
- [Emacs-diffs] Changes to emacs/src/xdisp.c, Eli Zaretskii, 2002/02/09
- [Emacs-diffs] Changes to emacs/src/xdisp.c, Kim F. Storm, 2002/02/11
- [Emacs-diffs] Changes to emacs/src/xdisp.c,
Richard M. Stallman <=
- [Emacs-diffs] Changes to emacs/src/xdisp.c, Eli Zaretskii, 2002/02/16
- [Emacs-diffs] Changes to emacs/src/xdisp.c, Kim F. Storm, 2002/02/26
- [Emacs-diffs] Changes to emacs/src/xdisp.c, Kim F. Storm, 2002/02/28
- [Emacs-diffs] Changes to emacs/src/xdisp.c, Kenichi Handa, 2002/02/28