Jose, JMarc, Georg,

Views about whether this should now go in?

rh

Richard Heck wrote:
Georg Baum wrote:
Jean-Marc Lasgouttes wrote:
Extended.lyx has a reference to it related to literate programming.
Are you sure it is not relevant anymore?
The problem is that it is horribly broken currently, and fixing it would be
a lot of work (see old discussions). I guess that writing a copier for
literate programming files would be easier than fixing originaldir, so I
think removing the flag is the right thing to do.
I've now added the default copier for the Program format with the HTML export fix.
Yes, I think Georg and I talked about this a while ago, when I was pursuing HTML export a quite different way. We agreed that this was broken. In fact, it could lead to data loss, especially if you combined originaldir with other flags. I got bit by this once.

Regarding the Extended Features manual, I've removed the originaldir reference. I've also added a cross-reference to the now more extensive discussion of converters in the Customization manual.

So, shall I commit? The now current patch is attached. Note that the bit about configure.py is not yet included in the patch, as I've got other stuff going on there at the moment.

Richard

--
==================================================================
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==================================================================
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto

Index: src/Converter.cpp
===================================================================
--- src/Converter.cpp	(revision 18803)
+++ src/Converter.cpp	(working copy)
@@ -119,7 +119,7 @@
 		     string const & c, string const & l)
 	: from(f), to(t), command(c), flags(l),
 	  From(0), To(0), latex(false), xml(false),
-	  original_dir(false), need_aux(false)
+	  need_aux(false)
 {}
 
 
@@ -134,8 +134,6 @@
 			latex = true;
 		else if (flag_name == "xml")
 			xml = true;
-		else if (flag_name == "originaldir")
-			original_dir = true;
 		else if (flag_name == "needaux")
 			need_aux = true;
 		else if (flag_name == "resultdir")
@@ -400,12 +398,10 @@
 			}
 
 			// FIXME UNICODE
-			string const infile2 = (conv.original_dir)
-				? infile.absFilename() : to_utf8(makeRelPath(from_utf8(infile.absFilename()),
-									     from_utf8(path)));
-			string const outfile2 = (conv.original_dir)
-				? outfile.absFilename() : to_utf8(makeRelPath(from_utf8(outfile.absFilename()),
-									      from_utf8(path)));
+			string const infile2 = 
+				to_utf8(makeRelPath(from_utf8(infile.absFilename()), from_utf8(path)));
+			string const outfile2 = 
+				to_utf8(makeRelPath(from_utf8(outfile.absFilename()), from_utf8(path)));
 
 			string command = conv.command;
 			command = subst(command, token_from, quoteName(infile2));
@@ -428,19 +424,19 @@
 				buffer->message(_("Executing command: ")
 				+ from_utf8(command));
 
-			Systemcall::Starttype const type = (dummy)
-				? Systemcall::DontWait : Systemcall::Wait;
 			Systemcall one;
 			int res;
-			if (conv.original_dir) {
-				FileName path(buffer->filePath());
-				support::Path p(path);
-				res = one.startscript(type,
+			if (dummy) {
+				res = one.startscript(Systemcall::DontWait,
 					to_filesystem8bit(from_utf8(command)));
-			} else
-				res = one.startscript(type,
-					to_filesystem8bit(from_utf8(command)));
+				// We're not waiting for the result, so we can't do anything
+				// else here.
+				return true; 
+			}
 
+			res = one.startscript(Systemcall::Wait,
+				to_filesystem8bit(from_utf8(command)));
+			
 			if (!real_outfile.empty()) {
 				Mover const & mover = getMover(conv.to);
 				if (!mover.rename(outfile, real_outfile))
Index: src/Converter.h
===================================================================
--- src/Converter.h	(revision 18803)
+++ src/Converter.h	(working copy)
@@ -55,8 +55,6 @@
 	bool latex;
 	/// The converter is xml
 	bool xml;
-	/// Do we need to run the converter in the original directory?
-	bool original_dir;
 	/// This converter needs the .aux files
 	bool need_aux;
 	/// If the converter put the result in a directory, then result_dir
Index: lib/doc/Extended.lyx
===================================================================
--- lib/doc/Extended.lyx	(revision 18803)
+++ lib/doc/Extended.lyx	(working copy)
@@ -1,5 +1,5 @@
-#LyX 1.5.0rc1 created this file. For more info see http://www.lyx.org/
-\lyxformat 271
+#LyX 1.5.0svn created this file. For more info see http://www.lyx.org/
+\lyxformat 274
 \begin_document
 \begin_header
 \textclass book
@@ -38,7 +38,6 @@
 \tracking_changes false
 \output_changes false
 \author "usti" 
-\author "Richard Heck" 
 \end_header
 
 \begin_body
@@ -17901,7 +17900,7 @@
 If the document is of any literate class LyX will then use the internal
  LyX to Noweb converter, followed by the Noweb to LaTeX converter
 \begin_inset Foot
-status open
+status collapsed
 
 \begin_layout Standard
 The converters are defined in the 
@@ -17925,6 +17924,17 @@
 \end_inset
 
  tab.
+ See section 
+\begin_inset LatexCommand ref
+reference "sub:converters"
+
+\end_inset
+
+ of the 
+\emph on
+Customization
+\emph default
+ manual for general information about converters.
 \end_layout
 
 \end_inset
@@ -17968,7 +17978,9 @@
 Noweb->Program
 \family default
  converter.
- Typically, this converter (like any other converter), has two parts:
+ This converter needs to be defined by the user and is not installed by
+ default, though the Program format is.
+ This converter (like any other converter) will have two parts:
 \end_layout
 
 \begin_layout Enumerate
@@ -18015,7 +18027,7 @@
 \begin_inset Quotes erd
 \end_inset
 
- (a program or script) with the name of the Noweb file (generally a file
+ (a program or script) with the name of the Noweb file (normally a file
  in the LyX temp directory).
  
 \end_layout
@@ -18059,7 +18071,7 @@
 
 
 \family typewriter
-originaldir,parselog=listerrors
+parselog=listerrors
 \family default
 
 \begin_inset Quotes erd
@@ -18105,6 +18117,74 @@
  program.
 \end_layout
 
+\begin_layout Standard
+The build will normally take place in LyX's temporary directory, so the
+ files produced by the conversion will be in that directory.
+ LyX will copy out what it regards as the `main' file, but the 
+\family typewriter
+Noweb->Program
+\family default
+ conversion may produce several files, and so most of these would then be
+ deleted when LyX was closed.
+ The present solution is to use a `copier',
+\begin_inset Foot
+status collapsed
+
+\begin_layout Standard
+See section 
+\begin_inset LatexCommand ref
+reference "sec:converters-etc"
+
+\end_inset
+
+ of the 
+\emph on
+Customization
+\emph default
+ manual for information on these.
+\end_layout
+
+\end_inset
+
+ in this case, the 
+\family typewriter
+ext_copy.py
+\family default
+ script in its default mode, so that the entire contents of the temporary
+ directory is copied.
+ More will get copied than is needed, to be sure, but nothing will be lost.
+ If, however, you know what extensions the generated files will have, this
+ can be improved by using the 
+\family typewriter
+-e
+\family default
+ option to 
+\family typewriter
+ext_copy
+\family default
+.
+ This option takes a comma-separated list of extensions to copy.
+ So, for example, if the conversion will generate only files with the extensions
+ 
+\family typewriter
+.c
+\family default
+ and 
+\family typewriter
+.h
+\family default
+, then the correct definition would be:
+\end_layout
+
+\begin_layout LyX-Code
+python -tt $$s/scripts/ext_copy.py -e c,h $$i $$o
+\end_layout
+
+\begin_layout Standard
+The result will be that only files with these two extensions will be copied
+ out.
+\end_layout
+
 \begin_layout Paragraph
 Build instructions in the document
 \end_layout

Reply via email to