From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id iMwGJ1UQSma7CQEAqHPOHw:P1 (envelope-from ) for ; Sun, 19 May 2024 16:44:37 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id iMwGJ1UQSma7CQEAqHPOHw (envelope-from ) for ; Sun, 19 May 2024 16:44:37 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=EArvrjzD; dmarc=pass (policy=none) header.from=posteo.net; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1716129877; 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=HmvL6buk3qQenWspDlg2meTXxXcLKkBlP7ZWAKRQTpU=; b=jVjM2+33i/5iOj8TWE8DNnbb5O9GZAJR1sUdz/OyjIdy6xjgqQg65/hzW95DtmNi0Axihh 94LknmdSyvJD90+GWUbMThRV02A6pS0OC0xtEwzvCOYnEcsT5qLAC8z2E6g7Sm0urB8ilS /3wxtpNAtiMBzdrMBs6Isg5B99GRTY/wZK5wsVX9Xodrnw39AJP8Q0vJ1w/3ZHkyzgYxPg xaEkgVoFUgt5UwXpC8b7xr+IqqXUYVaPoo9n+BTesLADpuYu9wPdSIUBTrayRk+SYMC/Kf 7/QSgXyItWb1W3ETZwpj7OhItIjUYEMRV53XGkDXhlH2ipbNwKd1FUcCuT2wSQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1716129877; a=rsa-sha256; cv=none; b=fhD7iA6lvIojuV+vJKKeRsjhQqYcetkoMM7FIhY8vaouNK38PyA+rhcA4Fv+VxN5A+dXxZ X0wk1jIMCjOWr3i+jC+th57VhCD9RfnRSZz55ciQdrbomOUNrl79d9Tc1Yi5/i6cSEjNss vIW72QyvmmFrR0teJBjbBH+lzTwW+WIEcn1x865HYBE/r7xIi3RMFqUPFiiAIiNenf9BQB EgjAn7UQmDwinhTkBduZZLe5nhCHc+SK3Dyu1Ivyu9GmOz1JGken2KHzcIk19jYlXwS1yI 6v9xXy8TviyrIBuZM2vpENBQm121IyX2LVElRWNxxr9YiUp2tfQ2upoddQ/tyA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=EArvrjzD; dmarc=pass (policy=none) header.from=posteo.net; 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" 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 7998076185 for ; Sun, 19 May 2024 16:44:37 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s8hlv-0005qz-1A; Sun, 19 May 2024 10:44:23 -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 1s8hlp-0005qg-6d for emacs-orgmode@gnu.org; Sun, 19 May 2024 10:44:17 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s8hll-0003Rn-Be for emacs-orgmode@gnu.org; Sun, 19 May 2024 10:44:15 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 425A7240027 for ; Sun, 19 May 2024 16:44:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1716129851; bh=f6H0V/TVyZyvp7j2zkU9fgVyVblGiv3dm/oo3IuXQ10=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=EArvrjzD8EXHLgKnE79JNcpTzUKwScA5tROaYkr0xq5t7bSQTmg95GsHngdxuHUmi LzVb+igoYbe70VLOSh2pev47Tzl5Ti+Y1mby8187AKK743lTufwCGsouTsJAn3pgWI b5wtdhf2Ml4Npc8k/sXhVqeWXHPX2XgXY6MMqgfNLv8sd7zxTnK1c0Pz6XmzkdU23g k1tQfF8YwBCb/CdLNvLdQwv9vse8oWOg4EmMKEkfFJwf96YXbKlZNVbilF8ugVDk+7 XU3mFQHPtrwJkEXW6HXA3W0i012KRAUwBjPPGRS1qZjCHYtOVUvGGitYlVwewa8Bcq qFNsao9CYo6ug== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Vj3P65HRkz9rxK; Sun, 19 May 2024 16:44:10 +0200 (CEST) From: Ihor Radchenko To: Stefan Monnier Cc: emacs-orgmode@gnu.org Subject: Re: Saving some kitten, plus some questions along the way In-Reply-To: References: <87ikza3thi.fsf@localhost> Date: Sun, 19 May 2024 14:45:53 +0000 Message-ID: <87a5klsvvi.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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-Spam-Score: -6.57 X-Spam-Score: -6.57 X-Migadu-Queue-Id: 7998076185 X-Migadu-Scanner: mx11.migadu.com X-TUID: XZFJoDDWhG6b Stefan Monnier writes: >>> - (org-eval-in-calendar '(setq cursor-type nil) t) >>> + ;; FIXME: Could we use `with-current-buffer' or do we really >>> + ;; need the `move-overlay' that's in `org-funcall-in-calendar'? >>> + (org-funcall-in-calendar (lambda () (setq cursor-type nil)) t) >> >> `move-overlay' is important - this is additional decoration that Org >> mode uses to indicate "current" date in the calendar while the focus is >> on other window and the cursor may not be clearly visible. > > I understand it's important in general, but the question is for this > specific use of `org-funcall-in-calendar` where all we do (apparently) > is to set `cursor-type` which shouldn't require any change to the > overlay (nor does it require to `select-window`), or should it? No, it should not, and it does not require `select-window'. > Along the same lines, maybe: > > (progn > (calendar-forward-day (- (time-to-days org-def) > (calendar-absolute-from-gregorian > (calendar-current-date)))) > (org-funcall-in-calendar #'ignore t) > (let* ((old-map (current-local-map)) > (map (copy-keymap calendar-mode-map)) > (minibuffer-local-map > > should turn into something like: > > (let ((days (- (time-to-days org-def) > (calendar-absolute-from-gregorian > (calendar-current-date))))) > (org-funcall-in-calendar #'calendar-forward-day t days) > (let* ((old-map (current-local-map)) > (map (copy-keymap calendar-mode-map)) > (minibuffer-local-map > > so it's clear why we need to use `org-funcall-in-calendar`? Yes. Looks reasonable. >>> -(defun org-eval-in-calendar (form &optional keepdate) >>> - "Eval FORM in the calendar window and return to current window. >>> +(defun org-funcall-in-calendar (func &optional keepdate &rest args) >>> + "Call FUNC in the calendar window and return to current window. >> Why not a macro? Having to write lambda may be awkward. > > [ Hmm... in my book, writing `lambda` should not be considered awkward. ] > > So far there are only two uses of `org-funcall-in-calendar` which go > through `lambda`, one of them is quoted and discussed above and the > other is the backward compatibility wrapper `org-eval-in-calendar`, so > I'm not sure it's worth the trouble. But if you want, I can include > a macro for it, of course. Not necessary. Lambda is also ok, I just slightly prefer macro. The only reason why I call lambda "awkward" is because it is more typing. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at