unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: npostavs@users.sourceforge.net
Cc: 24633@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	[thread overview]
Message-ID: <834m4nhz1t.fsf@gnu.org> (raw)
In-Reply-To: <87vax5vuoj.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net)

> 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.





  reply	other threads:[~2016-10-08 11:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-07  1:01 bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop npostavs
2016-10-08 11:15 ` Eli Zaretskii [this message]
2016-10-08 17:17   ` npostavs
2016-10-08 18:01     ` Eli Zaretskii
2016-10-08 19:18       ` npostavs
2016-10-08 19:57         ` Eli Zaretskii
2016-10-09 12:29           ` npostavs
2016-10-09 12:42             ` Eli Zaretskii
2016-10-22 19:27               ` npostavs
2016-10-22 19:41                 ` Eli Zaretskii
2016-10-22 20:43                   ` npostavs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=834m4nhz1t.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=24633@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).