bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#24633: highlight-region func using (window-hscroll) in :align-to spe


From: npostavs
Subject: bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop
Date: Sat, 08 Oct 2016 13:17:37 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>
> Can you explain what do you expect this to do, and how/why?  It's hard
> to reverse-engineer this to glean the intent.

The high-level idea is to have a line from going from the left to the
right edge of the window.  Most of the line is composed of an overlay
specifying the :underline text property.  The last bit of it, from the
end of the text to the right edge of the screen, is created by an
underlined after-string space which uses :align-to to reach the right
edge of the screen.

Using :align-to 'right or :align-to `((,(window-body-width nil t))) does
not account for horizontal scrolling (i.e., the line ends at 80 columns,
even when the 80th column is scrolled to the left).  So I tried

    `(+ ,(window-hscroll) (0 . right))
    `(+ ,(window-hscroll) (,(window-body-width nil t))) ; initially this

to make up for it, which turns out to cause this strange looping.

>  In particular, I don't
> understand the align-to expression: e.g., window-hscroll returns its
> value in columns, while align-to needs pixels, AFAIU.

According to `(elisp) Pixel Specification',

       The form NUM specifies a fraction of the default frame font height
    or width.  The form `(NUM)' specifies an absolute number of pixels.

I interpreted "fraction of the default frame font" to mean that the
result of window-hscroll would be multiplied by the font width (it's a
plain number outside a list).

I tried now also `(+ (,(window-hscroll) . width) (0 . right)), which
gives the same result.

    The `width' and `height' units correspond to the default width and
    height of the current face.
    [...]
    A value of the form `(NUM . EXPR)' stands for the product of the
    values of NUM and EXPR.

By the way, I also tried `(+ (,(window-hscroll) . width)
(,(window-body-width nil t))) which again gives the same result.

>
> What I see in the debugger is that the display engine loops
> indefinitely, each time increasing the window's hscroll by 4 columns.
> IOW, the redisplay cycle never stops.
>
> Thanks.





reply via email to

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