diff --git a/collects/scribblings/slideshow/guide.scrbl b/collects/scribblings/slideshow/guide.scrbl index c185532a1c..f4d5ed3f66 100644 --- a/collects/scribblings/slideshow/guide.scrbl +++ b/collects/scribblings/slideshow/guide.scrbl @@ -219,10 +219,11 @@ displays). @defmodule[slideshow/start] -The @exec{slideshow} executable invokes the +The @exec{slideshow} executable instantiates the @racketmodname[slideshow/start] module, which inspects the command line as reported by @racket[current-command-line-arguments] to get -another module to provide the slide content. It also initializes +another module to @racket[require] for the slide content.The @racketmodname[slideshow/start] +module also initializes variables like @racket[printing?] and @racket[condense?] based on flags supplied on the command line. @@ -233,7 +234,14 @@ command runs the slides. -The @exec{Slideshow} executable accepts a number of command-line +If the module given to @exec{slideshow} has a @racketidfont{slideshow} +submodule, then @racketmodname[slideshow/start] @racket[require]s the +@racketidfont{slideshow} submodule after @racket[require]ing the +module. If the module has no @racketidfont{slideshow} but has a +@racketidfont{main} submodule, then the @racketidfont{main} submodule +is @racket[require]d. + +The @exec{slideshow} executable accepts a number of command-line flags. Use the @DFlag{help} flag to obtain a list of other flags. diff --git a/collects/slideshow/cmdline.rkt b/collects/slideshow/cmdline.rkt index 976e231ef9..30f849e10c 100644 --- a/collects/slideshow/cmdline.rkt +++ b/collects/slideshow/cmdline.rkt @@ -4,7 +4,7 @@ mzlib/file mzlib/contract mred - mzlib/cmdline + racket/cmdline texpict/mrpict texpict/utils mzlib/math @@ -57,10 +57,9 @@ (define file-to-load (command-line - "slideshow" - (current-command-line-arguments) - [once-each - (("-M" "--monitor") monitor "display to (count from 0)" + #:program "slideshow" + #:once-each + (("-M" "--monitor") monitor "display to (count from 0)" (let ([n (string->number monitor)]) (unless (and n (exact-nonnegative-integer? n)) (die 'slideshow "argument to -M is not an exact non-negative integer: ~a" monitor)) @@ -102,16 +101,6 @@ (("-m" "--no-smoothing") "disable anti-aliased drawing (usually faster)" (set! smoothing? #f)) - ;; Disable --minutes, because it's not used - #; - (("-m" "--minutes") min "set talk duration in minutes" - (let ([n (string->number min)]) - (unless (and n - (integer? n) - (exact? n) - (positive? n)) - (die 'slideshow "argument to -m is not a positive exact integer: ~a" min)) - (set! talk-duration-minutes n))) (("-i" "--immediate") "no transitions" (set! use-transitions? #f)) (("--trust") "allow slide program to write files and make network connections" @@ -131,20 +120,12 @@ (("--comment-on-slide") "display commentary on slide" (set! commentary? #t) (set! commentary-on-slide? #t)) - (("--time") "time seconds per slide" (set! print-slide-seconds? #t))] - [args slide-module-file - (cond - [(null? slide-module-file) #f] - [(null? (cdr slide-module-file)) - (let ([candidate (car slide-module-file)]) - (unless (file-exists? candidate) - (die 'slideshow "expected a filename on the commandline, given: ~a" - candidate)) - candidate)] - [else (die 'slideshow - "expects at most one module file, given ~a: ~s" - (length slide-module-file) - slide-module-file)])])) + (("--time") "time seconds per slide" (set! print-slide-seconds? #t)) + #:ps + "After requiring , if a `slideshow' submodule exists," + " it is required. Otherwise, if a `main' submodule exists, it is required." + #:args ([slide-module-file #f]) + slide-module-file)) (define printing? (and printing-mode #t)) diff --git a/collects/slideshow/start.rkt b/collects/slideshow/start.rkt index 250e69653b..8bb33e1aa6 100644 --- a/collects/slideshow/start.rkt +++ b/collects/slideshow/start.rkt @@ -64,7 +64,15 @@ (lambda (who where-name where-port-num mode) (error 'slideshow "slide program attempted to make a network connection"))))) - (dynamic-require (path->complete-path content) #f)) + (define content-path (path->complete-path content)) + (dynamic-require content-path #f) + (ormap (lambda (sm) + (define submod-path `(submod ,content-path ,sm)) + (and (module-declared? submod-path #t) + (begin + (dynamic-require submod-path #f) + #t))) + '(slideshow main))) (when (file-to-load) (load-content (string->path (file-to-load)))) diff --git a/doc/release-notes/racket/HISTORY.txt b/doc/release-notes/racket/HISTORY.txt index 3ec471fc65..fa78b8d820 100644 --- a/doc/release-notes/racket/HISTORY.txt +++ b/doc/release-notes/racket/HISTORY.txt @@ -5,6 +5,7 @@ Added raise-argument-error, raise-result-error, racket/contract: added procedure-arity-includes/c racket/sandbox: added sandbox-propagate-exceptions racket/cmdline: add #:ps for command-line +slideshow/start: run a `slideshow' or `main' submodule, if any Changed impersonate-struct so that accessor impersonation requires work only if the field is accessible via the current impersonator or a mutator for the same field is also impersonated