* guile: update examples
This commit is contained in:
@ -21,7 +21,7 @@ exec guile -e main -s $0 $@
|
||||
;; Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
(use-modules (ice-9 getopt-long))
|
||||
(use-modules (ice-9 getopt-long) (ice-9 format))
|
||||
(use-modules (srfi srfi-1))
|
||||
(use-modules (mu) (mu message) (mu contact))
|
||||
|
||||
@ -32,16 +32,17 @@ exec guile -e main -s $0 $@
|
||||
(< (timestamp c1) (timestamp c2)))
|
||||
|
||||
(define (export-contact contact form)
|
||||
"Convert CONTACT to a string in format FORM."
|
||||
(let ((email (email contact)) (name (name contact)))
|
||||
(if email ;; filter out anything *without* an email address
|
||||
(cond
|
||||
((string= form "org-contacts")
|
||||
(format #t "* ~a\n:PROPERTIES:\n:EMAIL:~a\n:END:\n\n"
|
||||
(or (name contact) (email contact)) (email contact)))
|
||||
(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 contact) "")
|
||||
(if (name contact)
|
||||
(string-append " <" (email contact) ">")
|
||||
(email contact))))))
|
||||
(or name "")
|
||||
(if name (string-append " <" email ">") email)))))))
|
||||
|
||||
(define (main args)
|
||||
(let* ((optionspec '( (muhome (value #t))
|
||||
@ -66,7 +67,8 @@ exec guile -e main -s $0 $@
|
||||
(display msg)
|
||||
(exit 0))
|
||||
(begin
|
||||
(mu:initialize #t muhome)
|
||||
(setlocale LC_ALL "")
|
||||
(mu:initialize muhome)
|
||||
(let* ((sort-func
|
||||
(cond
|
||||
((string= sort-by "frequency") sort-by-freq)
|
||||
@ -90,7 +92,6 @@ exec guile -e main -s $0 $@
|
||||
(export-contact c form))
|
||||
contacts))))))
|
||||
|
||||
|
||||
;; Local Variables:
|
||||
;; mode: scheme
|
||||
;; End:
|
||||
|
||||
@ -168,7 +168,7 @@ then be used in, e.g., R and gnuplot."
|
||||
(begin
|
||||
(display msg)
|
||||
(exit (if help 0 1))))
|
||||
(mu:initialize #t muhome)
|
||||
(mu:initialize muhome)
|
||||
(cond
|
||||
((string= period "hour") (mu:plot:per-hour expr))
|
||||
((string= period "day") (mu:plot:per-weekday expr))
|
||||
|
||||
Reference in New Issue
Block a user