Here is my current version:

;;;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 (eval-string (d-DirectiveGet-movementcontrol-data tag))))
  (set! thetitle (d-GetUserInputWithSnippets (_ "Start Bookpart")(_
"Give chapter title::") thetitle))
  (if thetitle
  (begin
    (set! thetitle (car thetitle))
    (if (zero? (string-length thetitle)) ;; if empty title string =>
delete the directive
    (begin
      (disp (string-append "Deleting directive " tag "."))
      (d-DirectiveDelete-movementcontrol tag)
      (d-SetSaved #f)
    )
    (begin
      (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 = \\markup { "
thetitle " }\n  }\n"))
      (d-SetSaved #f)
    )
  ))
    (d-InfoDialog "Cancelled")
  )
)

I have inserted (eval-string ...) at the readout of the data field, but
it throws an error. Thank you for your offer to investigate.

Andreas


Am 14.05.2016 um 15:49 schrieb Richard Shann:
> On Fri, 2016-05-13 at 22:16 +0200, Andreas Schneider wrote:
>> I have discovered a little issue in my script: backslashes have to be
>> un-escaped when loading a title from the data field (otherwise the
>> number of backslashes is doubled every time you edit the title). How do
>> I do that?
> 
> it sounds like you didn't need to use scheme-escape. (You would
> (eval-string thedatafield) to un-escape it, but there would be no
> point). The problem I was thinking of arises with accented characters on
> windows (I think).
> If you send your code I'll experiment.
> Sorry if I set you on a wild goose chase mentioning scheme-escape.
> 
> Richard


_______________________________________________
Denemo-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/denemo-devel

Reply via email to