defuns-file: handle modified buffers on :mv and :rm
This commit is contained in:
parent
1cd492d301
commit
10bc312a62
1 changed files with 5 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue