mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Add \save_transient_properties parameter (#9841)
Increment LyX format to 504. With this new parameter, the user can indicate that some other parameters that are frequently switched must not be recorded in the file (as if they were a setting specific to the user or transient, rather than a document setting). This will play nicer with version control systems. See the discussion, e.g.: http://thread.gmane.org/gmane.editors.lyx.devel/157824/focus=157993 (third solution mentioned) TODO: * The interface remains to be set up. We cannot change this setting from LyX for now. * If save_transient_properties is false, we should read the user setting as a per-user-per-document (session) setting (e.g. like the cursor position). * Once the above is done, we can treat \justification the same way (but it would be even better if \justification was moved to lyxrc).
This commit is contained in:
parent
f475795b92
commit
5c2d049996
@ -11,6 +11,13 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
|
|||||||
|
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
2015-12-20 Guillaume Munch <gm@lyx.org>
|
||||||
|
* Format incremented to 504
|
||||||
|
New parameter "\save_transient_properties". When set to false, various
|
||||||
|
settings are no longer written to the file (only with a default
|
||||||
|
value). These include for now \tracking_changes and \output_changes.
|
||||||
|
Bug 9841.
|
||||||
|
|
||||||
2015-11-24 Uwe Stöhr <uwestoehr@web.de>
|
2015-11-24 Uwe Stöhr <uwestoehr@web.de>
|
||||||
* Format incremented to 503
|
* Format incremented to 503
|
||||||
No new parameters.
|
No new parameters.
|
||||||
|
@ -80,12 +80,13 @@ format_relation = [("0_06", [200], minor_versions("0.6" , 4)),
|
|||||||
("1_1_6_3", [218], ["1.1", "1.1.6.3","1.1.6.4"]),
|
("1_1_6_3", [218], ["1.1", "1.1.6.3","1.1.6.4"]),
|
||||||
("1_2", [220], minor_versions("1.2" , 4)),
|
("1_2", [220], minor_versions("1.2" , 4)),
|
||||||
("1_3", [221], minor_versions("1.3" , 7)),
|
("1_3", [221], minor_versions("1.3" , 7)),
|
||||||
|
# Note that range(i,j) is up to j *excluded*.
|
||||||
("1_4", list(range(222,246)), minor_versions("1.4" , 5)),
|
("1_4", list(range(222,246)), minor_versions("1.4" , 5)),
|
||||||
("1_5", list(range(246,277)), minor_versions("1.5" , 7)),
|
("1_5", list(range(246,277)), minor_versions("1.5" , 7)),
|
||||||
("1_6", list(range(277,346)), minor_versions("1.6" , 10)),
|
("1_6", list(range(277,346)), minor_versions("1.6" , 10)),
|
||||||
("2_0", list(range(346,414)), minor_versions("2.0" , 8)),
|
("2_0", list(range(346,414)), minor_versions("2.0" , 8)),
|
||||||
("2_1", list(range(414,475)), minor_versions("2.1" , 0)),
|
("2_1", list(range(414,475)), minor_versions("2.1" , 0)),
|
||||||
("2_2", list(range(475,504)), minor_versions("2.2" , 0))
|
("2_2", list(range(475,505)), minor_versions("2.2" , 0))
|
||||||
]
|
]
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
|
@ -2184,6 +2184,23 @@ def revert_verbatim_star(document):
|
|||||||
revert_verbatim(document, True)
|
revert_verbatim(document, True)
|
||||||
|
|
||||||
|
|
||||||
|
def convert_save_props(document):
|
||||||
|
" Add save_transient_properties parameter. "
|
||||||
|
i = find_token(document.header, '\\origin', 0)
|
||||||
|
if i == -1:
|
||||||
|
document.warning("Malformed lyx document: Missing '\\origin'.")
|
||||||
|
return
|
||||||
|
document.header.insert(i, '\\save_transient_properties true')
|
||||||
|
|
||||||
|
|
||||||
|
def revert_save_props(document):
|
||||||
|
" Remove save_transient_properties parameter. "
|
||||||
|
i = find_token(document.header, "\\save_transient_properties", 0)
|
||||||
|
if i == -1:
|
||||||
|
return
|
||||||
|
del document.header[i]
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Conversion hub
|
# Conversion hub
|
||||||
#
|
#
|
||||||
@ -2221,10 +2238,12 @@ convert = [
|
|||||||
[500, []],
|
[500, []],
|
||||||
[501, [convert_fontsettings]],
|
[501, [convert_fontsettings]],
|
||||||
[502, []],
|
[502, []],
|
||||||
[503, []]
|
[503, []],
|
||||||
|
[504, [convert_save_props]]
|
||||||
]
|
]
|
||||||
|
|
||||||
revert = [
|
revert = [
|
||||||
|
[503, [revert_save_props]],
|
||||||
[502, [revert_verbatim_star]],
|
[502, [revert_verbatim_star]],
|
||||||
[501, [revert_solution]],
|
[501, [revert_solution]],
|
||||||
[500, [revert_fontsettings]],
|
[500, [revert_fontsettings]],
|
||||||
|
@ -2765,12 +2765,14 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_CHANGES_TRACK:
|
case LFUN_CHANGES_TRACK:
|
||||||
undo().recordUndoBufferParams(CursorData());
|
if (params().save_transient_properties)
|
||||||
|
undo().recordUndoBufferParams(CursorData());
|
||||||
params().track_changes = !params().track_changes;
|
params().track_changes = !params().track_changes;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_CHANGES_OUTPUT:
|
case LFUN_CHANGES_OUTPUT:
|
||||||
undo().recordUndoBufferParams(CursorData());
|
if (params().save_transient_properties)
|
||||||
|
undo().recordUndoBufferParams(CursorData());
|
||||||
params().output_changes = !params().output_changes;
|
params().output_changes = !params().output_changes;
|
||||||
if (params().output_changes) {
|
if (params().output_changes) {
|
||||||
bool dvipost = LaTeXFeatures::isAvailable("dvipost");
|
bool dvipost = LaTeXFeatures::isAvailable("dvipost");
|
||||||
|
@ -369,6 +369,7 @@ BufferParams::BufferParams()
|
|||||||
biblio_style = "plain";
|
biblio_style = "plain";
|
||||||
use_bibtopic = false;
|
use_bibtopic = false;
|
||||||
use_indices = false;
|
use_indices = false;
|
||||||
|
save_transient_properties = true;
|
||||||
track_changes = false;
|
track_changes = false;
|
||||||
output_changes = false;
|
output_changes = false;
|
||||||
use_default_options = true;
|
use_default_options = true;
|
||||||
@ -673,6 +674,8 @@ string BufferParams::readToken(Lexer & lex, string const & token,
|
|||||||
frontend::Alert::warning(_("Document class not available"),
|
frontend::Alert::warning(_("Document class not available"),
|
||||||
msg, true);
|
msg, true);
|
||||||
}
|
}
|
||||||
|
} else if (token == "\\save_transient_properties") {
|
||||||
|
lex >> save_transient_properties;
|
||||||
} else if (token == "\\origin") {
|
} else if (token == "\\origin") {
|
||||||
lex.eatLine();
|
lex.eatLine();
|
||||||
origin = lex.getString();
|
origin = lex.getString();
|
||||||
@ -1015,6 +1018,9 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
|
|||||||
// The top of the file is written by the buffer.
|
// The top of the file is written by the buffer.
|
||||||
// Prints out the buffer info into the .lyx file given by file
|
// Prints out the buffer info into the .lyx file given by file
|
||||||
|
|
||||||
|
os << "\\save_transient_properties "
|
||||||
|
<< convert<string>(save_transient_properties) << '\n';
|
||||||
|
|
||||||
// the document directory (must end with a path separator)
|
// the document directory (must end with a path separator)
|
||||||
// realPath() is used to resolve symlinks, while addPath(..., "")
|
// realPath() is used to resolve symlinks, while addPath(..., "")
|
||||||
// ensures a trailing path separator.
|
// ensures a trailing path separator.
|
||||||
@ -1273,9 +1279,15 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "\\tracking_changes " << convert<string>(track_changes) << '\n'
|
os << "\\tracking_changes "
|
||||||
<< "\\output_changes " << convert<string>(output_changes) << '\n'
|
<< (save_transient_properties ? convert<string>(track_changes) : "false")
|
||||||
<< "\\html_math_output " << html_math_output << '\n'
|
<< '\n';
|
||||||
|
|
||||||
|
os << "\\output_changes "
|
||||||
|
<< (save_transient_properties ? convert<string>(output_changes) : "false")
|
||||||
|
<< '\n';
|
||||||
|
|
||||||
|
os << "\\html_math_output " << html_math_output << '\n'
|
||||||
<< "\\html_css_as_file " << html_css_as_file << '\n'
|
<< "\\html_css_as_file " << html_css_as_file << '\n'
|
||||||
<< "\\html_be_strict " << convert<string>(html_be_strict) << '\n';
|
<< "\\html_be_strict " << convert<string>(html_be_strict) << '\n';
|
||||||
|
|
||||||
|
@ -381,11 +381,14 @@ public:
|
|||||||
bool use_bibtopic;
|
bool use_bibtopic;
|
||||||
/// Split the index?
|
/// Split the index?
|
||||||
bool use_indices;
|
bool use_indices;
|
||||||
/// revision tracking for this buffer ?
|
/// Save trensient properties?
|
||||||
|
bool save_transient_properties;
|
||||||
|
/// revision tracking for this buffer ? (this is a transient property)
|
||||||
bool track_changes;
|
bool track_changes;
|
||||||
/** This param decides whether change tracking marks should be used
|
/** This param decides whether change tracking marks should be used
|
||||||
* in output (irrespective of how these marks are actually defined;
|
* in output (irrespective of how these marks are actually defined;
|
||||||
* for instance, they may differ for DVI and PDF generation)
|
* for instance, they may differ for DVI and PDF generation)
|
||||||
|
* This is a transient property.
|
||||||
*/
|
*/
|
||||||
bool output_changes;
|
bool output_changes;
|
||||||
///
|
///
|
||||||
|
@ -536,6 +536,7 @@ Preamble::Preamble() : one_language(true), explicit_babel(false),
|
|||||||
h_secnumdepth = "3";
|
h_secnumdepth = "3";
|
||||||
h_shortcut[0] = "idx";
|
h_shortcut[0] = "idx";
|
||||||
h_spacing = "single";
|
h_spacing = "single";
|
||||||
|
h_save_transient_properties = "true";
|
||||||
h_suppress_date = "false";
|
h_suppress_date = "false";
|
||||||
h_textclass = "article";
|
h_textclass = "article";
|
||||||
h_tocdepth = "3";
|
h_tocdepth = "3";
|
||||||
@ -1102,6 +1103,7 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc, string const & outfiled
|
|||||||
<< "\\lyxformat " << LYX_FORMAT << '\n'
|
<< "\\lyxformat " << LYX_FORMAT << '\n'
|
||||||
<< "\\begin_document\n"
|
<< "\\begin_document\n"
|
||||||
<< "\\begin_header\n"
|
<< "\\begin_header\n"
|
||||||
|
<< "\\save_transient_properties " << h_save_transient_properties << "\n"
|
||||||
<< "\\origin " << origin << "\n"
|
<< "\\origin " << origin << "\n"
|
||||||
<< "\\textclass " << h_textclass << "\n";
|
<< "\\textclass " << h_textclass << "\n";
|
||||||
string const raw = subdoc ? empty_string() : h_preamble.str();
|
string const raw = subdoc ? empty_string() : h_preamble.str();
|
||||||
|
@ -191,6 +191,7 @@ private:
|
|||||||
std::string h_shortcut[99];
|
std::string h_shortcut[99];
|
||||||
std::string h_spacing;
|
std::string h_spacing;
|
||||||
std::string h_suppress_date;
|
std::string h_suppress_date;
|
||||||
|
std::string h_save_transient_properties;
|
||||||
std::string h_textclass;
|
std::string h_textclass;
|
||||||
std::string h_tocdepth;
|
std::string h_tocdepth;
|
||||||
std::string h_tracking_changes;
|
std::string h_tracking_changes;
|
||||||
|
@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
|
|||||||
|
|
||||||
// Do not remove the comment below, so we get merge conflict in
|
// Do not remove the comment below, so we get merge conflict in
|
||||||
// independent branches. Instead add your own.
|
// independent branches. Instead add your own.
|
||||||
#define LYX_FORMAT_LYX 503 // uwestoehr: support for verbatim* environment
|
#define LYX_FORMAT_LYX 504 // gm: add save_transient_properties parameter
|
||||||
#define LYX_FORMAT_TEX2LYX 503
|
#define LYX_FORMAT_TEX2LYX 504
|
||||||
|
|
||||||
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
|
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
|
Loading…
Reference in New Issue
Block a user