Skip to content
Browse files

* fix contacts-export, msg-graphs

  • Loading branch information...
1 parent 3ea8b1f commit dec4ce8181f50002a6e001a64af27fb932a113b3 djcb committed Jan 22, 2012
Showing with 7 additions and 20 deletions.
  1. +3 −16 guile/examples/contacts-export
  2. +4 −4 guile/examples/msg-graphs
View
19 guile/examples/contacts-export
@@ -29,20 +29,7 @@ exec guile -e main -s $0 $@
(< (mu:frequency c1) (mu:frequency c2)))
(define (sort-by-newness c1 c2)
- (< (mu:timestamp c1) (mu:timestamp c2)))
-
-(define (export-contact contact form)
- "Convert CONTACT to a string in format FORM."
- (let ((email (mu:email contact)) (name (mu:name contact)))
- (if email ;; filter out anything *without* an email address
- (cond
- ((string= form "org-contacts")
- (format #t "* ~s\n:PROPERTIES:\n:EMAIL:~a\n:END:\n\n"
- (or name email) email))
- ((string= form "plain")
- (format #t "~a~a\n"
- (or name "")
- (if name (string-append " <" email ">") email)))))))
+ (< (mu:last-seen c1) (mu:last-seen c2)))
(define (main args)
(let* ((optionspec '( (muhome (value #t))
@@ -54,7 +41,7 @@ exec guile -e main -s $0 $@
(options (getopt-long args optionspec))
(msg (string-append
"usage: contacts-export [--help] [--muhome=<muhome>] "
- "--format=<org-contacts|wl|mutt-ab|plain(*)> "
+ "--format=<org-contact|mutt-alias|mutt-ab|wanderlust|plain(*)> "
"--sort-by=<frequency(*)|newness> [--revert] [--limit=<n>]\n"))
(help (option-ref options 'help #f))
(muhome (option-ref options 'muhome #f))
@@ -89,7 +76,7 @@ exec guile -e main -s $0 $@
;; export!
(for-each
(lambda (c)
- (export-contact c form))
+ (format #t "~a\n" (mu:contact->string c form)))
contacts))))))
;; Local Variables:
View
8 guile/examples/msg-graphs
@@ -34,7 +34,7 @@ display, otherwise, use a graphical window."
(lambda (msg)
(tm:hour (localtime (mu:date msg)))) expr)
(lambda (x y) (< (car x) (car y))))
- "Messages per hour" "Hour" "Messages" plain-text))
+ (format #f "Messages per hour matching ~a" expr) "Hour" "Messages" plain-text))
(define (per-day expr plain-text)
"Count the total number of messages for each weekday (0-6 for
@@ -46,7 +46,7 @@ display, otherwise, use a graphical window."
(lambda (msg)
(tm:wday (localtime (mu:date msg)))) expr)
(lambda (x y) (< (car x) (car y)))))
- "Messages per weekday" "Day" "Messages" plain-text))
+ (format #f "Messages per weekday matching ~a" expr) "Day" "Messages" plain-text))
(define (per-month expr plain-text)
"Count the total number of messages for each weekday (0-6 for
@@ -59,7 +59,7 @@ display, otherwise, use a graphical window."
(lambda (msg)
(tm:mon (localtime (mu:date msg)))) expr)
(lambda (x y) (< (car x) (car y)))))
- "Messages per month" "Month" "Messages" plain-text))
+ (format #f "Messages per month matching ~a" expr) "Month" "Messages" plain-text))
(define (per-year expr plain-text)
"Count the total number of messages for each weekday (0-6 for
@@ -70,7 +70,7 @@ display, otherwise, use a graphical window."
(lambda (msg)
(tm:year (localtime (mu:date msg)))) expr)
(lambda (x y) (< (car x) (car y))))
- "Messages per year" "Year" "Messages" plain-text))
+ (format #f "Messages per year matching ~a" expr) "Year" "Messages" plain-text))
(define (main args)
(let* ((optionspec '( (muhome (value #t))

0 comments on commit dec4ce8

Please sign in to comment.
Something went wrong with that request. Please try again.