[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 28fe1ac6ed: Add batch-renaming facility (WORK-IN
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 28fe1ac6ed: Add batch-renaming facility (WORK-IN-PROGRESS) |
Date: |
Sat, 16 Jul 2022 10:57:28 -0400 (EDT) |
branch: externals/denote
commit 28fe1ac6ed9f17c3d1d9730bf141c753c811b434
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add batch-renaming facility (WORK-IN-PROGRESS)
---
denote-dired.el | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/denote-dired.el b/denote-dired.el
index 5306e2785f..1fe86dc346 100644
--- a/denote-dired.el
+++ b/denote-dired.el
@@ -413,6 +413,39 @@ For per-file-type front matter, refer to the variables:
(goto-char (point-min))
(insert new-front-matter)))))
+;;;; Batch-renaming facility
+
+;; REVIEW 2022-07-16: This is a proof-of-concept
+;;;###autoload
+(defun denote-dired-batch-rename (keywords)
+ "DEV NOTE 2022-07-16: proof of concept---help flesh it out.
+
+Rename marked files in Dired using the following pattern:
+
+- the file's existing file name is retained and becomes the FILE
+ field, per Denote's file-naming scheme;
+
+- an identifier is prepended to the FILE;
+
+- a prompt is asked once for the KEYWORDS field, the input is
+ applied to all files."
+ (interactive (list (denote--keywords-prompt)) dired-mode)
+ (if-let ((marks (dired-get-marked-files)))
+ (progn
+ (dolist (file marks)
+ (let* ((dir (file-name-directory file))
+ (title (file-name-sans-extension (file-name-nondirectory
file)))
+ (extension (file-name-extension file t))
+ (new-name (denote--format-file
+ dir
+ (denote-dired--file-name-id file)
+ keywords
+ (denote--sluggify title)
+ extension)))
+ (rename-file (file-name-nondirectory file) new-name)))
+ (revert-buffer))
+ (user-error "No marked files; aborting")))
+
;;;; Extra fontification
(require 'denote-faces)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/denote 28fe1ac6ed: Add batch-renaming facility (WORK-IN-PROGRESS),
ELPA Syncer <=