[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Saving some kitten, plus some questions along the way
From: |
Stefan Monnier |
Subject: |
Re: Saving some kitten, plus some questions along the way |
Date: |
Sun, 19 May 2024 10:40:01 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>> - (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?
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`?
>> -(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.
Stefan
- Saving some kitten, plus some questions along the way, Stefan Monnier, 2024/05/18
- Re: Saving some kitten, plus some questions along the way, Ihor Radchenko, 2024/05/19
- Re: Saving some kitten, plus some questions along the way,
Stefan Monnier <=
- Re: Saving some kitten, plus some questions along the way, Ihor Radchenko, 2024/05/19
- Re: Saving some kitten, plus some questions along the way, Stefan Monnier, 2024/05/19
- Re: Saving some kitten, plus some questions along the way, Ihor Radchenko, 2024/05/20
- Re: Saving some kitten, plus some questions along the way, Max Nikulin, 2024/05/21