From 654af547f5ace39f73c7757f83065c5e882c605f Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 5 Apr 2015 09:55:36 +0900 Subject: snip e.g. ":APPT::" off the end of Emacs rems --- src/Utility/Emacs.hs | 8 ++++++-- 1 file 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 -- cgit v1.2.3