[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH] specify a time, not number of minutes to keep, with org-
Re: [RFC PATCH] specify a time, not number of minutes to keep, with org-resolve-clock
Tue, 28 Jan 2020 20:11:42 -0600
Thank you, Nicolas, for the review of my first patch. I've updated my code and have the new patch attached.
I didn't inline the "time to minutes to keep function"; yes, that function is very short, but the function name makes the intent/purpose of the code obvious, and the org-clock-resolve a bit more readable. If it's important to inline that -- performance concerns about the function call overhead, accepting org-mode/emacs coding style, etc. -- I'm willing to do that.
I added an entry to ORG-NEWS for version 9.4.
I didn't write any tests, as the change seems so simple, and UI-focused. But again, if that's a dealbreaker, I can work on doing that.
Further comments welcome.
On Fri, Jan 24, 2020 at 5:31 PM Nicolas Goaziou <address@hidden
Dan Drake <address@hidden> writes:
> I asked about a way to specify a time when using org-resolve-clock instead
> of a number of minutes:
> 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
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
> + (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
Ceci n'est pas une .signature.
Description: Text Data