Earl Chase <[email protected]> writes:

>> I suggest building upon existing patch that uses global variable
>> instead. See https://list.orgmode.org/orgmode/[email protected]/
>
> I reverted my changes and followed your advice. Unfortunately, I was not
> able to create ert-tests for this approach. But it does work when I test it
> manually.

Indeed. We need some Elisp API to provide date to org-todo-at.
org-read-date should only be used interactively.

> +- {{{kbd(C-c M-t)}}} (~org-todo-at~) ::
> +
> +  #+kindex: C-c M-t
> +  #+cindex: cycling, of TODO states
> +  Rotate the TODO state of the current item,
> +  just like ~org-todo~.  Will prompt you for
> +  a time for each state change.

We also need other similar commands. For example, org-agenda-todo-at.

> +(defvar org-overriding-effective-time nil
> +  "Place for `org-todo-at' to store user-entered time.
> +Used to override the value return by `org-current-effective-time'.")

This affects more than just org-todo-at, but everything using
org-current-effective-time. The docstring should reflect that.

> +(defun org-todo-at (&optional arg)
> +  "Like `org-todo', but you will be prompted for a time.
> +The value you provided will be used as the time value of any
> +state change that is triggered by `org-todo'.
> +
> +With `\\[universal-argument]' prefix ARG, force logging the state change \
> +and take a
> +logging note.
> +With a `\\[universal-argument] \\[universal-argument]' prefix, switch to the 
> \
> +next set of TODO \
> +keywords (nextset).
> +Another way to achieve this is `S-C-<right>'.
> +With a `\\[universal-argument] \\[universal-argument] 
> \\[universal-argument]' \
> +prefix, circumvent any state blocking.
> +With numeric prefix arg, switch to the Nth state.
> +
> +With a numeric prefix arg of 0, inhibit note taking for the change.
> +With a numeric prefix arg of -1, cancel repeater to allow marking as DONE.

Copy-pasting docstring from org-todo is not useful. We should better
just put a link to org-todo docstring.

> +  (interactive)

This will make org-todo-at ignore all the prefix arguments.

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