diff --git a/core/defuns/defuns-file.el b/core/defuns/defuns-file.el index aecd2f289..6a5ae275b 100644 --- a/core/defuns/defuns-file.el +++ b/core/defuns/defuns-file.el @@ -15,6 +15,7 @@ (when (file-exists-p file) (delete-file file t))) (narf/org-attachments))) + (set-buffer-modified-p nil) (delete-file filename) (kill-this-buffer) (unless (narf/real-buffer-p) @@ -33,7 +34,8 @@ provided." (let ((dir (f-dirname path)) (fullpath (f-full path)) (is-auto t)) - (when (and bang (not (file-exists-p dir))) (f-mkdir dir)) + (when (and bang (not (file-exists-p dir))) + (f-mkdir dir)) (if (file-exists-p dir) (if (file-exists-p fullpath) (error "File already exists: %s" path) @@ -61,6 +63,8 @@ provided." (when (file-exists-p file) (rename-file file (f-expand (f-filename old-path) (f-dirname new-path)) t))) (narf/org-attachments))) + (when (buffer-modified-p) + (save-buffer)) (rename-file old-path new-path 1) (rename-buffer (f-filename new-path)) (set-visited-file-name new-path)