diff --git a/rc/tools/git.kak b/rc/tools/git.kak index be1d7e70..ac349a97 100644 --- a/rc/tools/git.kak +++ b/rc/tools/git.kak @@ -183,7 +183,7 @@ define-command -params 1.. \ set-option buffer git_blame_flags $kak_timestamp set-option buffer git_blame_index $kak_timestamp set-option buffer git_blame %{} - remove-highlighter window/git-blame + try %{ remove-highlighter window/git-blame } unmap window normal %{:git blame-jump} " } @@ -217,7 +217,7 @@ define-command -params 1.. \ if [ -z "${kak_opt_git_blob}" ] && { [ "${kak_opt_filetype}" = git-diff ] || [ "${kak_opt_filetype}" = git-log ] } then { - echo 'remove-highlighter window/git-blame' + echo 'try %{ remove-highlighter window/git-blame }' printf >${kak_command_fifo} %s ' evaluate-commands -client '${kak_client}' -draft %{ try %{ diff --git a/src/highlighter_group.cc b/src/highlighter_group.cc index e23b5979..813262c0 100644 --- a/src/highlighter_group.cc +++ b/src/highlighter_group.cc @@ -43,7 +43,10 @@ void HighlighterGroup::add_child(String name, std::unique_ptr&& hl, void HighlighterGroup::remove_child(StringView id) { - m_highlighters.remove(id); + auto it = m_highlighters.find(id); + if (it == m_highlighters.end()) + throw child_not_found(format("no such id: '{}'", id)); + m_highlighters.remove(it); } Highlighter& HighlighterGroup::get_child(StringView path) diff --git a/src/highlighters.cc b/src/highlighters.cc index 2123e596..1ab6466d 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -2039,7 +2039,10 @@ public: if (id == m_default_region) m_default_region = String{}; - m_regions.remove(id); + auto it = m_regions.find(id); + if (it == m_regions.end()) + throw child_not_found(format("no such id: {}", id)); + m_regions.remove(it); ++m_regions_timestamp; }