summaryrefslogtreecommitdiff
path: root/src/guile/skribilo.scm
diff options
context:
space:
mode:
authorLudovic Courtès2007-12-12 15:33:43 +0100
committerLudovic Courtès2007-12-12 15:33:43 +0100
commit13b626d1801f051ae09f109c4441b7f6009f5c2f (patch)
tree137900c352158ed8accecc9a02d454a1d96431fe /src/guile/skribilo.scm
parent8c78bae70a48d4cc76395aa16bae84a728d24a6d (diff)
downloadskribilo-13b626d1801f051ae09f109c4441b7f6009f5c2f.tar.gz
skribilo-13b626d1801f051ae09f109c4441b7f6009f5c2f.tar.lz
skribilo-13b626d1801f051ae09f109c4441b7f6009f5c2f.zip
Improve handling of `--debug'.
* src/guile/skribilo.scm (%options)[--debug]: Don't use `make-level-processor' so that `-g' can be passed a symbol to be watched. (%default-options): Add `:watched-symbols'. (skribilo): Parameterize `*watched-symbols*'.
Diffstat (limited to 'src/guile/skribilo.scm')
-rw-r--r--src/guile/skribilo.scm38
1 files changed, 26 insertions, 12 deletions
diff --git a/src/guile/skribilo.scm b/src/guile/skribilo.scm
index b19666d..9ca43a3 100644
--- a/src/guile/skribilo.scm
+++ b/src/guile/skribilo.scm
@@ -295,10 +295,21 @@ Report bugs to <~a>.~%"
(option '(#\v "verbose") #f #t
(make-level-processor :verbose 0))
- (option '(#\g "debug") #f #t
- (make-level-processor :debug 0))
(option '(#\w "warning") #f #t
- (make-level-processor :warning 1))))
+ (make-level-processor :warning 1))
+ (option '(#\g "debug") #f #t
+ (lambda (opt name arg result)
+ (let ((num (string->number arg)))
+ (if (integer? num)
+ (alist-cons key (if (string? arg)
+ (or (string->number arg) default)
+ default)
+ result)
+ (let ((watched (assoc :watched-symbols result)))
+ (alist-cons :watched-symbols
+ (cons (string->symbol arg)
+ (cdr watched))
+ result))))))))
(define %default-options
;; Default value of various command-line options.
@@ -311,7 +322,8 @@ Report bugs to <~a>.~%"
(:doc-path ".")
(:bib-path ".")
(:source-path ".")
- (:image-path ".")))
+ (:image-path ".")
+ (:watched-symbols)))
(define (parse-args args)
"Parse argument list @var{args} and return an alist with all the relevant
@@ -341,6 +353,7 @@ options."
(verbosity-level (assoc-ref options :verbose))
(debugging-level (assoc-ref options :debug))
(warning-level (assoc-ref options :warning))
+ (watched-symbols (assoc-ref options :watched-symbols))
(load-path (assoc-ref options :doc-path))
(bib-path (assoc-ref options :bib-path))
@@ -357,14 +370,15 @@ options."
(format #t "~~ loading `~a'...~%" file))))
(parameterize ((*document-reader* (make-reader reader-name))
- (*current-engine* engine)
- (*document-path* load-path)
- (*bib-path* bib-path)
- (*source-path* source-path)
- (*image-path* image-path)
- (*debug* debugging-level)
- (*warning* warning-level)
- (*verbose* verbosity-level))
+ (*current-engine* engine)
+ (*document-path* load-path)
+ (*bib-path* bib-path)
+ (*source-path* source-path)
+ (*image-path* image-path)
+ (*debug* debugging-level)
+ (*watched-symbols* watched-symbols)
+ (*warning* warning-level)
+ (*verbose* verbosity-level))
;; Load the user rc file (FIXME)
;;(load-rc)