From 84c548a444bfc62dc2f7e45e72b71cf0d5835c3e Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Wed, 29 Jul 2015 16:31:42 +0200 Subject: [PATCH] don't :e an unsaved file --- lib/ex.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ex.coffee b/lib/ex.coffee index c7f0d45..6476bad 100644 --- a/lib/ex.coffee +++ b/lib/ex.coffee @@ -112,7 +112,10 @@ class Ex if filePath.indexOf(' ') isnt -1 throw new CommandError('Only one file name allowed') buffer = atom.workspace.getActiveTextEditor().buffer - filePath = buffer.getPath() if filePath is '' + if buffer.isModified() + throw new CommandError('Unsaved file') + if filePath is '' + filePath = buffer.getPath() buffer.setPath(getFullPath(filePath)) buffer.load()