buffer-export is proposed as a default binding in the preferences so now it does
what a user expects when binding it to a key.
- string format = to_utf8(arg);
+ string format =
+ arg.empty() ? params().getDefaultOutputFormat() : to_utf8(arg);
size_t pos = format.find(' ');
if (pos != string::npos)
format = format.substr(0, pos);
size_t pos = format.find(' ');
if (pos != string::npos)
format = format.substr(0, pos);
break;
case LFUN_BUFFER_EXPORT: {
break;
case LFUN_BUFFER_EXPORT: {
- ExportStatus const status = doExport(argument, false);
+ string const format =
+ argument.empty() ? params().getDefaultOutputFormat() : argument;
+ ExportStatus const status = doExport(format, false);
dr.setError(status != ExportSuccess);
if (status != ExportSuccess)
dr.setMessage(bformat(_("Error exporting to format: %1$s."),
dr.setError(status != ExportSuccess);
if (status != ExportSuccess)
dr.setMessage(bformat(_("Error exporting to format: %1$s."),
/*!
* \var lyx::FuncCode lyx::LFUN_BUFFER_EXPORT
* \li Action: Exports the current buffer (document) to the given format.
/*!
* \var lyx::FuncCode lyx::LFUN_BUFFER_EXPORT
* \li Action: Exports the current buffer (document) to the given format.
- * \li Syntax: buffer-export <FORMAT> [<DEST>]
+ * \li Syntax: buffer-export [<FORMAT>] [<DEST>]
* \li Params: <FORMAT> is either "custom" or one of the formats which you
can find in Tools->Preferences->File formats->Format.
Usual format you will enter is "pdf2" (pdflatex),
* \li Params: <FORMAT> is either "custom" or one of the formats which you
can find in Tools->Preferences->File formats->Format.
Usual format you will enter is "pdf2" (pdflatex),
In case of "custom" you will be asked for a format you
want to start from and for the command that you want to
apply to this format. Internally the control is then passed
In case of "custom" you will be asked for a format you
want to start from and for the command that you want to
apply to this format. Internally the control is then passed
- to #LFUN_BUFFER_EXPORT_CUSTOM.
+ to #LFUN_BUFFER_EXPORT_CUSTOM.\n
+ If absent, the default output format of the document is
+ used.
<DEST> If present, this argument provides the export destination
filename. Its containing folder will also be the destination
folder, where all the needed external files will be copied.
<DEST> If present, this argument provides the export destination
filename. Its containing folder will also be the destination
folder, where all the needed external files will be copied.
else
target_dir = doc_buffer->fileName().onlyPath();
else
target_dir = doc_buffer->fileName().onlyPath();
+ string const format = argument.empty() ?
+ doc_buffer->params().getDefaultOutputFormat() : argument;
+
if ((dest.empty() && doc_buffer->isUnnamed())
|| !target_dir.isDirWritable()) {
if ((dest.empty() && doc_buffer->isUnnamed())
|| !target_dir.isDirWritable()) {
- exportBufferAs(*doc_buffer, cmd.argument());
+ exportBufferAs(*doc_buffer, from_utf8(format));
break;
}
/* TODO/Review: Is it a problem to also export the children?
See the update_unincluded flag */
break;
}
/* TODO/Review: Is it a problem to also export the children?
See the update_unincluded flag */
- d.asyncBufferProcessing(argument,
+ d.asyncBufferProcessing(format,
doc_buffer,
_("Exporting ..."),
&GuiViewPrivate::exportAndDestroy,
doc_buffer,
_("Exporting ..."),
&GuiViewPrivate::exportAndDestroy,