emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/denote 7a8143a7c3 01/10: Rename denote-dired--rename-fi


From: ELPA Syncer
Subject: [elpa] externals/denote 7a8143a7c3 01/10: Rename denote-dired--rename-file to denote-dired--rename-file-prompt
Date: Sun, 31 Jul 2022 01:57:29 -0400 (EDT)

branch: externals/denote
commit 7a8143a7c3c44dc817261e34b6c4281114f12b9d
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>

    Rename denote-dired--rename-file to denote-dired--rename-file-prompt
    
    The function only prompts to rename the file. The renaming is done by
    the function denote--rename-file.
---
 denote-dired.el | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/denote-dired.el b/denote-dired.el
index f2d82ddb1f..8a1508aa91 100644
--- a/denote-dired.el
+++ b/denote-dired.el
@@ -216,20 +216,13 @@ Throw error is FILE is not regular, else return FILE."
             (user-error "Only rename regular files")
           selected-file))))
 
-(defun denote-dired--rename-file (old-name new-name)
-  "Rename file named OLD-NAME to NEW-NAME.
-Update Dired buffers if the file is renamed.
-Return t if the file is renamed, nil otherwise."
+(defun denote-dired--rename-file-prompt (old-name new-name)
+  "Prompt to rename file named OLD-NAME to NEW-NAME."
   (unless (string= (expand-file-name old-name) (expand-file-name new-name))
-    (let ((response
-           (y-or-n-p
-            (format "Rename %s to %s?"
-                    (propertize (file-name-nondirectory old-name) 'face 'error)
-                    (propertize (file-name-nondirectory new-name) 'face 
'success)))))
-      (when response
-        (rename-file old-name new-name nil)
-        (denote--rename-buffer old-name new-name))
-      response)))
+    (y-or-n-p
+     (format "Rename %s to %s?"
+             (propertize (file-name-nondirectory old-name) 'face 'error)
+             (propertize (file-name-nondirectory new-name) 'face 'success)))))
 
 ;; FIXME 2022-07-25: We should make the underlying regular expressions
 ;; that `denote--retrieve-value-title' targets more refined, so that we
@@ -327,7 +320,8 @@ will not---manage such files)."
          (new-name (denote--format-file
                     dir id keywords (denote--sluggify title) extension))
          (max-mini-window-height 0.33)) ; allow minibuffer to be resized
-    (when (denote-dired--rename-file file new-name)
+    (when (denote-dired--rename-file-prompt file new-name)
+      (denote--rename-file file new-name)
       (denote-update-dired-buffers)
       (denote-dired--rewrite-front-matter new-name title keywords))))
 
@@ -363,7 +357,8 @@ matter, refer to the variables:
          (new-name (denote--format-file
                     dir id keywords (denote--sluggify title) extension))
          (max-mini-window-height 0.33)) ; allow minibuffer to be resized
-    (when (denote-dired--rename-file file new-name)
+    (when (denote-dired--rename-file-prompt file new-name)
+      (denote--rename-file file new-name)
       (denote-update-dired-buffers)
       (denote--add-front-matter new-name title keywords id))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]