Check for filetype after saving an untitled buffer

Fixes #242
This commit is contained in:
Zachary Yedidia
2016-08-30 17:25:30 -04:00
parent 93361fe72d
commit ddff950fcd

View File

@@ -219,6 +219,7 @@ func (b *Buffer) Serialize() error {
// SaveAs saves the buffer to a specified path (filename), creating the file if it does not exist
func (b *Buffer) SaveAs(filename string) error {
b.FindFileType()
b.UpdateRules()
b.Name = filename
b.Path = filename
@@ -235,6 +236,7 @@ func (b *Buffer) SaveAs(filename string) error {
// SaveAsWithSudo is the same as SaveAs except it uses a neat trick
// with tee to use sudo so the user doesn't have to reopen micro with sudo
func (b *Buffer) SaveAsWithSudo(filename string) error {
b.FindFileType()
b.UpdateRules()
b.Name = filename
b.Path = filename