From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop Date: Thu, 06 Oct 2016 21:01:32 -0400 Message-ID: <87vax5vuoj.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1475802156 18728 195.159.176.226 (7 Oct 2016 01:02:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 7 Oct 2016 01:02:36 +0000 (UTC) To: 24633@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 07 03:02:31 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 1bsJYG-0002Ne-T6 for geb-bug-gnu-emacs@m.gmane.org; Fri, 07 Oct 2016 03:02:17 +0200 Original-Received: from localhost ([::1]:60091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsJYF-0004D6-9g for geb-bug-gnu-emacs@m.gmane.org; Thu, 06 Oct 2016 21:02:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsJY7-0004D0-Tb for bug-gnu-emacs@gnu.org; Thu, 06 Oct 2016 21:02:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsJY2-0004iJ-9C for bug-gnu-emacs@gnu.org; Thu, 06 Oct 2016 21:02:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40869) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsJY2-0004iD-6e for bug-gnu-emacs@gnu.org; Thu, 06 Oct 2016 21:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bsJY1-0004Le-VX for bug-gnu-emacs@gnu.org; Thu, 06 Oct 2016 21:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Oct 2016 01:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24633 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.147580207716647 (code B ref -1); Fri, 07 Oct 2016 01:02:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Oct 2016 01:01:17 +0000 Original-Received: from localhost ([127.0.0.1]:47058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bsJXI-0004KQ-C0 for submit@debbugs.gnu.org; Thu, 06 Oct 2016 21:01:17 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:32980) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bsJXG-0004KB-EO for submit@debbugs.gnu.org; Thu, 06 Oct 2016 21:01:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsJXA-00041v-0T for submit@debbugs.gnu.org; Thu, 06 Oct 2016 21:01:09 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:52644) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsJX9-000417-TX for submit@debbugs.gnu.org; Thu, 06 Oct 2016 21:01:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsJX7-00048P-8K for bug-gnu-emacs@gnu.org; Thu, 06 Oct 2016 21:01:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsJX1-0003wp-O0 for bug-gnu-emacs@gnu.org; Thu, 06 Oct 2016 21:01:04 -0400 Original-Received: from mail-io0-x235.google.com ([2607:f8b0:4001:c06::235]:32836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsJX1-0003w0-CH for bug-gnu-emacs@gnu.org; Thu, 06 Oct 2016 21:00:59 -0400 Original-Received: by mail-io0-x235.google.com with SMTP id q192so32973085iod.0 for ; Thu, 06 Oct 2016 18:00:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:mime-version; bh=TotSqLZYR7q61bMTMipPMlTvF7j7rG0695DbCw0awAY=; b=eqxL0i7fW7JVrI1pxC/6IloHwgVV+4RCnXzKn/SF4bcm3gol1cFkkrp7qdBY5xtf1f M3LVIWTgzG2amkOTFuQobdTpXGjltPl9+esIVyn+f7tQVHyU5NybyeV64d6uz+Hwh3DN iQGldrBvCKj5XXFbs+SwmIMgXsbl4FMf+9D11JEo/8rdGIz7M5PuvhGo/R7rFqsYlS+9 dMg67Ii8DjZ/a7Fk5nycreprICaCGmYbhRVQ13ATDy2H+OS1d3Bm2D+qz8C7KpI0TFKF qX6toAt+gmHt7vpbC15nWe8wWbA+vdacTfHjfVO5+3cOf6IDaWl1PnvvffVOUf1EpRCp fW7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :mime-version; bh=TotSqLZYR7q61bMTMipPMlTvF7j7rG0695DbCw0awAY=; b=YeY7km8vuFTP068MDFyo7uJ137Wt/+sE2miPwWTtArVSovvyTJkT9RhB9VpTOHoO1A k1w63Hh5EhmKSyByzX/8Foga/xuM3Sh+ParaANs/Fo9VMzbpvB5F4aA40iNZkM2XD59C zfAAknei0dsnftk46wXEwSGPji8WwCPddMhUMKjPnePk2k2GY5+w0nfgxQ9S6wHyeUfB mKvB0l6f+hkaQxwM4J3AuD/UbUUki/7ywBsim5uht2PUm0BBXTmkRfq4Ktf3NmKurqUv Dugf8q1BDH9qTyz3DFmX8n1NHXLbse8ikd+Ku4EpwqD/DENE5ZEH+AEq4H2zVA4scdEr kytg== X-Gm-Message-State: AA6/9RmleoV7jAn8ZkLR+nJHDuvtQSxsE8cm/IskIAhaiMPgQMQOyzkIj6LzBFJkk1TQMA== X-Received: by 10.107.59.150 with SMTP id i144mr20823056ioa.155.1475802058009; Thu, 06 Oct 2016 18:00:58 -0700 (PDT) Original-Received: from zony ([45.2.7.130]) by smtp.googlemail.com with ESMTPSA id z125sm363131itc.0.2016.10.06.18.00.56 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Oct 2016 18:00:57 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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:124138 Archived-At: --=-=-= Content-Type: text/plain Version: 25.1 24.5 This is sort of a continuation from Bug #21468 (see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21468#46 and the following). The overlay with newline approach did indeed turn up some more problems, so we tried moving to the :overline :underline text method for Emacs 25, but it turns out this causes Emacs to freeze in certain circumstances (see https://github.com/magit/magit/issues/2758#issuecomment-250838301). There is some sentiment to abandon the horizontal bar effect and settle for just applying a face, but I think this is a bug in Emacs that should be fixed regardless. Or maybe it's just a case of "if it hurts, dont do it"? (using (window-hscroll) in :align-to specs, that is) ----------------------- 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. --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=overlay-bars.el Content-Description: demo code (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) --=-=-= Content-Type: text/plain If the frame is split vertically with C-x 2 first, then Emacs doesn't get stuck, but does the equivalent of (scroll-left 4) about once per second; this can be interrupted by C-g. Modifying the :align-to expression to `(+ ,(1- (window-hscroll)) (0 . right)) causes this assertion failure after some looping: xdisp.c:19474: Emacs fatal error: assertion failed: row->pixel_width >= 0 Thread 1 "emacs" hit Breakpoint 1, terminate_due_to_signal (sig=6, backtrace_limit=2147483647) at emacs.c:354 354 signal (sig, SIG_DFL); (gdb) bt #0 terminate_due_to_signal (sig=6, backtrace_limit=2147483647) at emacs.c:354 #1 0x00000000005fb0aa in die (msg=0x6f64c2 "row->pixel_width >= 0", file=0x6f3450 "xdisp.c", line=19474) at alloc.c:7223 #2 0x0000000000479b64 in compute_line_metrics (it=0x7fffffff9110) at xdisp.c:19474 #3 0x0000000000481e07 in display_line (it=0x7fffffff9110) at xdisp.c:21234 #4 0x0000000000471b56 in try_window (window=21548085, pos=..., flags=1) at xdisp.c:17246 #5 0x000000000046e6ae in redisplay_window (window=21548085, just_this_one_p=true) at xdisp.c:16695 #6 0x00000000004665a3 in redisplay_window_1 (window=21548085) at xdisp.c:14494 #7 0x000000000061b092 in internal_condition_case_1 (bfun=0x466561 , arg=21548085, handlers=14582547, hfun=0x4664db ) at eval.c:1338 #8 0x00000000004657c2 in redisplay_internal () at xdisp.c:14119 #9 0x0000000000462ca2 in redisplay () at xdisp.c:13254 #10 0x00000000005768ea in read_char (commandflag=1, map=26212659, prev_event=0, used_mouse_menu=0x7fffffffe36f, end_time=0x0) at keyboard.c:2477 #11 0x00000000005866f7 in read_key_sequence (keybuf=0x7fffffffe520, bufsize=30, prompt=0, dont_downcase_last=false, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=false) at keyboard.c:9063 #12 0x000000000057386d in command_loop_1 () at keyboard.c:1365 #13 0x000000000061aff8 in internal_condition_case (bfun=0x573431 , handlers=19056, hfun=0x572ac3 ) at eval.c:1314 #14 0x0000000000573073 in command_loop_2 (ignore=0) at keyboard.c:1107 #15 0x000000000061a5c7 in internal_catch (tag=45888, func=0x57304a , arg=0) at eval.c:1079 #16 0x0000000000573015 in command_loop () at keyboard.c:1086 #17 0x00000000005725b3 in recursive_edit_1 () at keyboard.c:692 #18 0x00000000005727b3 in Frecursive_edit () at keyboard.c:763 #19 0x0000000000570560 in main (argc=5, argv=0x7fffffffe9b8) at emacs.c:1626 Lisp Backtrace: "redisplay_internal (C function)" (0x0) I see the same failure *without* modifying the :align-to expression on Emacs 24.5. --=-=-=--