+void LyX::execBatchCommands()
+{
+ // Execute batch commands if available
+ if (batch_command.empty())
+ return;
+
+ lyxerr[Debug::INIT] << "About to handle -x '"
+ << batch_command << '\'' << endl;
+
+ pimpl_->lyxfunc_.dispatch(lyxaction.lookupFunc(batch_command));
+}
+
+
+void LyX::restoreGuiSession(vector<FileName> const & files)
+{
+ LyXView * view = newLyXView();
+
+ // load files
+ for_each(files.begin(), files.end(),
+ bind(&LyXView::loadLyXFile, view, _1, true));
+
+ // if a file is specified, I assume that user wants to edit *that* file
+ if (files.empty() && lyxrc.load_session) {
+ vector<FileName> const & lastopened = pimpl_->session_->lastOpened().getfiles();
+ // do not add to the lastfile list since these files are restored from
+ // last seesion, and should be already there (regular files), or should
+ // not be added at all (help files).
+ for_each(lastopened.begin(), lastopened.end(),
+ bind(&LyXView::loadLyXFile, view, _1, false));
+ }
+ // clear this list to save a few bytes of RAM
+ pimpl_->session_->lastOpened().clear();
+}
+
+
+LyXView * LyX::newLyXView()