From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Dan Drake <dan.drake@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [RFC PATCH] specify a time, not number of minutes to keep, with org-resolve-clock
Date: Sat, 25 Jan 2020 00:30:57 +0100 [thread overview]
Message-ID: <87sgk4o2j2.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <CAKqbAeEPFi8jDEP0D7OCQxUdpc0pRdQ0PEuwrbWB1T1S8Lv5sg@mail.gmail.com> (Dan Drake's message of "Sun, 19 Jan 2020 14:13:41 -0600")
Hello,
Dan Drake <dan.drake@gmail.com> writes:
> I asked about a way to specify a time when using org-resolve-clock instead
> of a number of minutes:
>
> https://lists.gnu.org/archive/html/emacs-orgmode/2020-01/msg00010.html
>
> I've implemented this myself and a patch is attached. Comments welcome --
> my change works, but I'm not sure about coding style, and right now there's
> no error checking.
Thank you. Some comments follow.
> I marked the patch as a tiny change, but it does add a new menu option and
> behavior to org-resolve-clock, so there may be an argument that it's not,
> from a user perspective, a "tiny change", but code-wise it's quite simple:
> the core logic really isn't more than "ask the user for a time and
> subtract".
TINYCHANGE is only about the number of non-trivial lines of code in your
patch (15 or so).
> +(defun time-to-mins-to-keep (start-time)
> + "Asks the user for a time and returns the number of minutes
> +from START-TIME to that time."
> + (floor (/ (float-time
> + (time-subtract (org-read-date t t) start-time)) 60)))
The name of the function is wrong, it should start with "org-clock".
Also, docstring's first line must contain a full sentence.
Anyway, this is used only once in your patch, I suggest to inline in
instead.
> + (or (and (memq ch '(?k ?K))
> + (read-number "Keep how many minutes? " default))
> + (and (memq ch '(?t ?T))
> + (time-to-mins-to-keep last-valid))))
See above about inlining.
Would you mind adding an ORG-NEWS entry, and, if possible, writing
a test?
Regards,
--
Nicolas Goaziou
next prev parent reply other threads:[~2020-01-24 23:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-19 20:13 [RFC PATCH] specify a time, not number of minutes to keep, with org-resolve-clock Dan Drake
2020-01-24 23:30 ` Nicolas Goaziou [this message]
2020-01-29 2:11 ` Dan Drake
2020-01-29 9:49 ` Nicolas Goaziou
2020-01-29 12:47 ` Bastien
2020-02-01 10:22 ` Nicolas Goaziou
2020-02-01 13:10 ` Bastien
2020-02-01 14:15 ` Nicolas Goaziou
2020-02-01 14:34 ` Bastien
2020-02-01 16:48 ` Nicolas Goaziou
2020-02-02 13:41 ` Dan Drake
2020-02-02 13:51 ` Bastien
2020-02-03 14:41 ` Robert Pluim
2020-02-03 14:53 ` Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sgk4o2j2.fsf@nicolasgoaziou.fr \
--to=mail@nicolasgoaziou.fr \
--cc=dan.drake@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.