From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop Date: Sat, 08 Oct 2016 21:01:46 +0300 Message-ID: <837f9ihg8l.fsf@gnu.org> References: <87vax5vuoj.fsf@users.sourceforge.net> <834m4nhz1t.fsf@gnu.org> <874m4mwyj2.fsf@users.sourceforge.net> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1475949796 29673 195.159.176.226 (8 Oct 2016 18:03:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 8 Oct 2016 18:03:16 +0000 (UTC) Cc: 24633@debbugs.gnu.org To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 08 20:03:12 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bsvxo-0007Hp-JE for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Oct 2016 20:03:12 +0200 Original-Received: from localhost ([::1]:41958 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsvxn-0006z7-9B for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Oct 2016 14:03:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsvxh-0006yx-D0 for bug-gnu-emacs@gnu.org; Sat, 08 Oct 2016 14:03:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsvxe-0005Sc-2F for bug-gnu-emacs@gnu.org; Sat, 08 Oct 2016 14:03:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42760) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsvxd-0005SY-Uv for bug-gnu-emacs@gnu.org; Sat, 08 Oct 2016 14:03:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bsvxd-0000s3-Nx for bug-gnu-emacs@gnu.org; Sat, 08 Oct 2016 14:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Oct 2016 18:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24633 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24633-submit@debbugs.gnu.org id=B24633.14759497343279 (code B ref 24633); Sat, 08 Oct 2016 18:03:01 +0000 Original-Received: (at 24633) by debbugs.gnu.org; 8 Oct 2016 18:02:14 +0000 Original-Received: from localhost ([127.0.0.1]:48950 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bsvwr-0000qo-Q8 for submit@debbugs.gnu.org; Sat, 08 Oct 2016 14:02:13 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38555) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bsvwq-0000qd-CR for 24633@debbugs.gnu.org; Sat, 08 Oct 2016 14:02:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsvwi-0004uv-3u for 24633@debbugs.gnu.org; Sat, 08 Oct 2016 14:02:07 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50246) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsvwi-0004tp-0q; Sat, 08 Oct 2016 14:02:04 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3022 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bsvwe-0001hX-1r; Sat, 08 Oct 2016 14:02:02 -0400 In-reply-to: <874m4mwyj2.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:124233 Archived-At: > From: npostavs@users.sourceforge.net > Cc: 24633@debbugs.gnu.org > Date: Sat, 08 Oct 2016 13:17:37 -0400 > > 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. 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? > > 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.