[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Texmacs-dev] Problem with invoking unix command from TeXmacs experi
From: |
Joris van der Hoeven |
Subject: |
Re: [Texmacs-dev] Problem with invoking unix command from TeXmacs experimental plugin |
Date: |
Fri, 1 Jun 2007 12:51:40 +0200 |
User-agent: |
Mutt/1.5.9i |
On Fri, Jun 01, 2007 at 11:22:04AM +0100, Krzysztof Retel wrote:
> Hello Developers,
>
> I'm writing a plugin in which I invoke external unix command from
> TeXmacs. In the plugin I use bits of Scheme source code (written
> originally by Henri and/or Chad Brown):
>
> ;; UNIX commands. To invoke a command from TeXmacs.
> (begin
> (use-modules (ice-9 popen))
> (define (unix-command cmd)
> (let* ((p (open-input-pipe cmd))
> (out (read-delimited "" p)))
> (if (eof-object? out) "" (string-split out #\newline)))))
>
> I use it like that:
> (unix-command "dot -Tps temp.mathlang.dra2dg.dot -o
> temp.mathlang.dra2dg.ps")
> (unix-command "gv temp.mathlang.dra2dg.ps")
>
> However, I can't do much of the viewed file with gv, e.g. I can't resize
> the gv window, or even go back and work within TeXmacs, unless I close
> the window.
> I guess the problem is with the opened-pipe ((open-input-pipe cmd)) and
> (eof-object? out). I tried to close the pipe with command (close-pipe)
> but it didn't work.
>
> Hope I was clear and somebody could help me with that.
>From within guile, you may use the "system" command.
TeXmacs also provides commands "eval-system" and "var-eval-sys"
in order to retrieve the output.
Best wishes, Joris