emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving some kitten, plus some questions along the way


From: Ihor Radchenko
Subject: Re: Saving some kitten, plus some questions along the way
Date: Sun, 19 May 2024 11:56:41 +0000

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> The patch below replaces a use of `eval` with `apply`, but along the way
> I wondered about some of the details of `org-eval-in-calendar` (see the
> FIXMEs), the most important of them being: why doesn't it use
> `with-selected-window`?

Thanks!
I do not see any clear reason. Just old code from early days of Org mode.

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

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

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]