about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-07-20 18:08:52 +0200
committerhut <hut@lavabit.com>2009-07-20 21:11:16 +0200
commit1c5184528eb436e0775a59cdcd6aa64744f36c9a (patch)
tree8b8f6ac118a541723d581411c37025516dad5b2d
parentec526a57e55e2dc9c0b09cf27bc2ad70e54857a3 (diff)
downloadranger-1c5184528eb436e0775a59cdcd6aa64744f36c9a.tar.gz
added an easy "edit" function
-rw-r--r--code/fm.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/code/fm.rb b/code/fm.rb
index dff94c7a..4f1a5742 100644
--- a/code/fm.rb
+++ b/code/fm.rb
@@ -58,6 +58,16 @@ module Fm
 		end
 	end
 
+	def edit( filename, mode=nil, flags=nil )
+		file = Directory::Entry.new( filename )
+		file.refresh
+		raise "File doesn't exist" unless file.exists?
+		runcontext = RunContext.new( file, mode, flags, 'editor' )
+		externally do
+			Action.run( runcontext )
+		end
+	end
+
 	def reload_types()
 		old_verbose_level = $VERBOSE
 		$VERBOSE = nil