don't :e an unsaved file
This commit is contained in:
parent
da8405b387
commit
84c548a444
1 changed files with 4 additions and 1 deletions
|
|
@ -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()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue