[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote d14a421036 4/8: Only rename the file if it exist
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote d14a421036 4/8: Only rename the file if it exists in denote-rename-file-and-buffer |
Date: |
Fri, 17 May 2024 00:57:49 -0400 (EDT) |
branch: externals/denote
commit d14a421036561cf6ae0505bbe1b80005290a690d
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Only rename the file if it exists in denote-rename-file-and-buffer
---
denote.el | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/denote.el b/denote.el
index df509b041b..455b4ab79f 100644
--- a/denote.el
+++ b/denote.el
@@ -2548,17 +2548,19 @@ variable `denote-directory'."
(defun denote-rename-file-and-buffer (old-name new-name)
"Rename file named OLD-NAME to NEW-NAME, updating buffer name."
(unless (string= (expand-file-name old-name) (expand-file-name new-name))
- (cond
- ((derived-mode-p 'dired-mode)
- (dired-rename-file old-name new-name nil))
- ;; NOTE 2024-02-25: The `vc-rename-file' requires the file to be
- ;; saved, but our convention is to not save the buffer after
- ;; changing front matter unless we absolutely have to (allows
- ;; users to do `diff-buffer-with-file', for example).
- ((and denote-save-buffers (not (buffer-modified-p)) (vc-backend old-name))
- (vc-rename-file old-name new-name))
- (t
- (rename-file old-name new-name nil)))
+ (when (and (denote--file-regular-writable-p old-name)
+ (file-writable-p new-name))
+ (cond
+ ((derived-mode-p 'dired-mode)
+ (dired-rename-file old-name new-name nil))
+ ;; NOTE 2024-02-25: The `vc-rename-file' requires the file to be
+ ;; saved, but our convention is to not save the buffer after
+ ;; changing front matter unless we absolutely have to (allows
+ ;; users to do `diff-buffer-with-file', for example).
+ ((and denote-save-buffers (not (buffer-modified-p)) (vc-backend
old-name))
+ (vc-rename-file old-name new-name))
+ (t
+ (rename-file old-name new-name nil))))
(when-let ((buffer (find-buffer-visiting old-name)))
(with-current-buffer buffer
(set-visited-file-name new-name nil t)))))
- [elpa] externals/denote updated (88a67e9493 -> 8880bf3ca3), ELPA Syncer, 2024/05/17
- [elpa] externals/denote 0f966d06f8 3/8: Do not check that the file exists in denote-file-is-writable-and-supported-p, ELPA Syncer, 2024/05/17
- [elpa] externals/denote 85ae81782b 6/8: Make renaming commands rename the current file without prompt, ELPA Syncer, 2024/05/17
- [elpa] externals/denote d14a421036 4/8: Only rename the file if it exists in denote-rename-file-and-buffer,
ELPA Syncer <=
- [elpa] externals/denote bce7778d9d 5/8: Make denote and denote--rename-file issue an error if the new file already exists, ELPA Syncer, 2024/05/17
- [elpa] externals/denote 8834bcd3e1 1/8: Revert "Make some stylistic changes for how non-nil arguments are named", ELPA Syncer, 2024/05/17
- [elpa] externals/denote 9460e457e3 2/8: Check file-type first in denote-retrieve-front-matter-* functions, ELPA Syncer, 2024/05/17
- [elpa] externals/denote 8880bf3ca3 8/8: Merge pull request #351 from jeanphilippegg/cleanup, ELPA Syncer, 2024/05/17
- [elpa] externals/denote 8c6d43106a 7/8: Merge pull request #352 from jeanphilippegg/no-prompt-for-current-file, ELPA Syncer, 2024/05/17