GNU logs - #80007, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#80007: hl-line-mode vs. cursor-intangible-mode race condition
Resent-From: =?UTF-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 14 Dec 2025 19:02:02 +0000
Resent-Message-ID: <handler.80007.B.176573889913888 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 80007
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 80007 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.176573889913888
          (code B ref -1); Sun, 14 Dec 2025 19:02:02 +0000
Received: (at submit) by debbugs.gnu.org; 14 Dec 2025 19:01:39 +0000
Received: from localhost ([127.0.0.1]:56384 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vUrLf-0003bw-2n
	for submit <at> debbugs.gnu.org; Sun, 14 Dec 2025 14:01:39 -0500
Received: from lists.gnu.org ([2001:470:142::17]:52442)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vUrLc-0003bj-F7
 for submit <at> debbugs.gnu.org; Sun, 14 Dec 2025 14:01:37 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <shipmints@HIDDEN>)
 id 1vUrLW-0005Ry-UE
 for bug-gnu-emacs@HIDDEN; Sun, 14 Dec 2025 14:01:30 -0500
Received: from mail-vk1-xa2c.google.com ([2607:f8b0:4864:20::a2c])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <shipmints@HIDDEN>)
 id 1vUrLV-0007qf-Fd
 for bug-gnu-emacs@HIDDEN; Sun, 14 Dec 2025 14:01:30 -0500
Received: by mail-vk1-xa2c.google.com with SMTP id
 71dfb90a1353d-55b0af02ddeso323949e0c.3
 for <bug-gnu-emacs@HIDDEN>; Sun, 14 Dec 2025 11:01:29 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1765738888; x=1766343688; darn=gnu.org;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=L1cv0lwf9GJUUqWOOHcF40ud3jpUXEg43/X1netp2RI=;
 b=dX8LFIsIxekbC8A8wWadN/QEoRojkdkwosRssw1W6chn1LWr7nrE43F5Pthf5jIxrj
 zeTJy+IGR4pLkDR5vUNFgDPbYP7IhydclP5aj0RhxJ15JvpR/a4wo/0M3WL/iMlVLSnR
 sTIi5d+S9Pzva/Ft3Kn19hntqB0ANWPloTfvLzGn2h2xHd9GQAbwCRmPMnMKOliBj89U
 JhKo7EvwHWkSoopswWl85OTTFVXrqOmP+FtPSEWuZUXe+eNCmld0peefArLsBZh+hqQE
 B+bDwQhT8s5zUXvRA2QlDyO/dHnVN4IidfwqB2HdeIbktF9/KgBrl+ZSaRPNAUVMKlKy
 EOhw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1765738888; x=1766343688;
 h=to:subject:message-id:date:from:mime-version:x-gm-gg
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=L1cv0lwf9GJUUqWOOHcF40ud3jpUXEg43/X1netp2RI=;
 b=knh365nqb6u1uOKLapR8N7Ip3uHDa89crzmhiJjDdYDdZkpy4EZezDjUrWg3dZ30LI
 qhM3fCqPhhbLZXeaOhKa+bRBwBHZRZwiAqC7j27uccUe639HO4dQgR2/76R8MSKYR9Y5
 41mOCfLwaI2jOUOc1OgIm4iUVy01TS6ReVAiXN4Xo89dKR6hydsPrjzasYSBEU5b4C2B
 RNT8ghjOdvqxMS7MsqEJ/TndreWnSrZG+rfEdCnBnivCE3rHMcE0X9XYGbN42tNTD3c5
 ilJlfsBc0Hultw9iNALOyKgFiYaHAMWzLG4iBEQ56fcinoKvtiyZfUK0I6OMPm4EW8WK
 jKOA==
X-Gm-Message-State: AOJu0YwD4kHJ8V4VC1J0YnxmGgJ0ue1upK7dKxF5rUyctAFArvYTufpI
 LUoRw2NZ7nP7V8DLugGzUfYXwQUtrAd5m0cDXDioSX3mEquKqYb+l1TTyul5yBsQLk4hU1jZvWR
 MZHcLxOkNdVbY1qG2+irIvPYzwoSfuizAp4JE
X-Gm-Gg: AY/fxX50yLtB2fbQufLz3G8F75UVuM5Llbixo+bXvUyYRBB3/HYS6Q6RAx/Ay/QXBCK
 ih0/PCvkonKBFvsaJtO4go/Yaue5RYhrQ5/fBn1xWkdY8BcAZcCXNdqBUZcZtFz9uobskbndMhv
 /2NWkSDJKDgWToxN/Z6foHC56k0+GS620c/8uUl0+djHGKjcISGMgFWRL2B6YZWHIKLprnZmJgr
 FpPnaCrafQUFKzGdt+BWZHJjVt/n2RYv/cpN6ZnWOHGUFOCL0a5OeVKSHoAxFIfbL2fYqrn
X-Google-Smtp-Source: AGHT+IHudOLowKmvigp4IrXkq8NoUaetYVvf1dIhZMKZ5HkgwE/8NgyfKkT3X/THdmAPoQdsotpm02uFwTyl37m2P8U=
X-Received: by 2002:a05:6122:4faa:b0:55e:64d7:ae76 with SMTP id
 71dfb90a1353d-55fed66949bmr2603171e0c.20.1765738888011; Sun, 14 Dec 2025
 11:01:28 -0800 (PST)
MIME-Version: 1.0
From: =?UTF-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>
Date: Sun, 14 Dec 2025 14:01:16 -0500
X-Gm-Features: AQt7F2p9PonbQ15NFH9sfui6HXtfZgLH4nfh5p6VOmfQ2-Lafy3kIGfJH3GfOxM
Message-ID: <CAN+1HbqgSmKMeJx-FfnStMHJpoPVufDVhdgJxaxpWkGrkDkp7Q@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000002fa4760645ee1f8b"
Received-SPF: pass client-ip=2607:f8b0:4864:20::a2c;
 envelope-from=shipmints@HIDDEN; helo=mail-vk1-xa2c.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--0000000000002fa4760645ee1f8b
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

The reproducer, below, finds point winding up on the first line, yet
hl-line highlights the second line.  I believe this is due to hl-line
updating via post-command-hook and cursor-intangible-mode
(cursor-sensor--move-to-tangible) updating via. pre-redisplay-functions.
Hence the race which hl-line loses where the highlighted line is
"incorrect" if cursor-sensor--move-to-tangible moved point after hl-line
thought it was highlighting the correct line.

Not precisely sure how to deal with this but here are a couple of, perhaps
silly, ideas that come to mind and might spawn a better approach.

- hl-line could check if cursor-intangible-mode is enabled and defer its
update

- Schedule hl-line update via an immediate timer that runs after redisplay
ends

(let ((buffer (get-buffer-create "hl-line-cursor-intangible-test")))
  (switch-to-buffer buffer)
  (set-buffer buffer)
  (hl-line-mode)
  (cursor-intangible-mode)
  (insert
   "TANGIBLE\n"
   (propertize "INTANGIBLE\n"
               'face '(:weight bold)
               'cursor-intangible t
               'front-sticky t))
  (goto-char (point-min))
  (next-line))

-St=C3=A9phane

--0000000000002fa4760645ee1f8b
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">The reproducer, below, finds point winding up on the first line, yet hl-=
line highlights the second line.=C2=A0 I believe this is due to hl-line upd=
ating via post-command-hook and cursor-intangible-mode (cursor-sensor--move=
-to-tangible) updating via. pre-redisplay-functions.=C2=A0 Hence the race w=
hich hl-line loses where the highlighted line is &quot;incorrect&quot; if c=
ursor-sensor--move-to-tangible moved point after hl-line thought it was hig=
hlighting the correct line.</div><div class=3D"gmail_default" style=3D"font=
-family:monospace"><br></div><div class=3D"gmail_default" style=3D"font-fam=
ily:monospace">Not precisely sure how to deal with this but here are a coup=
le of, perhaps silly, ideas that come to mind and might spawn a better appr=
oach.</div><div class=3D"gmail_default" style=3D"font-family:monospace"><br=
></div><div class=3D"gmail_default" style=3D"font-family:monospace">- hl-li=
ne could check if cursor-intangible-mode is enabled and defer its update</d=
iv><div class=3D"gmail_default" style=3D"font-family:monospace"><br>- Sched=
ule hl-line update via an immediate timer that runs after redisplay ends</d=
iv><div class=3D"gmail_default" style=3D"font-family:monospace"><br></div><=
div class=3D"gmail_default" style=3D"font-family:monospace">(let ((buffer (=
get-buffer-create &quot;hl-line-cursor-intangible-test&quot;)))</div><div c=
lass=3D"gmail_default" style=3D"font-family:monospace">=C2=A0 (switch-to-bu=
ffer buffer)<br>=C2=A0 (set-buffer buffer)<br>=C2=A0 (hl-line-mode)<br>=C2=
=A0 (cursor-intangible-mode)<br>=C2=A0 (insert<br>=C2=A0 =C2=A0&quot;TANGIB=
LE\n&quot;<br>=C2=A0 =C2=A0(propertize &quot;INTANGIBLE\n&quot;<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&#39;face &#39;(:weight bol=
d)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&#39;cursor-in=
tangible t<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&#39;f=
ront-sticky t))<br>=C2=A0 (goto-char (point-min))<br>=C2=A0 (next-line))<br=
></div><div class=3D"gmail_default" style=3D"font-family:monospace"><br></d=
iv><div class=3D"gmail_default" style=3D"font-family:monospace">-St=C3=A9ph=
ane=C2=A0</div></div>

--0000000000002fa4760645ee1f8b--




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: =?UTF-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: bug#80007: Acknowledgement (hl-line-mode vs. cursor-intangible-mode
 race condition)
Message-ID: <handler.80007.B.176573889913888.ack <at> debbugs.gnu.org>
References: <CAN+1HbqgSmKMeJx-FfnStMHJpoPVufDVhdgJxaxpWkGrkDkp7Q@HIDDEN>
X-Gnu-PR-Message: ack 80007
X-Gnu-PR-Package: emacs
Reply-To: 80007 <at> debbugs.gnu.org
Date: Sun, 14 Dec 2025 19:02:03 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 80007 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
80007: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D80007
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#80007: hl-line-mode vs. cursor-intangible-mode race condition
Resent-From: Juri Linkov <juri@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 15 Dec 2025 07:05:02 +0000
Resent-Message-ID: <handler.80007.B80007.176578226918852 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 80007
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: =?UTF-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>
Cc: 80007 <at> debbugs.gnu.org
Received: via spool by 80007-submit <at> debbugs.gnu.org id=B80007.176578226918852
          (code B ref 80007); Mon, 15 Dec 2025 07:05:02 +0000
Received: (at 80007) by debbugs.gnu.org; 15 Dec 2025 07:04:29 +0000
Received: from localhost ([127.0.0.1]:35659 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vV2dB-0004tz-EG
	for submit <at> debbugs.gnu.org; Mon, 15 Dec 2025 02:04:29 -0500
Received: from mout-p-201.mailbox.org ([80.241.56.171]:51092)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1vV2d7-0004tU-Fj
 for 80007 <at> debbugs.gnu.org; Mon, 15 Dec 2025 02:04:28 -0500
Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4dV9z44Q89z9tLQ;
 Mon, 15 Dec 2025 08:04:16 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; 
 t=1765782256;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=DZxt1ZWpcE1S2amgRwjwz1wlQX1n57nnHzgk0qVq9/w=;
 b=Jf5PN8zJLRRqQPZI0p/4sCsq0UpLITgPqOomkDEuE8BjeP3MESsDgECENlfsW+52v5zgOK
 OorMePJFaYDBY0IwUePsi/FTz9sOGyGGWgLaMOrHoLaaLu1o0AdkHxwRcbHN8zAp89FuaC
 fxa7SagUfBiBJ7JSeHlAXHzVUFfbLX2k3y01I1YZMpjkJjUrrbjncFvlwAB6IYHqP3dXIA
 y0GeKkvkjkFsqhQR6RiC5XVkKsuNI1s3B6kLSGeoVZ+Ud1qa/wecEYwqOfy0vMNLQVqE3A
 2CtBcR85QxbeYeHsyDyvB+1I1HspsxpZ9FsC4UO+yiTY9pZm2KGGwrRWFhShhQ==
From: Juri Linkov <juri@HIDDEN>
In-Reply-To: <CAN+1HbqgSmKMeJx-FfnStMHJpoPVufDVhdgJxaxpWkGrkDkp7Q@HIDDEN>
Organization: LINKOV.NET
References: <CAN+1HbqgSmKMeJx-FfnStMHJpoPVufDVhdgJxaxpWkGrkDkp7Q@HIDDEN>
Date: Mon, 15 Dec 2025 09:03:37 +0200
Message-ID: <87bjk0fdae.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>   (hl-line-mode)

Please note that recently 'hl-line-mode' was obsoleted by the new value
of 'global-hl-line-sticky-flag' that uses 'pre-redisplay-functions'.

So please try with these settings:

  (setopt global-hl-line-sticky-flag 'window)

and enable 'global-hl-line-mode' instead of 'hl-line-mode'.





Last modified: Mon, 15 Dec 2025 07:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.