diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2015-04-05 09:55:36 +0900 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2015-04-05 09:55:36 +0900 |
commit | 654af547f5ace39f73c7757f83065c5e882c605f (patch) | |
tree | ce8901f5108dfab91689dcf312deafbb44d906c5 | |
parent | 80479b62e51ff13cd24baf4a1a22999303144d48 (diff) | |
download | srem-654af547f5ace39f73c7757f83065c5e882c605f.tar.gz |
snip e.g. ":APPT::" off the end of Emacs rems
-rw-r--r-- | src/Utility/Emacs.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Utility/Emacs.hs b/src/Utility/Emacs.hs index 85a67a4..b5ac09f 100644 --- a/src/Utility/Emacs.hs +++ b/src/Utility/Emacs.hs @@ -46,17 +46,21 @@ parseEmacsOutput = foldr step [] . drop 2 . lines parseLine :: String -> Maybe [Reminder] parseLine line = do when (not lineMatch) $ fail "" - let hStr:mStr:s:[] = drop 1 . concat $ lineMatchStrings + let hStr:mStr:sStr:[] = drop 1 . concat $ lineMatchStrings h <- readMaybe hStr m <- readMaybe mStr + let s = snip sStr staggeredReminders =<< makeReminder h m s where apptRegexp = " ([0-9]{1,2}):([0-9][0-9])[-]{0,1}[0-9:]{0,5}[.]* (.*)$" - snipRegexp = "[ ]{2,}:.*:*$" + snipRegexp = "[ ]{1,}:.*:*$" lineMatch = line =~ apptRegexp :: Bool lineMatchStrings = line =~ apptRegexp :: [[String]] + fst3 (x, _, _) = x + snip s = fst3 (s =~ snipRegexp :: (String, String, String)) + staggeredReminders :: Reminder -> Maybe [Reminder] staggeredReminders r = sequence $ foldr step [] SremConfig.intervals where |