[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 21e194a5bd 3/3: Refine file renaming under versi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 21e194a5bd 3/3: Refine file renaming under version control |
Date: |
Tue, 18 Oct 2022 08:57:39 -0400 (EDT) |
branch: externals/denote
commit 21e194a5bdedd26a451dab4c49ef7a177ff78482
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Refine file renaming under version control
This expands the conditionality introduced by Florian in commit
234520b. Read the mailing list for the relevant discussion:
<https://lists.sr.ht/~protesilaos/denote/%3C166547153518.8.941129310186454444.68125516@aboulafia.org%3E>.
---
denote.el | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/denote.el b/denote.el
index 06a9649437..9079988c56 100644
--- a/denote.el
+++ b/denote.el
@@ -1697,9 +1697,13 @@ the file type is assumed to be the first of
`denote-file-types'."
(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))
- (if (derived-mode-p 'dired-mode)
- (dired-rename-file old-name new-name nil)
- (rename-file old-name new-name nil))
+ (cond
+ ((derived-mode-p 'dired-mode)
+ (dired-rename-file old-name new-name nil))
+ ((vc-backend old-name)
+ (vc-rename-file old-name new-name))
+ (t
+ (rename-file old-name new-name nil)))
(denote--rename-buffer old-name new-name)))
(define-obsolete-function-alias