Sigve Indregard <[email protected]> writes:

> Here is a proposal for a new interactive function `org-todo-at` that
> lets the user supply the time to be used for logging and recurrence
> timestamps.
>
> This is useful to me in habit tracking and on projects where the log
> must be correct. It's not easy to do as a local customization without
> patching org.el, because the inner `org-todo` is not passed the current
> time, but fetches it from `org-current-effective-time`.

Thanks for the patch, and sorry for the late reply.
This addition sounds reasonable.

See some comments on the patch below.

> +(defvar org-override-time nil
> +  "Place for `org-todo-at` to store user-entered time.")

Maybe org-overriding-effective-time is better:
1. It is only used by `org-current-effective-time' and will not really
   affect every place in Org that is using time
2. We have somewhat similar `org-overriding-default-time' - "overriding"

Also, please update the docstring to describe what exactly the variable
does. The existing docstring is not very helpful.

>  (defun org-current-effective-time ()
> -  "Return current time adjusted for `org-extend-today-until' variable."
> -  (let* ((ct (org-current-time))
> +  "Return current time adjusted for `org-extend-today-until' variable"

Please update the docstring documenting what exactly affects the output.

> +  (let* ((ct (or org-override-time (org-current-time)))
> (dct (decode-time ct))
> ...
> ((and org-use-effective-time (< (nth 2 dct) org-extend-today-until))
>           (org-encode-time 0 59 23 (1- (nth 3 dct)) (nth 4 dct) (nth 5 dct)))

With your code, when org-use-effective-time, org-override-time value
will be further adjusted by org-extend-today-until. I am not sure if
this is desired.

> +(defun org-todo-at (&optional arg)
> +  "Like `org-todo` but prompts the user for the time of change."
> +  (interactive "P")
> +  (let ((org-override-time (org-read-date :to_time t)))

What does :to_time refer to?

Finally, please document the new command in etc/ORG-NEWS and possibly in
the manual.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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