Mention SRFI-26.
[bpt/guile.git] / scripts / summarize-guile-TODO
index af4cdd6..9abdd6c 100755 (executable)
@@ -46,7 +46,7 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@"
 ;; -i, --involved USER  -- select USER-involved items
 ;; -p, --personal USER  -- select USER-responsible items
 ;; -t, --todo           -- select unfinished items (status "-")
-;; -t, --done           -- select finished items (status "+")
+;; -d, --done           -- select finished items (status "+")
 ;; -r, --review         -- select review items (marker "R")
 ;;
 ;; -w, --who            -- also show who is associated w/ the item
@@ -54,7 +54,7 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@"
 ;;
 ;;
 ;; Usage from a Scheme program:
-;;   (summrize-guile-TODO . args)       ; uses first arg only
+;;   (summarize-guile-TODO . args)      ; uses first arg only
 ;;
 ;;
 ;; Bugs: (1) Markers are scanned in sequence: D R X N%.  This means "XD"
@@ -74,6 +74,7 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@"
   :use-module (scripts read-text-outline)
   :use-module (ice-9 getopt-long)
   :autoload (srfi srfi-13) (string-tokenize) ; string library
+  :autoload (srfi srfi-14) (char-set) ; string library
   :autoload (ice-9 common-list) (remove-if-not)
   :export (summarize-guile-TODO))
 
@@ -85,7 +86,7 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@"
          => (lambda (who)
               (put x 'who
                    (map string->symbol
-                        (string-tokenize who #\:))))))
+                        (string-tokenize who (char-set #\:)))))))
   (cond ((get x 'pct-done)
          => (lambda (pct-done)
               (put x 'pct-done (string->number pct-done)))))
@@ -155,31 +156,37 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@"
           (loop (cdr sub) (remove-if-not (car sub) items))))))
 
 (define (make-display-item show-who? show-parent?)
-  (lambda (item)
-    (format #t "status: ~A~A~A~A~A~A\nitem  : ~A\n"
-            (get item 'status)
-            (if (get item 'design?) "D" "")
-            (if (get item 'review?) "R" "")
-            (if (get item 'extblock?) "X" "")
-            (cond ((get item 'pct-done)
-                   => (lambda (pct-done)
-                        (format #f " ~A%" pct-done)))
-                  (else ""))
-            (cond ((get item 'who)
-                   => (lambda (who)
-                        (if show-who?
-                            (format #f " ~A" who)
-                            "")))
-                  (else ""))
-            item)
-    (and show-parent?
-         (let loop ((parent (get item 'parent)) (indent 2))
-           (and parent
-                (begin
-                  (format #t "under : ~A~A\n"
-                          (make-string indent #\space)
-                          parent)
-                  (loop (get parent 'parent) (+ 2 indent))))))))
+  (let ((show-who
+         (if show-who?
+             (lambda (item)
+               (cond ((get item 'who)
+                      => (lambda (who) (format #f " ~A" who)))
+                     (else "")))
+             (lambda (item) "")))
+        (show-parents
+         (if show-parent?
+             (lambda (item)
+               (let loop ((parent (get item 'parent)) (indent 2))
+                 (and parent
+                      (begin
+                        (format #t "under : ~A~A\n"
+                                (make-string indent #\space)
+                                parent)
+                        (loop (get parent 'parent) (+ 2 indent))))))
+             (lambda (item) #t))))
+    (lambda (item)
+      (format #t "status: ~A~A~A~A~A~A\nitem  : ~A\n"
+              (get item 'status)
+              (if (get item 'design?) "D" "")
+              (if (get item 'review?) "R" "")
+              (if (get item 'extblock?) "X" "")
+              (cond ((get item 'pct-done)
+                     => (lambda (pct-done)
+                          (format #f " ~A%" pct-done)))
+                    (else ""))
+              (show-who item)
+              item)
+      (show-parents item))))
 
 (define (display-items p items)
   (let ((display-item (make-display-item (option-ref p 'who #f)