- Feature #1033 allows UDAs to contribute to urgency (thanks to Max Muller).
This commit is contained in:
Paul Beckingham 2012-07-18 23:28:33 -04:00
parent 6a2c047beb
commit a469a2c6d5
6 changed files with 20 additions and 2 deletions

View file

@ -37,6 +37,7 @@ Features
creation of the default rc file and data directory, which allows for creation of the default rc file and data directory, which allows for
programmatic initialization without keystroke synthesis (thanks to Nicholas programmatic initialization without keystroke synthesis (thanks to Nicholas
Rabenau). Rabenau).
+ Feature #1033 allows UDAs to contribute to urgency (thanks to Max Muller).
+ Color error messages with a specific configuration variable 'color.error'. + Color error messages with a specific configuration variable 'color.error'.
Bugs Bugs

1
NEWS
View file

@ -24,6 +24,7 @@ New commands in taskwarrior 2.1.0
New configuration options in taskwarrior 2.1.0 New configuration options in taskwarrior 2.1.0
- urgency.scheduled.coefficient - urgency.scheduled.coefficient
- urgency.uda.<name>.coefficient
- color.scheduled - color.scheduled
- color.blocking - color.blocking

View file

@ -1017,6 +1017,9 @@ Specific tag coefficient.
.B urgency.user.project.<project>.coefficient=... .B urgency.user.project.<project>.coefficient=...
.RS .RS
Specific project coefficient. Specific project coefficient.
.B urgency.uda.<name>.coefficient=...
.RS
Presence/absence of UDA data.
.RE .RE
The coefficients reflect the relative importance of the various terms in the The coefficients reflect the relative importance of the various terms in the

View file

@ -153,6 +153,7 @@ std::string Config::_defaults =
"\n" "\n"
"#urgency.user.project.foo.coefficient=5.0 # Urgency coefficients for 'foo' project\n" "#urgency.user.project.foo.coefficient=5.0 # Urgency coefficients for 'foo' project\n"
"#urgency.user.tag.foo.coefficient=5.0 # Urgency coefficients for 'foo' tag\n" "#urgency.user.tag.foo.coefficient=5.0 # Urgency coefficients for 'foo' tag\n"
"#urgency.uda.foo.coefficient=5.0 # Urgency coefficients for UDA 'foo'\n"
"\n" "\n"
"# Color controls.\n" "# Color controls.\n"
"color=on # Enable color\n" "color=on # Enable color\n"

View file

@ -92,8 +92,11 @@ void initializeUrgencyCoefficients ()
std::vector <std::string>::iterator var; std::vector <std::string>::iterator var;
for (var = all.begin (); var != all.end (); ++var) for (var = all.begin (); var != all.end (); ++var)
if (var->substr (0, 13) == "urgency.user.") {
if (var->substr (0, 13) == "urgency.user." ||
var->substr (0, 12) == "urgency.uda.")
coefficients[*var] = context.config.getReal (*var); coefficients[*var] = context.config.getReal (*var);
}
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -1365,6 +1368,14 @@ float Task::urgency_c () const
value += var->second; value += var->second;
} }
} }
else if (var->first.substr (0, 12) == "urgency.uda.")
{
// urgency.uda.<name>.coefficient
std::string::size_type end = var->first.find (".coefficient");
if (end != std::string::npos)
if (has (var->first.substr (12, end - 12)))
value += var->second;
}
} }
} }

View file

@ -238,7 +238,8 @@ int CmdShow::execute (std::string& output)
i->substr (0, 6) != "merge." && i->substr (0, 6) != "merge." &&
i->substr (0, 4) != "uda." && i->substr (0, 4) != "uda." &&
i->substr (0, 21) != "urgency.user.project." && i->substr (0, 21) != "urgency.user.project." &&
i->substr (0, 17) != "urgency.user.tag.") i->substr (0, 17) != "urgency.user.tag." &&
i->substr (0, 12) != "urgency.uda.")
{ {
unrecognized.push_back (*i); unrecognized.push_back (*i);
} }