From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id wJo6BrRnzWURgAEAqHPOHw:P1 (envelope-from ) for ; Thu, 15 Feb 2024 02:24:04 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id wJo6BrRnzWURgAEAqHPOHw (envelope-from ) for ; Thu, 15 Feb 2024 02:24:04 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=andrew.cmu.edu header.s=google-2021 header.b=N1S9V4Hh; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=andrew.cmu.edu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1707960244; h=from:from:sender:sender: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:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=XhaIODsptviLzDerbg5sBfKplxO1a1dSb5LbYToo0EE=; b=YpmUoNy9UrxPFV9kbS4Tbi5dy+Z4dlLegumeXnb13hs97MFTAk5IiA7gKsJ8XMWsHkzqGS 9rwvi4lMNJ1guZDuAVpB5lwNflf8qjWdvrq6PM6u5wfO6bp7wQlhPw/PMGhyGPa3nrs2JN Js2iDy6FweKHN+BUhCevvOMLyr2s1yiacSmSBPQlAWq4wT/kUTWkfn2vZitPClvLj5mzsK wcU8QfUZfCqH3JnjIOBt0oe/IGZGGV4x1LP1PkicnheuYkcH+Gy0WsauoCUAIwPhk1Sxve 1nx5FzmyxSMXDr8b0Pg5E4zOlwBxtkwL8kr4cQToVzrTNn2HWiL9KMpjOVKa4A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=andrew.cmu.edu header.s=google-2021 header.b=N1S9V4Hh; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=andrew.cmu.edu ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707960244; a=rsa-sha256; cv=none; b=tIe6d4b/EMa/igaznotrVB736NUvTeMQgZ5w4AcZbcQ30AHAGo+hy5G3nbfn7OSU4sEUuj GsNJrZD1/QDNarHSDJL7Dpatg3Ju1Ut6KP649J1bXjJMogbQQDNZ0l4+PvEJLZ2s/32kye 04g/GSxqWeLUt8QVIRPGFh7NKpD7yEYX6NZIuPhrghG9uRpVg6aPuAE6El85B4zOchkCPs ujxZi36Sawn0SdLjDq75nHyicxa7rvRiUYJmtA701ux7e54gXoyAcWafw3zVb4Cz6QhUBy KZNc7FP8AV4TKO6uy/SAb76TcI8/B69iRLmv5F1Uqj7WoR/VipS4sgaKfhYyeQ== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CAFD375B3D for ; Thu, 15 Feb 2024 02:24:03 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raQOE-0001mG-JX; Wed, 14 Feb 2024 20:18:14 -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 ) id 1raQOC-0001kV-6C for emacs-orgmode@gnu.org; Wed, 14 Feb 2024 20:18:12 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1raQOA-0008Pz-1o for emacs-orgmode@gnu.org; Wed, 14 Feb 2024 20:18:11 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-411f429a171so2929865e9.3 for ; Wed, 14 Feb 2024 17:18:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=andrew.cmu.edu; s=google-2021; t=1707959883; x=1708564683; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=XhaIODsptviLzDerbg5sBfKplxO1a1dSb5LbYToo0EE=; b=N1S9V4HhbqoGBln14rAmDMBXpdOv8M8KiV6WwLxNlDValQ7alsP5+6CzaT56fqU+EY 86pTB+3yg60DaZpadVJPKLq6Rh1XiO4+1K1so0wxs3fA+YuErz07IFlJYwfrQnXMFgUi LDqfvCyRRERbygVDnN5lB6IdA6A3XmZ7p5d1XsX6BUfDQHx8zfmBMNUscHuL313Ptz+L sOE+M9gofc1EHgaKYH/7UN5HY1rjXV5rRDJ8U18qwjasYIGH/g6ww6cd3pvj07IV1R3r eD4pkRR/qxyOPq0EECK2YywlPV0EjIQ2mGVoMp+Atc+P0PXY4QjqnGul2aWxuaXQS1Lc dINg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707959883; x=1708564683; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XhaIODsptviLzDerbg5sBfKplxO1a1dSb5LbYToo0EE=; b=ktoe762fos+n7FH6NGOdBDYEASK8y2nEMu1QNcbsLCzwmawdFDD0cFR8uI2NgdsAm9 O7sAltxh2xhQJ95OU/qV0iUqrXGgL0h9Ou4iIf7vYQ3ArAFNMg4d1j2+3ZtsXrGcncqa gTlgI3Qg3C7Js1LqCus15ADbLXbSTDdv75ljZPFw2zSaX3GpYVJQl6i1aBvik/i08y9/ lzQQ4Dm+dyzAUyi2ym/pQOp/wBAa4GER54MEnfFcheAhrihRe6fLztbFtrXFLsA5HfKW q1LcDiniURRzgIbkw+hhOfQH8BqalwCn0T4b7RLgsH4aAIJqLTJjGq2x/kM0ftA/OtxE 4Vjw== X-Gm-Message-State: AOJu0YyiYgQiJyqoSV0qxrJDM1gMLrpSeaoX/gtZMW7TrXkxIVkFKORC x7pX/FGOU8NBOWCJmIbM5NN/XxRb44X6Jxj046N848Ms6AiU9s0Yz2Z3uAP6DRfeHbHKLS78GnD +iU2u3blIjTNpS86vpnLdQB4uoWoFdq4kE5qY X-Google-Smtp-Source: AGHT+IHn333Ua8EOSg43w5zEjQ5tN36JsNx4RyMZddfMlLGRfroTQht2IEM3RzUOhxnTDmiT40Rzniz73vOoiWeTQes= X-Received: by 2002:a05:600c:1da3:b0:410:d1bd:150e with SMTP id p35-20020a05600c1da300b00410d1bd150emr195544wms.14.1707959883121; Wed, 14 Feb 2024 17:18:03 -0800 (PST) MIME-Version: 1.0 References: <87wmr7rssj.fsf@localhost> <875xyq7qbn.fsf@localhost> In-Reply-To: <875xyq7qbn.fsf@localhost> From: John Kitchin Date: Wed, 14 Feb 2024 20:17:51 -0500 Message-ID: Subject: Re: interaction of fontified calendar entries and org-read-date To: Ihor Radchenko Cc: Emacs Orgmode Content-Type: multipart/alternative; boundary="0000000000001fdbd10611616634" Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=jkitchin@andrew.cmu.edu; helo=mail-wm1-x32a.google.com X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URI_DOTEDU=1.12 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -7.87 X-Spam-Score: -7.87 X-Migadu-Queue-Id: CAFD375B3D X-TUID: zfFp3C2Dxsol --0000000000001fdbd10611616634 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks for the tip on `calendar-make-temp-face'. It gets even weirder now. If I use a face, that function does not even seem to get called, so it seems to work. If I use the anonymous face though, it does get called, and I see the inconsistent behavior. However, if I edebug `calendar-make-temp-face' and step through each line, then it works the same as using a face. And, after that it seems to work most of the time. "Do not call this directly from Lisp code; use =E2=80=98defface=E2=80=99 in= stead." seems like a weird message. Where else would one use this? Anyway, thanks again, I have stumbled on a solution, which is to modify `calendar-mark-visible-date' so it does not use `calendar-make-temp-face' . It is a small change of: (t ; attr list (overlay-put (make-overlay (1- (point)) (1+ (point))) 'face (calendar-make-temp-face mark))) to (t ; attr list (overlay-put (make-overlay (1- (point)) (1+ (point))) 'face mark)) That seems to work. A simpler way though is to just put the overlays on manually in the hook, e.g. (let* ((mark-calendar (lambda () ;; Goto today (save-excursion (calendar-cursor-to-visible-date (read (format-time-string "(%m %d %Y)"))) (overlay-put (make-overlay (1- (point)) (1+ (point))) 'face (list :foreground "blue" :weight 'bold))))) (calendar-today-visible-hook)) (add-hook 'calendar-today-visible-hook mark-calendar) (org-read-date)) I can live with that solution. Thanks for the assist! On Wed, Feb 14, 2024 at 3:14=E2=80=AFPM Ihor Radchenko wrote: > John Kitchin writes: > > > why does it work with a face though? > > It really does. That's confusing. And proves that Emacs is smart enough > to invert cursor color in some situations. > > My only guess is that `calendar-make-temp-face' is using `make-face' > incorrectly. I guess that > > Do not call this directly from Lisp code; use `defface' instead. > > in `make-face' docstring is there for a reason. > Maybe report this as Emacs bug in calendar.el? > > -- > Ihor Radchenko // yantar92, > Org mode contributor, > Learn more about Org mode at . > Support Org development at , > or support my work at > --=20 John ----------------------------------- Professor John Kitchin (he/his) Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 https://kitchingroup.cheme.cmu.edu https://pointbreezepubs.gumroad.com/ pycse bookstore --0000000000001fdbd10611616634 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks for the tip on `calendar-make-temp-face'. It ge= ts even weirder now.=C2=A0

If I use a face, that functio= n does not even seem to get called, so it seems to work.

If I use the anonymous face though, it does get called, and I see th= e inconsistent behavior.=C2=A0

However, if I edebu= g `calendar-make-temp-face' and step through each line, then it works t= he same as using a face. And, after that it seems to work most of the time.= =C2=A0

"Do not call this directly from Lisp c= ode; use =E2=80=98defface=E2=80=99 instead." seems like a weird messag= e. Where else would one use this?

Anyway, thanks a= gain, I have stumbled on a solution, which is to modify `calendar-mark-visi= ble-date' so it does not use `calendar-make-temp-face' .
=
It is a small change of:
(t =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ; att= r list
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (overlay-put
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(make-overlay (1- (point)) (1+ (po= int))) 'face
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(calend= ar-make-temp-face mark)))

to=C2=A0
<= br>
(t =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ; attr list =C2=A0 =C2=A0
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (overlay-put
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0(make-overlay (1- (point)) (1+ (point))) 'face
= =C2=A0 =C2=A0 mark))

That seems to work.

A simpler way though is to just put the overlays on m= anually in the hook, e.g.

(let* ((mark-calendar (l= ambda ()
;; Goto today
(save-excursion
=C2=A0(calendar-c= ursor-to-visible-date (read (format-time-string "(%m %d %Y)"))) =C2=A0(overlay-put
=C2=A0 (make-overlay (1- (point)) (1+ (poin= t))) 'face
=C2=A0 (list :foreground "blue" :weight = 9;bold)))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(calendar-today-visible-hook))=C2=A0 (add-hook 'calendar-today-visible-hook
=C2=A0 =C2=A0mark-c= alendar)
=C2=A0 (org-read-date))

I can live= with that solution. Thanks for the assist!

On Wed, Feb 14, 2024 at 3:= 14=E2=80=AFPM Ihor Radchenko <yan= tar92@posteo.net> wrote:
John Kitchin <jkitchin@andrew.cmu.edu> writes:

> why does it work with a face though?

It really does. That's confusing. And proves that Emacs is smart enough=
to invert cursor color in some situations.

My only guess is that `calendar-make-temp-face' is using `make-face'= ;
incorrectly. I guess that

=C2=A0 =C2=A0 Do not call this directly from Lisp code; use `defface' i= nstead.

in `make-face' docstring is there for a reason.
Maybe report this as Emacs bug in calendar.el?

--
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>


--
John

-----------------------------------
Professor= John Kitchin (he/his)
Doherty Hall A207F
Department of Chemical Engi= neering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-78= 03
htt= ps://kitchingroup.cheme.cmu.edu
https://pointbreezepubs.gumroad.com/=C2= =A0pycse bookstore
--0000000000001fdbd10611616634--