unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Eli Zaretskii <eliz@gnu.org>
Cc: 24633@debbugs.gnu.org
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	[thread overview]
Message-ID: <874m4mwyj2.fsf@users.sourceforge.net> (raw)
In-Reply-To: <834m4nhz1t.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 Oct 2016 14:15:26 +0300")

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	other threads:[~2016-10-08 17:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-07  1:01 bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop npostavs
2016-10-08 11:15 ` Eli Zaretskii
2016-10-08 17:17   ` npostavs [this message]
2016-10-08 18:01     ` Eli Zaretskii
2016-10-08 19:18       ` npostavs
2016-10-08 19:57         ` Eli Zaretskii
2016-10-09 12:29           ` npostavs
2016-10-09 12:42             ` Eli Zaretskii
2016-10-22 19:27               ` npostavs
2016-10-22 19:41                 ` Eli Zaretskii
2016-10-22 20:43                   ` npostavs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874m4mwyj2.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=24633@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).