emacs-devel
[Top][All Lists]
Advanced

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

Re: Tick Reduction


From: Lars Ingebrigtsen
Subject: Re: Tick Reduction
Date: Wed, 24 Nov 2021 18:50:45 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

> There's the display_prop_end function we normally use for that.

I don't quite understand.  If I have a max-width going from 5 to 15,
and a height going from 10 to 12, I think this function is going to be
called at 5, 10, 12 and 15?  I need to know that this consecutive series
of characters ends at 15.

It's the same issue when called from display_string -- the mode line
machinery will call the function several times, even if the :propertize
is around all the specs.

> I guessed that much, but again: if you just want to test that you are
> called from display_string, the test STRINGP (object) should be
> enough.

Ah, I see.

> And I'm confused by the fact that for buffers you test
>
>    if (bufpos > BEGV && EQ (FOO, BAR))
>
> whereas for a string you test
>
>    if (bufpos == 0 && !EQ (FOO, BAR))

The bufpos == 0 is just testing that we're being called from the mode
line (where it's always 0).

> The equivalent of BEGV in strings is zero, so I'd expect
>
>    if (bufpos > 0
>
> and also why is the first case tests equality, whereas the second one
> tests INequality?

Looks correct to me -- one is testing the start of the range and one is
testing whether we're at the end.

> IOW, the issue here AFAIU is that you might be called to display
> buffer text with this property or to display a Lisp string with this
> property, so the tests should be equivalent, and the only difference
> between strings and buffers is that text starts at BEGV in buffers but
> at zero in strings.  So why there are more differences that that?
> What am I missing?

Like I said, there's no strings -- only buffers and mode lines.  I.e.,
this doesn't work:

(string-pixel-width (propertize "foo" 'display '(min-width (1000))))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

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