From a440510cdd77b00202da63c5870ab186cedd70ab Mon Sep 17 00:00:00 2001 From: plantarum Date: Tue, 26 Jan 2021 13:52:43 -0500 Subject: [PATCH] changed from before/setq to around/let to limit scope let is better than setq, as it doesn't permanently alter the value of org-overriding-default-time. The setq has knock-on impacts in future captures that use the value of this variable, if it is set. --- mu4e/mu4e.texi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mu4e/mu4e.texi b/mu4e/mu4e.texi index c83a06b4..635b67bd 100644 --- a/mu4e/mu4e.texi +++ b/mu4e/mu4e.texi @@ -3453,12 +3453,13 @@ You can extract the event time directly, and have the @code{org-capture} functions use that to set the @code{datetree} location: @lisp -(defun my-catch-event-time (event reply-status) +(defun my-catch-event-time (orig-fun &rest args) "Set org-overriding-default-time to the start time of the capture event" - (setq org-overriding-default-time - (date-to-time (gnus-icalendar-event:start event)))) + (let ((org-overriding-default-time (date-to-time + (gnus-icalendar-event:start (car args))))) + (apply orig-fun args))) -(advice-add 'gnus-icalendar:org-event-save :before #'my-catch-event-time) +(advice-add 'gnus-icalendar:org-event-save :around #'my-catch-event-time) @end lisp If you do this, you'll want to omit the @code{:timeprompt t} setting