GNU bug report logs - #69271
30.0.50; Strange interaction between :inverse-video overlay face and calendar today face

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Mon, 19 Feb 2024 12:12:02 UTC

Severity: normal

Tags: notabug

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 69271 in the body.
You can then email your comments to 69271 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#69271; Package emacs. (Mon, 19 Feb 2024 12:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ihor Radchenko <yantar92 <at> posteo.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 19 Feb 2024 12:12:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; Strange interaction between :inverse-video overlay face
 and calendar today face
Date: Mon, 19 Feb 2024 12:14:28 +0000
Originally reported in
https://list.orgmode.org/orgmode/CALEYq09=JKfzRY26fohLPYz7_2mnvhg_LGsjnQwQKov5SbqkYg <at> mail.gmail.com/

Steps to reproduce:

1. emacs -Q
2. Insert the following code into *scratch* buffer


(defface yant/test '((t :foreground "red" :weight bold)) "")
(defface yant/test-inv '((t :foreground "red"  :inverse-video t)) "")
(require 'calendar)

;; (dotimes (_ 5)
;;   (let* ((mark-calendar
;; 	  (lambda ()
;; 	    (calendar-mark-visible-date
;; 	     (read (format-time-string "(%m %d %Y)"))
;; 	     'yant/test)))
;; 	 (calendar-today-visible-hook))
;;     (add-hook 'calendar-today-visible-hook mark-calendar)
;;     (calendar)
;;     (setq cursor-type nil)
;;     (let ((ov (make-overlay (1- (point)) (1+ (point)))))
;;       (overlay-put ov 'face 'yant/test-inv)))
;;   (read-char "Observe overlay obeying inverse-video. Press any key")
;;   (kill-buffer calendar-buffer))
(dotimes (_ 50)
  (let* ((mark-calendar
	  (lambda ()
	    (calendar-mark-visible-date
	     (read (format-time-string "(%m %d %Y)"))
	     (list :foreground "red" :weight 'bold))))
	 (calendar-today-visible-hook))
    (add-hook 'calendar-today-visible-hook mark-calendar)
    (calendar)
    (setq cursor-type nil)
    (let ((ov (make-overlay (1- (point)) (1+ (point)))))
      (overlay-put ov 'face 'yant/test-inv)))
  (read-char "Observe overlay sometimes *not* obeying inverse-video. Press any key")
  (kill-buffer calendar-buffer))

3. M-x eval-buffer <RET>
4. Observe today date in the calendar fontified inconsistently as the
   code is executed multiple times.

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.41, cairo version 1.18.0) of 2024-02-18 built on localhost
Repository revision: 951379a0983ea66b1396d07628bb726f033ea24b
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101011
System Description: Gentoo Linux

Configured using:
 'configure JAVAC=/etc/java-config-2/current-system-vm/bin/javac'

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69271; Package emacs. (Tue, 20 Feb 2024 16:11:01 GMT) Full text and rfc822 format available.

Message #8 received at 69271 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 69271 <at> debbugs.gnu.org
Subject: Re: bug#69271: 30.0.50;
 Strange interaction between :inverse-video overlay face and calendar
 today face
Date: Tue, 20 Feb 2024 18:08:14 +0200
> From: Ihor Radchenko <yantar92 <at> posteo.net>
> Date: Mon, 19 Feb 2024 12:14:28 +0000
> 
> 1. emacs -Q
> 2. Insert the following code into *scratch* buffer
> 
> 
> (defface yant/test '((t :foreground "red" :weight bold)) "")
> (defface yant/test-inv '((t :foreground "red"  :inverse-video t)) "")
> (require 'calendar)
> 
> ;; (dotimes (_ 5)
> ;;   (let* ((mark-calendar
> ;; 	  (lambda ()
> ;; 	    (calendar-mark-visible-date
> ;; 	     (read (format-time-string "(%m %d %Y)"))
> ;; 	     'yant/test)))
> ;; 	 (calendar-today-visible-hook))
> ;;     (add-hook 'calendar-today-visible-hook mark-calendar)
> ;;     (calendar)
> ;;     (setq cursor-type nil)
> ;;     (let ((ov (make-overlay (1- (point)) (1+ (point)))))
> ;;       (overlay-put ov 'face 'yant/test-inv)))
> ;;   (read-char "Observe overlay obeying inverse-video. Press any key")
> ;;   (kill-buffer calendar-buffer))
> (dotimes (_ 50)
>   (let* ((mark-calendar
> 	  (lambda ()
> 	    (calendar-mark-visible-date
> 	     (read (format-time-string "(%m %d %Y)"))
> 	     (list :foreground "red" :weight 'bold))))
> 	 (calendar-today-visible-hook))
>     (add-hook 'calendar-today-visible-hook mark-calendar)
>     (calendar)
>     (setq cursor-type nil)
>     (let ((ov (make-overlay (1- (point)) (1+ (point)))))
>       (overlay-put ov 'face 'yant/test-inv)))
>   (read-char "Observe overlay sometimes *not* obeying inverse-video. Press any key")
>   (kill-buffer calendar-buffer))
> 
> 3. M-x eval-buffer <RET>
> 4. Observe today date in the calendar fontified inconsistently as the
>    code is executed multiple times.

This code places two overlays on the same text, with each overlay
defining a foreground color.  So which one "wins" is basically random,
unless you give each overlay a priority to make that deterministic.

I tried a simpler recipe:

  emacs -Q
  M-x load-library RET calendar RET
  C-x b foo RET
  C-u 30 a RET
  M-: (defface yant/test-inv '((t :foreground "red"  :inverse-video t)) "") RET
  M-: (setq ov1 (make-overlay 24 26)) RET
  M-: (overlay-put ov1 'face (calendar-make-temp-face (list :foreground "red" :weight 'bold))) RET
  M-: (setq ov2 (make-overlay 24 26)) RET
  M-: (overlay-put ov2 'face 'yant/test-inv) RET

This produced text with red background, according to the yant/test-inv
face.  But if you define the overlays in the opposite order, you get
the red bold foreground instead.  If you now give each overlay a
priority, you can control which face shows: the one whose overlay has
the higher priority.

Maybe I'm missing something, but I see no bug here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69271; Package emacs. (Wed, 21 Feb 2024 11:16:02 GMT) Full text and rfc822 format available.

Message #11 received at 69271 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 69271 <at> debbugs.gnu.org
Subject: Re: bug#69271: 30.0.50; Strange interaction between :inverse-video
 overlay face and calendar today face
Date: Wed, 21 Feb 2024 11:18:22 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>
> This produced text with red background, according to the yant/test-inv
> face.  But if you define the overlays in the opposite order, you get
> the red bold foreground instead.  If you now give each overlay a
> priority, you can control which face shows: the one whose overlay has
> the higher priority.
>
> Maybe I'm missing something, but I see no bug here.

You are indeed right.
I fixed this priority race on Org mode side.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=67d937248
Thanks!

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69271; Package emacs. (Wed, 21 Feb 2024 12:09:01 GMT) Full text and rfc822 format available.

Message #14 received at 69271 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 69271 <at> debbugs.gnu.org
Subject: Re: bug#69271: 30.0.50; Strange interaction between :inverse-video
 overlay face and calendar today face
Date: Wed, 21 Feb 2024 14:05:36 +0200
tags 69271 notabug
close 69271
thanks

> From: Ihor Radchenko <yantar92 <at> posteo.net>
> Cc: 69271 <at> debbugs.gnu.org
> Date: Wed, 21 Feb 2024 11:18:22 +0000
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >
> > This produced text with red background, according to the yant/test-inv
> > face.  But if you define the overlays in the opposite order, you get
> > the red bold foreground instead.  If you now give each overlay a
> > priority, you can control which face shows: the one whose overlay has
> > the higher priority.
> >
> > Maybe I'm missing something, but I see no bug here.
> 
> You are indeed right.
> I fixed this priority race on Org mode side.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=67d937248
> Thanks!

Thanks, I'm therefore closing this bug report.




Added tag(s) notabug. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 21 Feb 2024 16:30:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 69271 <at> debbugs.gnu.org and Ihor Radchenko <yantar92 <at> posteo.net> Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 21 Feb 2024 16:30:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 21 Mar 2024 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 148 days ago.

Previous Next


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