mirror of https://github.com/djcb/mu.git
* fix contacts-export, msg-graphs
This commit is contained in:
parent
3ea8b1fe8c
commit
dec4ce8181
|
@ -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:
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue