[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#24633: highlight-region func using (window-hscroll) in :align-to spe
From: |
Eli Zaretskii |
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@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.
- bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop, npostavs, 2016/10/06
- bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop,
Eli Zaretskii <=
- bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop, npostavs, 2016/10/08
- bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop, Eli Zaretskii, 2016/10/08
- bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop, npostavs, 2016/10/08
- bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop, Eli Zaretskii, 2016/10/08
- bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop, npostavs, 2016/10/09
- bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop, Eli Zaretskii, 2016/10/09
- bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop, npostavs, 2016/10/22
- bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop, Eli Zaretskii, 2016/10/22
- bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop, npostavs, 2016/10/22