[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 4e2d9c91c9 3/5: Merge pull request #414 from jea
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 4e2d9c91c9 3/5: Merge pull request #414 from jeanphilippegg/rename-readonly-files |
Date: |
Mon, 26 Aug 2024 03:57:50 -0400 (EDT) |
branch: externals/denote
commit 4e2d9c91c9dc7950786052a6ce5e94412e0ad05f
Merge: eec60330fb 0d7098538c
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: GitHub <noreply@github.com>
Merge pull request #414 from jeanphilippegg/rename-readonly-files
Make denote-rename-file-and-buffer work with read-only files
---
denote.el | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/denote.el b/denote.el
index 5bebea7245..c7a31fbf98 100644
--- a/denote.el
+++ b/denote.el
@@ -2722,9 +2722,15 @@ variable `denote-directory'."
(mapc #'denote--revert-dired (buffer-list)))
(defun denote-rename-file-and-buffer (old-name new-name)
- "Rename file named OLD-NAME to NEW-NAME, updating buffer name."
+ "Rename file named OLD-NAME to NEW-NAME, updating buffer name.
+
+If the file exists on the file system, it is renamed. This
+function may be called when creating a new note and the file does
+not exist yet.
+
+If a buffer is visiting the file, its name is updated."
(unless (string= (expand-file-name old-name) (expand-file-name new-name))
- (when (and (denote--file-regular-writable-p old-name)
+ (when (and (file-regular-p old-name)
(file-writable-p new-name))
(cond
((derived-mode-p 'dired-mode)