Skip to content

Instantly share code, notes, and snippets.

@TikhonJelvis
Created May 10, 2022 15:59
Show Gist options
  • Save TikhonJelvis/4a3fa0f8cc9fae9068e8560ddbc6c29e to your computer and use it in GitHub Desktop.
Save TikhonJelvis/4a3fa0f8cc9fae9068e8560ddbc6c29e to your computer and use it in GitHub Desktop.
(defun org-read-add-default-time
(&optional with-time to-time from-string prompt
default-time default-input inactive)
"Filters the inputs to `org-read-date', setting the current time
as the default input if one was not already specified."
(let ((new-default (or default-input (format-time-string "%H:%M"))))
(list with-time to-time from-string prompt
default-time new-default inactive)))
(define-advice org-read-date (:filter-args (args) default-current-time)
"Use the current time as the default input for `org-read-date'
unless one was provided."
(apply 'org-read-add-default-time args))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment