Starting with time-1.10, the iso8601DateFormat function was deprecated
in favour of more sophisticated methods for showing ISO 8601 date
formats—as such, follow the libraries lead.
Sadly, the new functionality was only introduced in time-1.9, meaning
GHC 8.8 and up. Since we still support 8.6, the introduction of some
CPP is necessary.
This is (i) much simpler to use and (ii) helps us with refiling. Emacs
will ignore todo keywords _that it knows_ when refiling, but when
started in batch-mode it doesn't know a whole lot. One would need to
thread the `todoKeywords' through to `refile' and then set
`org-todo-keywords' or a similar variable, which does not sound like a
good experience. Hence, falling back to showing the todo keyword to the
user when deciding upon a headline sounds acceptable.
This ensures that we always immediately expand the file path upon
constructing an `OrgMode' record. We thus do not have to do this in
`mkOrgPrompt' anymore.
By being a bit less greedy with consuming whitespace in the date/time
parsers, we can make the `prop_{encode,decode}Preservation` properties
well-defined again.
There are a lot of times when we could already check for "valid" input
during parsing instead of relaying possibly incorrect dates and times to
`org-mode`. This seems like a sensible thing to do—I don't think anyone
would ever want to schedule anything for 35:90 :)
This patch fixes the date parsing issue currently when an entry like
`todo +d 22 01 2022` is used. I have added tests too which demonstrate
the current issue so that we can prevent future regression.
Since we now have an "internal" parser library in xmonad, use it. This
allows us to get rid of some hacks in this module that were needed
because of ReadP's parsing behaviour.
It is already possible to "start" from $HOME by specifying a relative
directory (one starting without a starting slash). However, it is often
nice to be explicit about this by writing `~/' directly—support this.
So far, while parsing strings like "<ptn><more-letters>", the `getLast`
function immediately stopped on strings of the form "<ptn><whitespace>".
This may be a bit confusing given the functions name. Strings of
the—perhaps artificial—form
"a +d f 1 +d f 2"
would be cut short and parsed as
Deadline "a" (Time { date = Next Friday, tod = Just 01:00 })
instead of the more intuitive
Deadline "a +d f 1" (Time { date = Next Friday, tod = Just 02:00 }).
This is readily fixed by applying the `go` parser as often as possible,
only returning the longest list, and then pruning eventual leftovers at
the end of the string. Since we were already invoking `dropWhileEnd` to
trim whitespace before, the added `reverse`s should not impact
performance at all.
Fixes: https://github.com/xmonad/xmonad-contrib/issues/584
This is for disambiguation purposes. Otherwise, there is no way to
decide whether
message +s 17 jul 12
wants to schedule the note for the 17th of july at 12:00, or for
the 17th of july in the year 12. The easiest way around this is to
stipulate that people want to make these notes for the future more
often than not and to simply prohibit note before the year 25 (as that
is where the valid times end).
Instead of trying to find a prefix and then killing the rest of the
word, actually see whether it at least fits the pattern. This means
that
message +s saturated
will no longer parse as a scheduled item for saturday, while
message +s satur
still will.
If we have a URL in the clipboard and we use `orgPromptPrimary`, it
would be nice if
message +s 11 jan 2013
would result in
* TODO [[_URL_][message]]
SCHEDULED: <2013-01-11 Fri>
instead of the current
* TODO message
SCHEDULED: <2013-01-11 Fri>
_URL_
This has the advantage that if one shows scheduled or deadlines items in
the org-agenda, it is possible to immediately follow this link with
`C-c C-o` or similar functionality.
The URL detection is very rudimentary right now. One use `parseURI`
from `network-uri`, but that would be an additional dependency that I
didn't think was worth it.
This implements whitespace pruning at the end of a sheduled item or
deadline. If we have a message like
This is a message +s today
it is expected that we created a heading of just "This is a message",
without the extra whitespace.
This is a convenience module in order to have less import noise. It
re-exports the following:
a) Commonly used modules in full (Data.Foldable, Data.Applicative, and
so on); though only those that play nicely with each other, so that
XMonad.Prelude can be imported unqualified without any problems.
This prevents things like `Prelude.(.)` and `Control.Category.(.)`
fighting with each other.
b) Helper functions that don't necessarily fit in any other module;
e.g., the often used abbreviation `fi = fromIntegral`.