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 14:15:26 +0300 Message-ID: <834m4nhz1t.fsf@gnu.org> References: <87vax5vuoj.fsf@users.sourceforge.net> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1475925384 32464 195.159.176.226 (8 Oct 2016 11:16:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 8 Oct 2016 11:16:24 +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 13:16:20 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 1bspby-0007DX-Qy for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Oct 2016 13:16:14 +0200 Original-Received: from localhost ([::1]:40476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bspbx-0007aY-Hp for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Oct 2016 07:16:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bspbr-0007aS-6C for bug-gnu-emacs@gnu.org; Sat, 08 Oct 2016 07:16:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bspbm-0007bt-3L for bug-gnu-emacs@gnu.org; Sat, 08 Oct 2016 07:16:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42107) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bspbl-0007bp-W2 for bug-gnu-emacs@gnu.org; Sat, 08 Oct 2016 07:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bspbl-0002eO-Rk for bug-gnu-emacs@gnu.org; Sat, 08 Oct 2016 07:16: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 11:16: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.147592533510151 (code B ref 24633); Sat, 08 Oct 2016 11:16:01 +0000 Original-Received: (at 24633) by debbugs.gnu.org; 8 Oct 2016 11:15:35 +0000 Original-Received: from localhost ([127.0.0.1]:48297 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bspbL-0002df-M2 for submit@debbugs.gnu.org; Sat, 08 Oct 2016 07:15:35 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51864) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bspbJ-0002dR-LK for 24633@debbugs.gnu.org; Sat, 08 Oct 2016 07:15:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bspb5-0007Mx-Cg for 24633@debbugs.gnu.org; Sat, 08 Oct 2016 07:15:28 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45435) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bspb5-0007Mr-9c; Sat, 08 Oct 2016 07:15:19 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2589 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bspb4-0005uF-AF; Sat, 08 Oct 2016 07:15:18 -0400 In-reply-to: <87vax5vuoj.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:124194 Archived-At: > From: npostavs@users.sourceforge.net > Date: Thu, 06 Oct 2016 21:01:32 -0400 > > With the code below as overlay-bars.el, run > > emacs -Q overlay-bars.el -l overlay-bars.el > > then move point to the end of the long line with all the semicolons, hit > C-SPC, and then C-n. Emacs gets stuck in an infinite loop that cannot > be interrupted by C-g. > > (require 'cl-lib) > > (defvar-local 21468-region-overlays nil) > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > ;; > > (defun 21468-update-hunk-region (start end window rol) > (mapc #'delete-overlay 21468-region-overlays) > (cl-flet ((ov (start end &rest args) > (let ((ov (make-overlay start end nil t))) > (while args (overlay-put ov (pop args) (pop args))) > (push ov 21468-region-overlays) > ov))) > (let* ((align (list 'space :align-to > `(+ ,(window-hscroll) (0 . right)))) > (rend-line (save-excursion (goto-char end) > (cons (line-beginning-position) > (line-end-position)))) > (face (list :underline (face-background 'highlight nil t)))) > (message "align = %S" align) > (ov (car rend-line) (cdr rend-line) 'face face > 'after-string (propertize "\s" 'face face 'display align 'cursor t))))) > > (setq-local redisplay-highlight-region-function '21468-update-hunk-region) > > (setq-local redisplay-unhighlight-region-function > (lambda (rol) (mapc #'delete-overlay 21468-region-overlays))) > > (setq-local truncate-lines t) Can you explain what do you expect this to do, and how/why? It's hard to reverse-engineer this to glean the intent. 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. (But this is not the only thing I don't understand about this, so please provide a higher-level overview as well.) 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.