summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/core/helper.py2
-rw-r--r--ranger/defaults/commands.py2
-rw-r--r--ranger/defaults/keys.py3
-rw-r--r--ranger/gui/colorscheme.py32
4 files changed, 14 insertions, 25 deletions
diff --git a/ranger/core/helper.py b/ranger/core/helper.py
index 0ef0fc27..38460bb6 100644
--- a/ranger/core/helper.py
+++ b/ranger/core/helper.py
@@ -161,6 +161,7 @@ def log(*objects, **keywords):
 	Writes objects to a logfile (for the purpose of debugging only.)
 	Has the same arguments as print() in python3.
 	"""
+	from ranger import arg
 	if LOGFILE is None or not arg.debug or arg.clean: return
 	start = 'start' in keywords and keywords['start'] or 'ranger:'
 	sep   =   'sep' in keywords and keywords['sep']   or ' '
@@ -170,6 +171,7 @@ def log(*objects, **keywords):
 
 
 def log_traceback():
+	from ranger import arg
 	if LOGFILE is None or not arg.debug or arg.clean: return
 	import traceback
 	traceback.print_stack(file=open(LOGFILE, 'a'))
diff --git a/ranger/defaults/commands.py b/ranger/defaults/commands.py
index 157b148c..db73ac45 100644
--- a/ranger/defaults/commands.py
+++ b/ranger/defaults/commands.py
@@ -288,7 +288,7 @@ class find(Command):
 		return self.count == 1
 
 
-class _set(Command):
+class set_(Command):
 	"""
 	:set <option name>=<python expression>
 
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py
index e62ae9ae..21a170f7 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -285,7 +285,8 @@ for key in ALLOWED_BOOKMARK_KEYS:
 	map("m" + key, fm.set_bookmark(key))
 	map("um" + key, fm.unset_bookmark(key))
 map("`<bg>", "'<bg>", "m<bg>", fm.draw_bookmarks())
-map('um<bg>', fm.hint("delete which bookmark?"))
+map('um<bg>', lambda arg: (arg.fm.draw_bookmarks(),
+	arg.fm.hint("delete which bookmark?")))
 
 # ---------------------------------------------------- change views
 map('i', fm.display_file())
diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py
index ae6aac0b..5a2a97ef 100644
--- a/ranger/gui/colorscheme.py
+++ b/ranger/gui/colorscheme.py
@@ -35,10 +35,7 @@ associated with either True or False.
 
 define which colorscheme to use by having this to your options.py:
 from ranger import colorschemes
-colorscheme = colorschemes.filename
-
-If your colorscheme-file contains more than one colorscheme, specify it with:
-colorscheme = colorschemes.filename.classname
+colorscheme = "name"
 """
 
 import os
@@ -103,25 +100,14 @@ class ColorScheme(SettingsAware):
 		return attr | color_pair(get_color(fg, bg))
 
 	def use(self, context):
-		"""
-		Use the colorscheme to determine the (fg, bg, attr) tuple.
-
-		When no colorscheme is found, ranger will fall back to this very
-		basic colorscheme where directories are blue and bold, and
-		selected files have the color inverted.
+		"""Use the colorscheme to determine the (fg, bg, attr) tuple.
 
 		Override this method in your own colorscheme.
 		"""
-		fg, attr = -1, 0
-		if context.highlight or context.selected:
-			attr = 262144
-		if context.directory:
-			attr |= 2097152
-			fg = 4
-		return fg, -1, attr
+		return (-1, -1, 0)
 
 def _colorscheme_name_to_class(signal):
-	# Find the colorscheme.  First look for it at ~/.config/ranger/colorschemes,
+	# Find the colorscheme.  First look in ~/.config/ranger/colorschemes,
 	# then at RANGERDIR/colorschemes.  If the file contains a class
 	# named Scheme, it is used.  Otherwise, an arbitrary other class
 	# is picked.
@@ -156,11 +142,11 @@ def _colorscheme_name_to_class(signal):
 		scheme_supermodule = None  # found no matching file.
 
 	if scheme_supermodule is None:
-		# XXX: dont print while curses is running
-		print("ERROR: colorscheme not found, fall back to builtin scheme")
-		if ranger.arg.debug:
-			raise Exception("Cannot locate colorscheme!")
-		signal.value = ColorScheme()
+		if signal.previous and isinstance(signal.previous, ColorScheme):
+			signal.value = signal.previous
+		else:
+			signal.value = ColorScheme()
+		raise Exception("Cannot locate colorscheme `%s'" % scheme_name)
 	else:
 		if usecustom: allow_access_to_confdir(ranger.arg.confdir, True)
 		scheme_module = getattr(__import__(scheme_supermodule,