Skip to content

Instantly share code, notes, and snippets.

@dmj
Created October 21, 2015 09:16
Show Gist options
  • Save dmj/6f30151f11dbf39c0422 to your computer and use it in GitHub Desktop.
Save dmj/6f30151f11dbf39c0422 to your computer and use it in GitHub Desktop.
diff --git a/doc/wl.texi b/doc/wl.texi
index 8aa0f76..a887111 100644
--- a/doc/wl.texi
+++ b/doc/wl.texi
@@ -1626,6 +1626,7 @@ lastweek -> same day of last week.
lastmonth -> same day of last month.
lastyear -> same day of last year.
@var{number}daysago -> @var{number} days ago. (e.x. '3daysago')
+@var{number}weeksago -> @var{number} weeks ago (e.x. '3weeksago)
@var{day}-@var{month}-@var{year} -> specify date directly (ex. 1-Nov-1998)
@end group
@end example
diff --git a/elmo/elmo-date.el b/elmo/elmo-date.el
index 59b48e2..54fdc22 100644
--- a/elmo/elmo-date.el
+++ b/elmo/elmo-date.el
@@ -139,9 +139,10 @@ Otherwise treat \\ in NEWTEXT string as special:
pair)
(if (setq pair (assq (intern suffix) elmo-date-descriptions))
(elmo-datevec-substitute today (cdr pair))
- (if (string= "daysago" suffix)
- (elmo-date-get-offset-datevec today number)
- (error "%s is not supported yet" suffix)))))
+ (cond
+ ((string= "daysago" suffix) (elmo-date-get-offset-datevec today number))
+ ((string= "weeksago" suffix) (elmo-date-get-offset-datevec today (* 7 number)))
+ (t (error "%s is not supported yet" suffix))))))
((string-match "[0-9]+-[A-Za-z]+-[0-9]+" description)
(timezone-fix-time
(concat (elmo-replace-in-string description "-" " ") " 0:0")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment