fangle-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fangle-dev] Exporting fangle chunks from TeXmacs


From: Michael Lachmann
Subject: [Fangle-dev] Exporting fangle chunks from TeXmacs
Date: Tue, 2 Oct 2012 13:53:51 +0200

I'm working with fangle in TeXmacs, and I'm trying to make it easier
to extract chunks...

currently I use the following command:
--
(define (fangle-extract part)
  (with file (url->unix (url-temp))
    (with file2 (if extract-remote (url->unix (url-temp)) part)
      (export-buffer file)
      (with res  (system
                  (string-append "fangle -R " part " " file " >" file2
                                 " 2>/tmp/fang.err")
                  )
        (with res2  (if (and extract-remote (= res 0))
                        (system (string-append
                                 "scp " file2 " " rem-path "/" part ) )
                         0 )
          (delete-file file)
          (if extract-remote (delete-file file2) )
          (if (and extract-remote (= res 0)) (list res res2)
              (if (= res 0) "ok" (eval-system "cat /tmp/fang.err") ))
    ) ) ) ) )
-- (this is fairly bad scheme code, I'm still learning -but it works for me...)
and then, I define
(define extract-remote #t) or (define extract-remote #f)
depending on if I want to copy the result to a remote location,
and
(define rem-path "bionc02:projects/Neandertal/resampling")
For the remote path.
Then I insert a scheme session in the file, and issue the command:

Scheme] (fangle-extract "name-of-chunk.C")

Which will either extract the chunk to TeXmacs current directory, or
to a remote directory (I work a lot on remote servers)

What I'd like to do is for the chunk name to be determined automatically.
What I thought is that after or in a chunk, that chunk will be
exported, and that one
can somehow define a chunk to be the "main" chunk, and there will be a
command to export that.

Miguel from the TeXmacs-dev mailing list said:

> However, you have the choice of redefining your nf-chunk macro to set an
> environment variable (say, "current-nf-chunk" to the value you want, then
> read that variable at any point in your document to decide where you are.

I'm not totally sure how to do that... do I just add
<assign|current-nf-chunk|name> inside nf-chunk, or do I need to do
other things?

I also thought about some system where you can unfold nf-ref to what
they represent, or open all such references in a chunk. I think it
should be fairly easy to do this in scheme, so we'd have some version
of fangle in scheme.
One question that I had was that if you wouldn't use scheme, but the
original fangle, it would be nice if I could ask fangle to extract
just the 3rd part of a multipart chunk - because when I am near such a
part, I'd want to just extract it, and not the whole document.

Michael



reply via email to

[Prev in Thread] Current Thread [Next in Thread]