On Sun, 2016-05-08 at 12:06 +0200, Andreas Schneider wrote:
> Thank you! I have now come to the following scripts which work as desired:
>
> ;;;StartBookpart
> (let ((tag "StartBookpart")(thetitle ""))
> (d-DirectivePut-movementcontrol-override tag (logior
> DENEMO_OVERRIDE_GRAPHIC DENEMO_OVERRIDE_TAGEDIT))
> (disp "checking previous bookpart title ...")
> (if (d-Directive-movementcontrol? tag)
> (set! thetitle (d-DirectiveGet-movementcontrol-data tag)))
> (set! thetitle (d-GetUserInputWithSnippets (_ "Start Bookpart")(_
> "Give chapter title::") thetitle))
> (if thetitle
> (begin
> (set! thetitle (car thetitle))
> (disp thetitle)
> (d-DirectivePut-movementcontrol-data tag (scheme-escape thetitle))
> (d-DirectivePut-movementcontrol-prefix tag (string-append "
> \\bookpart { %start of bookpart\n \\header {\n title = { " thetitle
> " }\n }\n"))
> (d-SetSaved #f)
> )
> (d-InfoDialog "Cancelled")
here you could delete the StartBookpart, or better after
(if thetitle
further test for (zero? (string-length thetitle))
and delete it if the title is an empty string rather than creating it.
> )
> )
>
> ;;;EndBookpart
> (let ((tag "EndBookpart"))
here, you could remove the EndBookpart if it is already present
making it a toggle:
(if (d-Directive-movementcontrol? tag)
(d-DirectiveDelete-movemencontrol tag)
(begin
;; or create it if it doesn't exist
> (d-DirectivePut-movementcontrol-override tag (logior
> DENEMO_OVERRIDE_GRAPHIC DENEMO_OVERRIDE_TAGEDIT))
> (d-DirectivePut-movementcontrol-postfix tag "\n} %end of bookpart\n")
> (d-SetSaved #f)
> )
with all these refinements you can give feedback about what you have
done (deleting, setting) via d-InfoDialog or the timed notice routine
that doesn't require the user to respond.
Richard
_______________________________________________
Denemo-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/denemo-devel