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.
This commit is contained in:
@ -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:
|
functions use that to set the @code{datetree} location:
|
||||||
|
|
||||||
@lisp
|
@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"
|
"Set org-overriding-default-time to the start time of the capture event"
|
||||||
(setq org-overriding-default-time
|
(let ((org-overriding-default-time (date-to-time
|
||||||
(date-to-time (gnus-icalendar-event:start event))))
|
(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
|
@end lisp
|
||||||
|
|
||||||
If you do this, you'll want to omit the @code{:timeprompt t} setting
|
If you do this, you'll want to omit the @code{:timeprompt t} setting
|
||||||
|
|||||||
Reference in New Issue
Block a user