From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: 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 Message-ID: <86jzmznmoh.fsf@gnu.org> References: <875xykfy6z.fsf@localhost> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4026"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69271@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 20 17:10:54 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rcShp-0000mL-F5 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 20 Feb 2024 17:10:53 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcShe-0001zi-QD; Tue, 20 Feb 2024 11:10:42 -0500 Original-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 ) id 1rcShc-0001zO-Dt for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2024 11:10:40 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rcShc-0006E8-4X for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2024 11:10:40 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rcShx-0005Sc-SS for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2024 11:11:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Feb 2024 16:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69271 X-GNU-PR-Package: emacs Original-Received: via spool by 69271-submit@debbugs.gnu.org id=B69271.170844546120987 (code B ref 69271); Tue, 20 Feb 2024 16:11:01 +0000 Original-Received: (at 69271) by debbugs.gnu.org; 20 Feb 2024 16:11:01 +0000 Original-Received: from localhost ([127.0.0.1]:46405 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcShw-0005SN-QC for submit@debbugs.gnu.org; Tue, 20 Feb 2024 11:11:01 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46532) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcShu-0005SA-6r for 69271@debbugs.gnu.org; Tue, 20 Feb 2024 11:10:59 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rcSfN-0005fL-2v; Tue, 20 Feb 2024 11:08:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=odonO+R09y+OeRk+ETkN2prUUvzazBQcyqmiJO2z7hI=; b=V3A5HUTgv8Oq kYDLKa1aeStCYBzjHJIPRS6sM44To99KXBfp10MRIgIZSBGwCuDPwdZyasyJ01eU8c7figABjjPXI QdRgy9xFeQvr07Edp3IGhgBONsGj6fCNK+LUtXkYkBxbAAj3BK8FJfXzUoSq7bBTjgoNLXSN1pVYE EQpTydYnWOMq7D8kQVBc2gRHYSvbvs7Um+iNjV9xZsyUoqmk6n6xjVKMDYJBxepjYL4llV/ry4GEw pwzDIp0dkcr0+xTH0I92BiBx1c/XuXuKH15xrIkMGFxiCvlFsuoA21vgMFJ8JGGa7Lzjl2YQIS2at wT3R0Wkv+RKLnOBHV1zhgg==; In-Reply-To: <875xykfy6z.fsf@localhost> (message from Ihor Radchenko on Mon, 19 Feb 2024 12:14:28 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280337 Archived-At: > From: Ihor Radchenko > 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 > 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.