don't :e an unsaved file

This commit is contained in:
Loic Nageleisen 2015-07-29 16:31:42 +02:00
parent da8405b387
commit 84c548a444

View file

@ -112,7 +112,10 @@ class Ex
if filePath.indexOf(' ') isnt -1 if filePath.indexOf(' ') isnt -1
throw new CommandError('Only one file name allowed') throw new CommandError('Only one file name allowed')
buffer = atom.workspace.getActiveTextEditor().buffer 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.setPath(getFullPath(filePath))
buffer.load() buffer.load()