GNU bug report logs - #24633
highlight-region func using (window-hscroll) in :align-to spec can cause inf loop

Previous Next

Package: emacs;

Reported by: npostavs <at> users.sourceforge.net

Date: Fri, 7 Oct 2016 01:02:01 UTC

Severity: normal

Tags: fixed

Found in versions 24.5, 25.1

Fixed in version 26

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


Message #15 received at 24633 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 24633 <at> debbugs.gnu.org
Subject: Re: 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
Eli Zaretskii <eliz <at> 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.




This bug report was last modified 8 years and 274 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.