diff --git a/guile/examples/contacts-export b/guile/examples/contacts-export index bc7a3e6c..731f25f5 100755 --- a/guile/examples/contacts-export +++ b/guile/examples/contacts-export @@ -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) - (cond - ((string= form "org-contacts") - (format #t "* ~a\n:PROPERTIES:\n:EMAIL:~a\n:END:\n\n" - (or (name contact) (email contact)) (email contact))) - ((string= form "plain") - (format #t "~a~a\n" - (or (name contact) "") - (if (name contact) - (string-append " <" (email contact) ">") - (email contact)))))) + "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 "* ~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))))))) (define (main args) (let* ((optionspec '( (muhome (value #t)) @@ -66,11 +67,12 @@ 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) - ((string= sort-by "newness") sort-by-newness) + ((string= sort-by "frequency") sort-by-freq) + ((string= sort-by "newness") sort-by-newness) (else (begin (display msg) (exit 1))))) (contacts '())) ;; make a list of all contacts @@ -90,7 +92,6 @@ exec guile -e main -s $0 $@ (export-contact c form)) contacts)))))) - ;; Local Variables: ;; mode: scheme ;; End: diff --git a/guile/examples/msg-stats b/guile/examples/msg-stats index f3dbbc11..b29aad80 100755 --- a/guile/examples/msg-stats +++ b/guile/examples/msg-stats @@ -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))