From unknown Mon Aug 18 04:45:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78036: [PATCH] Reuse calendar temporary face Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Apr 2025 14:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 78036 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 78036@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17455054319133 (code B ref -1); Thu, 24 Apr 2025 14:38:02 +0000 Received: (at submit) by debbugs.gnu.org; 24 Apr 2025 14:37:11 +0000 Received: from localhost ([127.0.0.1]:39906 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u7xhP-0002NE-2W for submit@debbugs.gnu.org; Thu, 24 Apr 2025 10:37:11 -0400 Received: from lists.gnu.org ([2001:470:142::17]:41962) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u7xhK-0002M9-0K for submit@debbugs.gnu.org; Thu, 24 Apr 2025 10:37:08 -0400 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 1u7xhD-0001TH-93 for bug-gnu-emacs@gnu.org; Thu, 24 Apr 2025 10:37:00 -0400 Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u7xh9-0003iO-P4 for bug-gnu-emacs@gnu.org; Thu, 24 Apr 2025 10:36:59 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=8qML2uvt JYmDew8OfoQtNpMh5o5SnYLMu7zYJa4BKqY=; h=date:subject:to:from; d=ledu-giraud.fr; b=nYF9fRj5dIC6x2htiyOievkht4ouZMgPRp/+OH0ltyuMAEcuFd JsD7j+90mcRv2RkUDMSNZE5kzIK/hk8MKjDA== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=8qML2uvtJYmDew8O foQtNpMh5o5SnYLMu7zYJa4BKqY=; h=date:subject:to:from; d=ledu-giraud.fr; b=BTk5NHc2kg6YF8TZo5vmUmcsMVnerSBNu1+PnZyAFIAwb5FEbR lue9S0P/UgL/VY9hdy7mMEoskvvPP6WuxaBZ+PN+qlrodf0zSk2fyENSpYSv7UM+iBP3Kn pchaw5wJ0+jDvYGnwro4yW0EMUBNzAY+xjUJ+BnFdZVhb/HV6Tv8NZwocce3pCq1tr6Xm+ Fonbsbd2Lmkt/V6lggCku7dqL6KB1t/cw58uzaPeOgGyZkqy0jQtEcXnMkjYKPNRCRkMJY /1CHGGa+4LjBAoeg24DyDQTN7J7qyIOoTdrj8i0L6k2icrOZIhfveV/Rp7wuYfJwwD2gB/ Y2nuoQlEW4sA== Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id e3fca428 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Thu, 24 Apr 2025 16:36:43 +0200 (CEST) From: Manuel Giraud Date: Thu, 24 Apr 2025 16:36:42 +0200 Message-ID: <877c39tymd.fsf@ledu-giraud.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Tags: patch Hi, As suggested by the comment, this patch tries to reuse "temporary" faces created by calendar.el. Without this, if you have a diary entry like: --8<---------------cut here---------------start------------->8--- %%(diary-block 4 1 2025 4 30 2025 '(:background "lightgrey")) A busy month --8<---------------cut here---------------end--------------->8--- Emacs will create a new face for each day in the block. In GNU Emacs 31.0.50 (build 5, x86_64-unknown-openbsd7.7, X toolkit) of 2025-04-22 built on computer Repository revision: 871ec9615a949e967bf7d19466eb9c56ed80ff7e Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101016 System Description: OpenBSD computer 7.7 GENERIC.MP#626 amd64 Configured using: 'configure CC=egcc CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib MAKEINFO=gmakeinfo --prefix=/home/manuel/emacs --bindir=/home/manuel/bin --with-x-toolkit=lucid --with-toolkit-scroll-bars=no --without-cairo --without-compress-install' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Reuse-calendar-temporary-face.patch >From 4cf973bd4e57ded405aa6b8679c9f56e27f3b20a Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Thu, 24 Apr 2025 16:27:33 +0200 Subject: [PATCH] Reuse calendar temporary face * lisp/calendar/calendar.el (calendar-make-temp-face): Reuse temporary face produced by calendar. --- lisp/calendar/calendar.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 08ecd586ec1..058982647fe 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -2515,9 +2515,9 @@ calendar-make-temp-face (if (not faceinfo) ;; No attributes to apply, so just use an existing-face. face - ;; FIXME should we be using numbered temp-faces, reusing where poss? + ;; Compute temp face name. (setq temp-face - (make-symbol + (intern (concat ":caltemp" (mapconcat (lambda (sym) (cond @@ -2525,10 +2525,12 @@ calendar-make-temp-face ((numberp sym) (number-to-string sym)) (t sym))) attrlist "")))) - (make-face temp-face) - (copy-face face temp-face) - ;; Apply the font aspects. - (apply #'set-face-attribute temp-face nil (nreverse faceinfo)) + ;; Create this new face if it does not already exist. + (unless (member temp-face (face-list)) + (make-face temp-face) + (copy-face face temp-face) + ;; Apply the font aspects. + (apply #'set-face-attribute temp-face nil (nreverse faceinfo))) temp-face))) (defun calendar-mark-visible-date (date &optional mark) -- 2.49.0 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=-- From unknown Mon Aug 18 04:45:10 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Manuel Giraud Subject: bug#78036: closed (Re: bug#78036: [PATCH] Reuse calendar temporary face) Message-ID: References: <86a583t3u1.fsf@gnu.org> <877c39tymd.fsf@ledu-giraud.fr> X-Gnu-PR-Message: they-closed 78036 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 78036@debbugs.gnu.org Date: Sat, 26 Apr 2025 14:07:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1745676422-16777-1" This is a multi-part message in MIME format... ------------=_1745676422-16777-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #78036: [PATCH] Reuse calendar temporary face which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 78036@debbugs.gnu.org. --=20 78036: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D78036 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1745676422-16777-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 78036-done) by debbugs.gnu.org; 26 Apr 2025 14:06:28 +0000 Received: from localhost ([127.0.0.1]:33730 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u8gAl-0004LP-TB for submit@debbugs.gnu.org; Sat, 26 Apr 2025 10:06:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33898) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u8gAj-0004L7-Lw for 78036-done@debbugs.gnu.org; Sat, 26 Apr 2025 10:06:26 -0400 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 1u8gAd-0001Xa-Gd; Sat, 26 Apr 2025 10:06:19 -0400 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=B9v5xCp19xp1zqmnlIPDLTtmK7CyF/RLv3EAcldwwFU=; b=fhJLgrddTmxI ZNxOPo2H4iSJGjtU6RHz7DAcuoVf7QOMEN+k1oOAt3YtG8+5fyIbL0kyoqlF5cyb2pSwN+iRiTX0b fkPu1DnpVm88r5hFVyldboabCxOzLvIjL7I0zbTACTOD8eSX2wY3s4jEafLjDQ3MyYPohfpQIc95J lh9McmYUCj35m7uY1DbNue82DAcrO9HDc5LBVy7ZI2ouYsPdKG3yyp9uJEuudFfPFEOPXnPnOejiV El5RYk3ZMr41d8leOkpN2v2h8YYvkvyOdYLc/S/qAsWO8t/rYMb8Hl2CBhkFs4NOgT82DsMvEX9jo OMOvJwj1L2P54IUOFvhfCA==; Date: Sat, 26 Apr 2025 17:06:14 +0300 Message-Id: <86a583t3u1.fsf@gnu.org> From: Eli Zaretskii To: Manuel Giraud In-Reply-To: <877c39tymd.fsf@ledu-giraud.fr> (message from Manuel Giraud on Thu, 24 Apr 2025 16:36:42 +0200) Subject: Re: bug#78036: [PATCH] Reuse calendar temporary face References: <877c39tymd.fsf@ledu-giraud.fr> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78036-done Cc: 78036-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Manuel Giraud > Date: Thu, 24 Apr 2025 16:36:42 +0200 > > As suggested by the comment, this patch tries to reuse "temporary" faces > created by calendar.el. Without this, if you have a diary entry like: > > --8<---------------cut here---------------start------------->8--- > %%(diary-block 4 1 2025 4 30 2025 '(:background "lightgrey")) A busy month > --8<---------------cut here---------------end--------------->8--- > > Emacs will create a new face for each day in the block. Thanks, installed on the master branch, and closing the bug. ------------=_1745676422-16777-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 24 Apr 2025 14:37:11 +0000 Received: from localhost ([127.0.0.1]:39906 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u7xhP-0002NE-2W for submit@debbugs.gnu.org; Thu, 24 Apr 2025 10:37:11 -0400 Received: from lists.gnu.org ([2001:470:142::17]:41962) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u7xhK-0002M9-0K for submit@debbugs.gnu.org; Thu, 24 Apr 2025 10:37:08 -0400 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 1u7xhD-0001TH-93 for bug-gnu-emacs@gnu.org; Thu, 24 Apr 2025 10:37:00 -0400 Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u7xh9-0003iO-P4 for bug-gnu-emacs@gnu.org; Thu, 24 Apr 2025 10:36:59 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=8qML2uvt JYmDew8OfoQtNpMh5o5SnYLMu7zYJa4BKqY=; h=date:subject:to:from; d=ledu-giraud.fr; b=nYF9fRj5dIC6x2htiyOievkht4ouZMgPRp/+OH0ltyuMAEcuFd JsD7j+90mcRv2RkUDMSNZE5kzIK/hk8MKjDA== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=8qML2uvtJYmDew8O foQtNpMh5o5SnYLMu7zYJa4BKqY=; h=date:subject:to:from; d=ledu-giraud.fr; b=BTk5NHc2kg6YF8TZo5vmUmcsMVnerSBNu1+PnZyAFIAwb5FEbR lue9S0P/UgL/VY9hdy7mMEoskvvPP6WuxaBZ+PN+qlrodf0zSk2fyENSpYSv7UM+iBP3Kn pchaw5wJ0+jDvYGnwro4yW0EMUBNzAY+xjUJ+BnFdZVhb/HV6Tv8NZwocce3pCq1tr6Xm+ Fonbsbd2Lmkt/V6lggCku7dqL6KB1t/cw58uzaPeOgGyZkqy0jQtEcXnMkjYKPNRCRkMJY /1CHGGa+4LjBAoeg24DyDQTN7J7qyIOoTdrj8i0L6k2icrOZIhfveV/Rp7wuYfJwwD2gB/ Y2nuoQlEW4sA== Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id e3fca428 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Thu, 24 Apr 2025 16:36:43 +0200 (CEST) From: Manuel Giraud To: bug-gnu-emacs@gnu.org Subject: [PATCH] Reuse calendar temporary face X-Debbugs-Cc: Date: Thu, 24 Apr 2025 16:36:42 +0200 Message-ID: <877c39tymd.fsf@ledu-giraud.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Tags: patch Hi, As suggested by the comment, this patch tries to reuse "temporary" faces created by calendar.el. Without this, if you have a diary entry like: --8<---------------cut here---------------start------------->8--- %%(diary-block 4 1 2025 4 30 2025 '(:background "lightgrey")) A busy month --8<---------------cut here---------------end--------------->8--- Emacs will create a new face for each day in the block. In GNU Emacs 31.0.50 (build 5, x86_64-unknown-openbsd7.7, X toolkit) of 2025-04-22 built on computer Repository revision: 871ec9615a949e967bf7d19466eb9c56ed80ff7e Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101016 System Description: OpenBSD computer 7.7 GENERIC.MP#626 amd64 Configured using: 'configure CC=egcc CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib MAKEINFO=gmakeinfo --prefix=/home/manuel/emacs --bindir=/home/manuel/bin --with-x-toolkit=lucid --with-toolkit-scroll-bars=no --without-cairo --without-compress-install' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Reuse-calendar-temporary-face.patch >From 4cf973bd4e57ded405aa6b8679c9f56e27f3b20a Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Thu, 24 Apr 2025 16:27:33 +0200 Subject: [PATCH] Reuse calendar temporary face * lisp/calendar/calendar.el (calendar-make-temp-face): Reuse temporary face produced by calendar. --- lisp/calendar/calendar.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 08ecd586ec1..058982647fe 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -2515,9 +2515,9 @@ calendar-make-temp-face (if (not faceinfo) ;; No attributes to apply, so just use an existing-face. face - ;; FIXME should we be using numbered temp-faces, reusing where poss? + ;; Compute temp face name. (setq temp-face - (make-symbol + (intern (concat ":caltemp" (mapconcat (lambda (sym) (cond @@ -2525,10 +2525,12 @@ calendar-make-temp-face ((numberp sym) (number-to-string sym)) (t sym))) attrlist "")))) - (make-face temp-face) - (copy-face face temp-face) - ;; Apply the font aspects. - (apply #'set-face-attribute temp-face nil (nreverse faceinfo)) + ;; Create this new face if it does not already exist. + (unless (member temp-face (face-list)) + (make-face temp-face) + (copy-face face temp-face) + ;; Apply the font aspects. + (apply #'set-face-attribute temp-face nil (nreverse faceinfo))) temp-face))) (defun calendar-mark-visible-date (date &optional mark) -- 2.49.0 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=-- ------------=_1745676422-16777-1--