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: Eli Zaretskii <eliz <at> gnu.org>
To: npostavs <at> users.sourceforge.net
Cc: 24633 <at> 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 14:15:26 +0300
> From: npostavs <at> 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.




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.