> I agree that LyX should start, no matter if the .lst-files are empty and then 
> take care of them,

Jose and Jurgen,

I propose that we apply the attached patch to partially solve this
problem. It allows lyx to start even when textclasslist is empty. If
lyx is started like this, only reconfigure (and quit) is allowed. This
gives users a second chance to configure lyx if initial configuration
fails.

This does not change command line usages when configure.py fails with
a newly installed lyx. For example, 'lyx --export pdf blah.lyx'
previously fails to run at all, and will now fails to export.

I plan to add something like --defer_configure so that configure can
be automatically executed *after* lyx/GUI starts under windows. This
should wait until the output of configure.py is displayed in a dialog.
(Abdel, any interest to do this?)

OK to apply?

Cheers,
Bo
Index: src/TextClassList.cpp
===================================================================
--- src/TextClassList.cpp	(revision 19907)
+++ src/TextClassList.cpp	(working copy)
@@ -164,13 +164,15 @@
 	}
 	LYXERR(Debug::TCLASS) << "End of parsing of textclass.lst" << endl;
 
-	if (classlist_.empty()) {
+	// lyx will start with an empty classlist_, but only reconfigure is allowed
+	// in this case. This gives users a second chance to configure lyx if
+	// initial configuration fails. (c.f. bug 2829)
+	if (classlist_.empty())
 		lyxerr << "TextClassList::Read: no textclasses found!"
 		       << endl;
-		return false;
-	}
-	// Ok everything loaded ok, now sort the list.
-	sort(classlist_.begin(), classlist_.end(), less_textclass_avail_desc());
+	else 
+		// Ok everything loaded ok, now sort the list.
+		sort(classlist_.begin(), classlist_.end(), less_textclass_avail_desc());
 	return true;
 }
 
Index: src/TextClassList.h
===================================================================
--- src/TextClassList.h	(revision 19907)
+++ src/TextClassList.h	(working copy)
@@ -40,6 +40,8 @@
 	const_iterator begin() const { return classlist_.begin(); }
 	///
 	const_iterator end() const { return classlist_.end(); }
+	///
+	bool empty() const { return classlist_.empty(); }
 
 	/// Gets textclass number from name, -1 if textclass name does not exist
 	std::pair<bool, textclass_type> const
Index: src/LyXFunc.cpp
===================================================================
--- src/LyXFunc.cpp	(revision 19907)
+++ src/LyXFunc.cpp	(working copy)
@@ -407,6 +407,12 @@
 	//lyxerr << "LyXFunc::getStatus: cmd: " << cmd << endl;
 	FuncStatus flag;
 
+	// if textclasslist is empty, the only allowed operation is reconfigure (c.f. bug 2829)
+	if (textclasslist.empty() && cmd.action != LFUN_RECONFIGURE && cmd.action != LFUN_LYX_QUIT) {
+		flag.enabled(false);
+		return flag;
+	}
+
 	Cursor & cur = view()->cursor();
 
 	/* In LyX/Mac, when a dialog is open, the menus of the

Reply via email to