From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.sources Subject: todo Date: Tue, 09 Sep 2003 16:15:12 +0200 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: Reply-To: ttn@glug.org NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1063116997 13395 80.91.224.253 (9 Sep 2003 14:16:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 9 Sep 2003 14:16:37 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Sep 09 16:16:36 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19wjIJ-00021E-00 for ; Tue, 09 Sep 2003 16:16:35 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 19wjFW-0004PO-Uj for guile-user@m.gmane.org; Tue, 09 Sep 2003 10:13:42 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.22) id 19wjDw-00046u-Mb for guile-user@gnu.org; Tue, 09 Sep 2003 10:12:04 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.22) id 19wjDt-00045W-Go for guile-user@gnu.org; Tue, 09 Sep 2003 10:12:01 -0400 Original-Received: from [151.37.48.100] (helo=surf.glug.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 19wjC3-0003MI-5g; Tue, 09 Sep 2003 10:10:07 -0400 Original-Received: from ttn by surf.glug.org with local (Exim 3.35 #1 (Debian)) id 19wjGy-0006yv-00; Tue, 09 Sep 2003 16:15:12 +0200 Original-To: guile-sources@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:2247 gmane.lisp.guile.sources:56 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:2247 nothing a few lines of shell script couldn't replace... on the other hand, Some Day we will be able to boot into scheme like the PLT folks... thi ______________________________________ #!/bin/sh exec guile -s $0 "$@" !# ;;; todo --- display TODO files in various ways ;; Copyright (C) 2003 Thien-Thi Nguyen ;; This program is part of ttn-do, released under GNU GPL v2 with ABSOLUTELY ;; NO WARRANTY. See http://www.gnu.org/copyleft/gpl.txt for details. ;;; Commentary: ;; Usage: todo [OPTIONS] [PROJECT] ;; ;; Summarize PROJECT's todo file using "guile-tools summarize-guile-TODO". ;; PROJECT is a regular expression that may match one or more todo file ;; names registered in the meta data file (see `--meta' below). If PROJECT ;; is omitted, all projects are selected. ;; ;; OPTIONS are zero or more of: ;; -L, --list -- display mtime and name of each todo file regsitered ;; -M, --meta FILE -- use FILE for meta data [default: $HOME/.todo.list] ;; ;; These options are also accepted (passed through to summarize-guile-TODO): ;; -i, --involved USER -- select USER-involved items ;; -p, --personal USER -- select USER-responsible items ;; -t, --todo -- select unfinished 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 ;; -n, --no-parent -- do not show parent chain ;;; Code: (use-modules (scripts PROGRAM) (scripts summarize-guile-TODO) (ttn expand-file-name)) (define (display-mtime-and-name name) (format #t "~A ~A\n" (let ((full (expand-file-name name))) (if (file-exists? full) (strftime "%Y-%m-%d %H:%M:%S" (localtime (stat:mtime (stat full)))) " (does not exist) ")) name)) (define *summarize-guile-TODO-option-spec* '((involved (single-char #\i) (value #t)) (personal (single-char #\p) (value #t)) (todo (single-char #\t)) (done (single-char #\d)) (review (single-char #\r)) (who (single-char #\w)) (no-parent (single-char #\n)))) (define (make-display-todo-file-proc qop) (let* ((options '()) (chk! (lambda (key) (let ((val (qop key))) (and val (set! options (acons key val options))))))) (for-each chk! (map car *summarize-guile-TODO-option-spec*)) (lambda (name) ; rv (format #t "todofile: ~A\n" name) (summarize-guile-TODO options (expand-file-name name)) (newline)))) (define (main/qop qop) (let ((all (let ((inp (open-input-file (or (qop 'meta) (format #f "~A/.todo.list" (getenv "HOME")))))) (let loop ((f (read inp)) (acc '())) (if (eof-object? f) (begin (close-port inp) (reverse acc)) (loop (read inp) (cons f acc))))))) (cond ((qop 'list) (for-each display-mtime-and-name all)) ((null? (qop '())) (for-each (make-display-todo-file-proc qop) all)) (else (let ((rx (make-regexp (car (qop '())))) (spew (make-display-todo-file-proc qop))) (for-each (lambda (name) (and (regexp-exec rx name) (spew name))) all))))) #t) (HVQC-MAIN (command-line) main/qop '(usage . commentary) '(version . "1.0") '(package . "ttn-do") `(option-spec (meta (single-char #\M) (value #t)) (list (single-char #\L)) ;; these are passed to `summarize-guile-TODO' ,@*summarize-guile-TODO-option-spec*)) ;;; todo ends here _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user