]> git.lizzy.rs Git - micro.git/blobdiff - cmd/micro/buffer.go
Merge pull request #233 from schollz/master
[micro.git] / cmd / micro / buffer.go
index 2046c72971f35365b7a38e46ceab8faeed65f558..935fe3e91333a1228763f7fcc7e72f201390eab1 100644 (file)
@@ -247,6 +247,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
@@ -263,6 +264,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