>>>>> "Jean-Marc" == Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:

Jean-Marc> This is a 1.3.x patch, which I intend to port later.

OK, since nobody with a modern TeX seems to be interested in trying
out the patch on 1.3.x, here is an 1.4.0cvs version. Could somebody
test it? I thought it was very important for Windows and Mac? 

JMarc

Index: lib/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v
retrieving revision 1.677
diff -u -p -r1.677 ChangeLog
--- lib/ChangeLog	25 Feb 2005 11:55:29 -0000	1.677
+++ lib/ChangeLog	14 Mar 2005 11:43:35 -0000
@@ -1,3 +1,8 @@
+2005-03-10  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* configure.m4: add a check to see whether TeX allows spaces in
+	file names. Probably requires web2c 7.5.3 to be supported.
+
 2005-02-20  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* layouts/stdlayouts.inc: change labelstring to "Senseless!"
Index: lib/configure.m4
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/configure.m4,v
retrieving revision 1.92
diff -u -p -r1.92 configure.m4
--- lib/configure.m4	17 Feb 2005 13:21:08 -0000	1.92
+++ lib/configure.m4	14 Mar 2005 11:43:35 -0000
@@ -528,6 +528,26 @@ echo "s/@chk_linuxdoc@/$chk_linuxdoc/g" 
 echo "s/@chk_docbook@/$chk_docbook/g" >> chkconfig.sed
 sed -f chkconfig.sed "${srcdir}"/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
 
+### Let's check whether spaces are allowed in TeX file names
+MSG_CHECKING(whether TeX allows spaces in file names)
+if test ${lyx_check_config} = no ; then
+  tex_allows_spaces=false
+else
+  fname="a b"
+  rm -f "$fname".tex
+  echo "\\message{working!^^J}" >"$fname".tex
+changequote([,])dnl
+  if [eval] ${LATEX} "$fname" </dev/null | grep 'working!' ; then
+    MSG_RESULT(yes)
+    tex_allows_spaces=true
+  else
+    MSG_RESULT(no)
+    tex_allows_spaces=false
+  fi
+  rm -r "$fname".*
+changequote(,)dnl  
+fi
+
 echo "creating $outfile"
 cat >$outfile <<EOF
 # This file has been automatically generated by LyX' lib/configure
@@ -660,6 +680,7 @@ cat >>$outfile <<EOF
 
 $rc_entries
 \\font_encoding "$chk_fontenc"
+\\tex_allows_spaces $tex_allows_spaces
 EOF
 
 if [ "x$use_cygwin_path_fix" != "x" ]
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.2138
diff -u -p -r1.2138 ChangeLog
--- src/ChangeLog	11 Mar 2005 14:20:58 -0000	1.2138
+++ src/ChangeLog	14 Mar 2005 11:43:36 -0000
@@ -1,3 +1,14 @@
+2005-03-14  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* lyxrc.C (setDefaults, read, output, getDescription): add support
+	for tex_allows_spaces.
+
+	* exporter.C (Export): allows files in directory containing spaces
+	if tex_allows_spaces is true.
+
+	* buffer.C (makeLaTeXFile): if the document path contains spaces,
+	output it in double quotes.
+
 2005-03-11  Martin Vermeer  <[EMAIL PROTECTED]>
 
 	* text2.C: fixed the fix, extended to other case.
Index: src/buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.612
diff -u -p -r1.612 buffer.C
--- src/buffer.C	8 Feb 2005 13:17:57 -0000	1.612
+++ src/buffer.C	14 Mar 2005 11:43:36 -0000
@@ -857,6 +857,8 @@ void Buffer::makeLaTeXFile(ostream & os,
 		if (!original_path.empty()) {
 			string inputpath = os::external_path(original_path);
 			subst(inputpath, "~", "\\string~");
+			if (inputpath.find(' ') != string::npos)
+				inputpath = '"' + inputpath + '"';
 			os << "\\makeatletter\n"
 			    << "[EMAIL PROTECTED]"
 			    << inputpath << "/}}\n"
Index: src/exporter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/exporter.C,v
retrieving revision 1.58
diff -u -p -r1.58 exporter.C
--- src/exporter.C	31 Jan 2005 10:42:18 -0000	1.58
+++ src/exporter.C	14 Mar 2005 11:43:36 -0000
@@ -185,7 +185,8 @@ bool Exporter::Export(Buffer * buffer, s
 	else if (backend_format == format) {
 		runparams.nice = true;
 		buffer->makeLaTeXFile(filename, string(), runparams);
-	} else if (contains(buffer->filePath(), ' ')) {
+	} else if (!lyxrc.tex_allows_spaces 
+		   && contains(buffer->filePath(), ' ')) {
 		Alert::error(_("File name error"),
 			   _("The directory path to the document cannot contain spaces."));
 		return false;
Index: src/lyxrc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrc.C,v
retrieving revision 1.187
diff -u -p -r1.187 lyxrc.C
--- src/lyxrc.C	15 Feb 2005 13:45:40 -0000	1.187
+++ src/lyxrc.C	14 Mar 2005 11:43:36 -0000
@@ -155,6 +155,7 @@ keyword_item lyxrcTags[] = {
 	{ "\\spell_command", LyXRC::RC_SPELL_COMMAND },
 	{ "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
 	{ "\\template_path", LyXRC::RC_TEMPLATEPATH },
+	{ "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
 	{ "\\ui_file", LyXRC::RC_UIFILE },
 	{ "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
 	{ "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
@@ -268,6 +269,7 @@ void LyXRC::setDefaults() {
 	default_language = "english";
 	show_banner = true;
 	cygwin_path_fix = false;
+	tex_allows_spaces = false;
 	date_insert_format = "%A, %e %B %Y";
 	cursor_follows_scrollbar = false;
 	dialogs_iconify_with_main = false;
@@ -384,18 +386,24 @@ int LyXRC::read(LyXLex & lexrc)
 			}
 			break;
 
-		case RC_KBMAP:
-			if (lexrc.next()) {
-				use_kbmap = lexrc.getBool();
-			}
-			break;
-
 		case RC_CYGWIN_PATH_FIX:
 			if (lexrc.next()) {
 				cygwin_path_fix = lexrc.getBool();
  			}
  			break;
 
+		case RC_TEX_ALLOWS_SPACES:
+			if (lexrc.next()) {
+				tex_allows_spaces = lexrc.getBool();
+  			}
+ 			break;
+ 
+		case RC_KBMAP:
+			if (lexrc.next()) {
+				use_kbmap = lexrc.getBool();
+			}
+			break;
+
 		case RC_KBMAP_PRIMARY:
 			if (lexrc.next()) {
 				string const kmap(lexrc.getString());
@@ -1312,18 +1320,22 @@ void LyXRC::write(ostream & os, bool ign
 		    index_command != system_lyxrc.index_command) {
 			os << "\\index_command \"" << index_command << "\"\n";
 		}
-	case RC_KBMAP:
-		if (ignore_system_lyxrc ||
-		    use_kbmap != system_lyxrc.use_kbmap) {
-			os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
-		}
-
 	case RC_CYGWIN_PATH_FIX:
 		if (ignore_system_lyxrc ||
 		    cygwin_path_fix != system_lyxrc.cygwin_path_fix) {
 			os << "\\cygwin_path_fix_needed "
 			   << convert<string>(cygwin_path_fix) << '\n';
 		}
+	case RC_TEX_ALLOWS_SPACES:
+		if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
+			os << "\\tex_allows_spaces "
+			   << convert<string>(tex_allows_spaces) << '\n';
+    		}
+	case RC_KBMAP:
+		if (ignore_system_lyxrc ||
+		    use_kbmap != system_lyxrc.use_kbmap) {
+			os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
+		}
 	case RC_KBMAP_PRIMARY:
 		if (ignore_system_lyxrc ||
 		    primary_kbmap != system_lyxrc.primary_kbmap) {
@@ -2369,6 +2381,9 @@ string const LyXRC::getDescription(LyXRC
 
 	case RC_TEMPLATEPATH:
 		str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
+		break;
+
+	case RC_TEX_ALLOWS_SPACES:
 		break;
 
 	case RC_UIFILE:
Index: src/lyxrc.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrc.h,v
retrieving revision 1.92
diff -u -p -r1.92 lyxrc.h
--- src/lyxrc.h	16 Jan 2005 21:01:38 -0000	1.92
+++ src/lyxrc.h	14 Mar 2005 11:43:36 -0000
@@ -123,6 +123,7 @@ public:
 		RC_SPELL_COMMAND,
 		RC_TEMPDIRPATH,
 		RC_TEMPLATEPATH,
+		RC_TEX_ALLOWS_SPACES,
 		RC_UIFILE,
 		RC_USER_EMAIL,
 		RC_USER_NAME,
@@ -377,6 +378,8 @@ public:
 	std::string user_email;
 	///
 	bool cygwin_path_fix;
+	/// True if the TeX engine can handle file names containing spaces
+	bool tex_allows_spaces;
 	/** Prepend paths to the PATH environment variable.
 	 *  The string is input, stored and output in native format.
 	 */

Reply via email to