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


View this message in rfc822 format

From: npostavs <at> users.sourceforge.net
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 24633 <at> debbugs.gnu.org
Subject: bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop
Date: Sun, 09 Oct 2016 08:29:51 -0400
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: npostavs <at> users.sourceforge.net
>> Cc: 24633 <at> debbugs.gnu.org
>> Date: Sat, 08 Oct 2016 15:18:26 -0400
>> 
>> > Automatic hscrolling is based on length of point's line at the end of
>> > redisplaying a window.  Here, "line length" means the horizontal space
>> > required for displaying all the glyphs of the line, which includes the
>> > glyphs that come from the after-string.  Since you extend your
>> > after-string each time the window is hscrolled, you in effect enlarge
>> > the line each time the display engine hscrolls the window, which
>> > causes an endless loop.
>> >
>> > Can you restrict the after-string's length so it always ends at the
>> > last character of the line, or some fixed number of columns afterward?
>> 
>> Then it won't reach the edge of the screen when the buffer is scrolled.
>
> Yes, but is it so bad?

Hmm, it's not quite the effect I was going for, but actually maybe it
isn't that bad.

> It'd be messy, yes.  We'd need to search for before- and after-strings
> that begin/end right at point, then augment the call to the display
> emulating function accordingly, deal with complications like strings
> that include newlines, etc.

Anyway, it doesn't seem worth going through this complexity.  I just
wonder if there is some way to stop bad lisp code from triggering a hard
lockup.  Can the display engine notice if it's looping and throw some
kind of error?  Maybe unset pre-redisplay-functions?

>
>> >> >  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 admire your courage in reading that documentation and then writing
>> > stuff like the above, which the documentation doesn't mention even
>> > remotely.
>> 
>> Uh, not sure how to read this, is it irony?
>
> Only a little.  I find this area severely under-documented.

The grammar in the doc seems complete to me.  Although using "fraction
of" to mean "gets multiplied by" is perhaps a bit unintuitive.




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.