// 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
// 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