*Amir Karger writes:
 | My suggestion was copying the tex file into the current directory
 | where lyx is creating stuff (either the temporary directory or
 | `pwd` if you've got use_tempdir set to false, I guess), then
 | deleting the .tex file when you close LyX. This doesn't use any
 | "new technologies", which I guess reading from stdin would require.
 | On the other hand, it requires bookkeeping, and creates the
 | possibility of some extremely angry bug reports.

Anyway I think that making LyX able to read from stdin is the wrong
solution (I am not even sure that it would work). This kind of problem
should be solved with something similar to popen(3), will most likely
be most elegantly solved from the script interpreter.

How hard would it be to make reLyX output the generated file to
stdout? (as an option)

Then we could do something like this:

Not using popen(3):

make reLyX have an option -o <outputfile>

then when we call reLyX from LyX we could specify the lyx tmp
directory.

Buffer * ImportLaTeX::run()
{
        // run reLyX
+        LString outfile = tmp_dir + ChangeExtension(OnlyFile(file));
-        LString tmp = lyxrc->relyx_command + " -f " + file;
+        LString tmp = lyxrc->relyx_command + " -f " + file + " -o " + outfile
        Systemcalls one;
        Buffer * buf = 0;
        int result= one.Startscript(Systemcalls::System, tmp);
        if (result==0) {
-                LString filename = ChangeExtension(file, ".lyx", false);
                // File was generated without problems. Load it.
-                buf = bufferlist.loadLyXFile(filename);
+                buf = bufferlist.loadLyXFile(outfile);
        }
        return buf;
}

And the user would have to use save as to put it somewhere sensible.

        Lgb

Reply via email to