summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2018-12-26 14:30:57 +0100
committertoonn <toonn@toonn.io>2018-12-26 15:15:37 +0100
commit71c7564107a7e7ae22a55190d16c5eba4615f4a0 (patch)
tree80837f1e195200222fdb9f942f9eeda2cd004f87
parent07cc58396035d1c25871632d8ee14cad08dbe69a (diff)
downloadranger-71c7564107a7e7ae22a55190d16c5eba4615f4a0.tar.gz
Silence KeyError for bookmarks while expanding macros
The implementation for the `%any_path` macro relies on the bookmark
being defined, however when expanding the macro for uses of `%any` that
don't involve existing bookmarks you get error messages even though the
failure's expected.

Simplest solution is to just fail silently, like the existing `%any`
macro already did. Lazy evaluation would silence the error for all uses
of `%any`, since the value for `%any_path` would never be used, but that
would require altering all the generation and consumption of macro
values. Another solution is to only resolve the `%any_path` macro when
it's necessary but that would involve changing the way `wildcards` are
passed distinguishing between `any` and `any_path` macros.

Fixes #1419
-rw-r--r--ranger/core/actions.py2
1 files changed, 0 insertions, 2 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 73c9fa51..c2726015 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -247,8 +247,6 @@ class Actions(  # pylint: disable=too-many-instance-attributes,too-many-public-m
                 try:
                     val = self.fm.bookmarks[key_to_string(char)]
                 except KeyError:
-                    self.notify('No bookmark defined for `{}`'.format(
-                        key_to_string(char)), bad=True)
                     val = MACRO_FAIL
                 return ('any_path{:d}'.format(i), val)