[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tick Reduction

From: Eli Zaretskii
Subject: Re: Tick Reduction
Date: Fri, 26 Nov 2021 14:56:42 +0200

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: dgutov@yandex.ru,  stefankangas@gmail.com,  emacs-devel@gnu.org
> Date: Fri, 26 Nov 2021 13:09:45 +0100
> Eli Zaretskii <eliz@gnu.org> writes:
> > Given this description, what exactly do you mean when you say you
> > don't understand "how the display (resulting from those C strings)
> > does have text properties"?  How do you see that "the display does
> > have text properties"?
> When hovering over "10%", Emacs displays the `help-echo' text property.

Ah, that.  It's an illusion which we create in this fragment from

                      case MODE_LINE_DISPLAY:
                          int nglyphs_before, nwritten;

                          nglyphs_before = it->glyph_row->used[TEXT_AREA];
                          nwritten = display_string (spec, string, elt,
                                                     charpos, 0, it,
                                                     field, prec, 0,

                          /* Assign to the glyphs written above the
                             string where the `%x' came from, position
                             of the `%'.  */
                          if (nwritten > 0)
                              struct glyph *glyph
                                = (it->glyph_row->glyphs[TEXT_AREA]
                                   + nglyphs_before);
                              int i;

                              for (i = 0; i < nwritten; ++i)
                                  glyph[i].object = elt;
                                  glyph[i].charpos = charpos;

                              n += nwritten;

As you see, after display_string (where any 'display' properties can
be consulted and acted upon) does its job and produces some glyphs for
display on the mode line, we manually assign to each produced glyph
the original object from which those glyphs came.  In this case, that
object is the Lisp string whose text is "%p" and whose text properties
include help-echo etc.  Then, when the mouse hovers over that part of
the mode line, the code in note_mode_line_or_margin_highlight examines
the object recorded in the glyph below the mouse pointer, and extracts
the help-echo stuff.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]