diff --git a/ChangeLog b/ChangeLog index 78a912f46..1c5932a79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,6 +37,7 @@ Features creation of the default rc file and data directory, which allows for programmatic initialization without keystroke synthesis (thanks to Nicholas Rabenau). + + Feature #1033 allows UDAs to contribute to urgency (thanks to Max Muller). + Color error messages with a specific configuration variable 'color.error'. Bugs diff --git a/NEWS b/NEWS index 5079f51e8..589ef17e3 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,7 @@ New commands in taskwarrior 2.1.0 New configuration options in taskwarrior 2.1.0 - urgency.scheduled.coefficient + - urgency.uda..coefficient - color.scheduled - color.blocking diff --git a/doc/man/taskrc.5.in b/doc/man/taskrc.5.in index cfbea5a1e..749670b5c 100644 --- a/doc/man/taskrc.5.in +++ b/doc/man/taskrc.5.in @@ -1017,6 +1017,9 @@ Specific tag coefficient. .B urgency.user.project..coefficient=... .RS Specific project coefficient. +.B urgency.uda..coefficient=... +.RS +Presence/absence of UDA data. .RE The coefficients reflect the relative importance of the various terms in the diff --git a/src/Config.cpp b/src/Config.cpp index 09239c938..05849df2c 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -153,6 +153,7 @@ std::string Config::_defaults = "\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.uda.foo.coefficient=5.0 # Urgency coefficients for UDA 'foo'\n" "\n" "# Color controls.\n" "color=on # Enable color\n" diff --git a/src/Task.cpp b/src/Task.cpp index 9d6c73a97..0c50e7920 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -92,8 +92,11 @@ void initializeUrgencyCoefficients () std::vector ::iterator 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); + } } //////////////////////////////////////////////////////////////////////////////// @@ -1365,6 +1368,14 @@ float Task::urgency_c () const value += var->second; } } + else if (var->first.substr (0, 12) == "urgency.uda.") + { + // urgency.uda..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; + } } } diff --git a/src/commands/CmdShow.cpp b/src/commands/CmdShow.cpp index 096c18cfb..e75ddab7d 100644 --- a/src/commands/CmdShow.cpp +++ b/src/commands/CmdShow.cpp @@ -238,7 +238,8 @@ int CmdShow::execute (std::string& output) i->substr (0, 6) != "merge." && i->substr (0, 4) != "uda." && 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); }