diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2017-01-30 08:25:42 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2017-01-30 08:25:42 +0200 |
commit | 9a286d24b51ab106db6fe389767d79d3f5dea159 (patch) | |
tree | edcf4a61cc076a57bc35a84703abe3d0344db95e | |
parent | 7e8606f27404fe8da3051f90eadef4076f2f7a08 (diff) | |
download | idest-9a286d24b51ab106db6fe389767d79d3f5dea159.tar.gz idest-9a286d24b51ab106db6fe389767d79d3f5dea159.tar.bz2 |
Minor scheme fixes.
* scheme/dry-run.scm: Mention a bug in Guile 2.0.9 that causes
%load-hook to be called twice.
* scheme/idest/list-modules.scm: Improve error handling.
* tests/script05.at: Remove the "loading" diagnostics from the
output.
* tests/script08.at: Likewise.
-rw-r--r-- | scheme/dry-run.scm | 1 | ||||
-rw-r--r-- | scheme/idest/list-modules.scm | 42 | ||||
-rw-r--r-- | tests/script05.at | 3 | ||||
-rw-r--r-- | tests/script08.at | 5 |
4 files changed, 30 insertions, 21 deletions
diff --git a/scheme/dry-run.scm b/scheme/dry-run.scm index 2cabc7d..5fcc0ad 100644 --- a/scheme/dry-run.scm +++ b/scheme/dry-run.scm @@ -27,12 +27,13 @@ Normally you don't need to run this program manually. Instead please use: idest --dry-run [SCRIPTING OPTIONS]~%" progname) (exit 1)) (else (let ((file-name (list-ref cmd 1))) (set-program-arguments (cons (car cmd) (list-tail cmd 2))) + ; Note: a bug in Guile 2.0.9 causes %load-hook to be called twice (primitive-load-path file-name) (cond (idest-readonly (format (current-error-port) "~A: info: ~A does not modify frames~%" progname file-name)) ((catch #t diff --git a/scheme/idest/list-modules.scm b/scheme/idest/list-modules.scm index 880dbf8..facc54b 100644 --- a/scheme/idest/list-modules.scm +++ b/scheme/idest/list-modules.scm @@ -96,33 +96,45 @@ ;; if it happens to be a valid idest format module. ;; Take care not to bail out on errors. Disable %load-hook as it migh ;; clobber the output. (set! %load-hook #f) (for-each (lambda (candidate) - (catch 'misc-error + (catch #t (lambda () (let ((mod (resolve-module (list 'idest type (string->symbol (car candidate)))))) ; Check if it defines idest-main - (module-ref mod 'idest-main) - ; Print module name - (display (car candidate)) - ; Its directory, if required - (if print-dir - (format #t " (~A)" (cdr candidate))) - ; A colon, and description (if any) - (format #t ": ~A~%" - (catch #t - (lambda () - (module-ref mod 'description)) - (lambda (key . args) - "no description"))))) + (catch #t + (lambda () + (module-ref mod 'idest-main) + ; Print module name + (display (car candidate)) + ; Its directory, if required + (if print-dir + (format #t " (~A)" (cdr candidate))) + ; A colon, and description (if any) + (format #t ": ~A~%" + (catch #t + (lambda () + (module-ref mod 'description)) + (lambda (key . args) + "no description")))) + (lambda (key . args) + #f)))) + (lambda (key . args) - #f))) + (with-output-to-port + (current-error-port) + (lambda () + (format #t "~A: " progname) + (apply format #t (list-ref args 1) (list-ref args 2)) + (format #t ", while loading ~A/~A.scm" (cdr candidate) + (car candidate)) + (newline)))))) candidates) (newline) (set! %load-hook saved-load-hook)))) diff --git a/tests/script05.at b/tests/script05.at index 89ebfb1..450c1c9 100644 --- a/tests/script05.at +++ b/tests/script05.at @@ -30,19 +30,18 @@ AT_DATA([delpic.scm],[ AT_CHECK([ WITH_GUILE([ genfile -f file -p $abs_srcdir/id3v2 10k cp file file.bak echo removing APIC frames idest -N -p $abs_top_srcdir/scheme -n -S delpic.scm file | - sed "s|$abs_top_srcdir|abs_top_srcdir|"]) + sed -e '/^dry-run: loading/d']) echo cmp cmp file.bak file ], [0], [removing APIC frames -dry-run: loading ./delpic.scm ... File file (TIT2 (descr . Title/songname/content description) (text . File)) (TALB (descr . Album/movie/show title) (text . Idest Test Suite)) (TRCK (descr . Track number/position in set) (text . 1)) (COMM (descr . Comments) (text . Sample ID3 headers for idest testsuite) (lang . eng) (condesc . )) (TPE1 (descr . Lead performer(s)/soloist(s)) (text . Sergey Poznyakoff)) diff --git a/tests/script08.at b/tests/script08.at index 8ff78f7..e3e996e 100644 --- a/tests/script08.at +++ b/tests/script08.at @@ -33,21 +33,18 @@ genfile -f file -p $abs_srcdir/id3v2 10k cp file file.bak $INSTALL_PROG -d scheme/idest/batch $INSTALL_PROG delpic.scm scheme/idest/batch echo dry run subdir=`pwd`/scheme idest -N -p $abs_top_srcdir/scheme:$subdir -n --batch delpic file | - sed "s|$subdir|subdir|;s|$abs_top_srcdir|abs_top_srcdir|"]) + sed -e '/^dry-run: loading/d']) echo cmp cmp file.bak file ], [0], [dry run -dry-run: loading abs_top_srcdir/scheme/batch.scm ... -dry-run: loading abs_top_srcdir/scheme/idest/load-module.scm ... -dry-run: loading subdir/idest/batch/delpic.scm ... File file (TIT2 (descr . Title/songname/content description) (text . File)) (TALB (descr . Album/movie/show title) (text . Idest Test Suite)) (TRCK (descr . Track number/position in set) (text . 1)) (COMM (descr . Comments) (text . Sample ID3 headers for idest testsuite) (lang . eng) (condesc . )) (TPE1 (descr . Lead performer(s)/soloist(s)) (text . Sergey Poznyakoff)) |