-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Readers #26
Comments
Your first lesson... :) Haha, seriously though, I'm glad you're taking an interest in the subject, because a better API is certainly needed. My own attempts at using Org's code proved complicated, as you also found. Here are some thoughts:
I don't object, in principle. I would prefer that Emacs have such functions itself someday, but maybe we can be at least a testing/proving ground for an implementation. (With that in mind, I'd probably ask that any code contributions come from an author who's signed the FSF Copyright Assignment, so it could be upstreamed into Emacs someday.)
shrug As many as seem reasonable? As many as we can find? Something like that. I think we'd want to handle both relative and absolute ones, of course. Ideally we should probably also have a way to plug in words and abbreviations from other languages, because it's probably common for users to use both English and another language when working with times and dates and other people.
I'd guess that we should provide a library in a separate file, like What do you think? Thanks. |
Some code I just wrote needed understand these input formats:
To do this attempting to re-use bits from around Emacs, I had to rob
run-at-time
and lean ondiary-lib
other bits. Given how common applications using time are, my expectation was a more unified set of tools. The results:https://github.com/positron-solutions/champagne/blob/master/lisp/champagne.el#L199-L246
The other path I looked at was
org-read-date
.org-read-date
is powerful, but is not IMO designed for programmers. Mainly, it requires let-bindingorg-popup-calendar-for-date-prompt
andorg-read-date-prefer-future
instead accepting proper arguments like other readers. Its output is a timestamp.The
timer-duration-words
style parsing approach looks like a near match for usingts-apply
andts-adjust
downstream, returning a time that is adjusted either relatively or absolutely. For arguments:ts-apply
versusts-adjust
would depend on whether a recognized format is time-like or duration-like.HH:MM
are ambiguously both times and durations. An argument should control preference forHH:MM
orMM:SS
etc.That's enough for now.
org-read-date
demonstrates how complex things can get if a nearly complete cover is attempted.The text was updated successfully, but these errors were encountered: