[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote a2d5c4e174 8/8: Make denote-dired-rename-files n
|
From: |
ELPA Syncer |
|
Subject: |
[elpa] externals/denote a2d5c4e174 8/8: Make denote-dired-rename-files not use the 'denote--rename-file-subr' |
|
Date: |
Sat, 4 Nov 2023 00:57:51 -0400 (EDT) |
branch: externals/denote
commit a2d5c4e174216069361e916dd55687a7ac7d6503
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Make denote-dired-rename-files not use the 'denote--rename-file-subr'
Same idea as with commit bd3ddfb. The 'denote--rename-file-subr',
which I am now removing, was not abstract enough and was thus creating
problems. Thanks to Jean-Philippe Gagné Guay for pointing this out in
issue 182 on the GitHub mirror:
<https://github.com/protesilaos/denote/pull/182>.
---
denote.el | 64 +++++++++++----------------------------------------------------
1 file changed, 11 insertions(+), 53 deletions(-)
diff --git a/denote.el b/denote.el
index 92b6661623..6719c1d58e 100644
--- a/denote.el
+++ b/denote.el
@@ -2334,54 +2334,6 @@ Throw error is FILE is not regular, else return FILE."
(defvar denote-rename-max-mini-window-height 0.33
"How much to enlarge `max-mini-window-height' for renaming operations.")
-(defun denote--rename-file-subr (file identifier title keywords signature
&optional ask-date no-confirm)
- "Subroutine for `denote-rename-file' and `denote-dired-rename-files'.
-
-- FILE is the target of the rename operation.
-
-- IDENTIFIER is a string unique to the file representing the
- current date and time. If IDENTIFIER is nil, derive a unique
- one (with either `denote-retrieve-filename-identifier' or
- `denote-create-unique-file-identifier');
-
-- TITLE is a string that is sluggified to form the new name's
- title component;
-
-- KEYWORDS is a list of strings that are ultimately joined into a
- single string with `denote-keywords-combine';
-
-- SIGNATURE is a string for the file name signature component.
-
-A nil or blank value for TITLE, KEYWORDS, or SIGNATURE omits the
-given component from the file name.
-
-If optional ASK-DATE is non-nil, pass it to the function
-`denote-create-unique-file-identifier' so that it produces an
-identifier based on the user input supplied to
-`denote-date-prompt'. Otherwise, use the current time.
-
-If optional NO-CONFIRM is non-nil, do not ask for confirmation
-while renaming files, otherwise do it while displaying the
-relevant changes."
- (let* ((dir (file-name-directory file))
- (id (or identifier
- (denote-retrieve-filename-identifier file :no-error)
- (denote-create-unique-file-identifier file ask-date)))
- (extension (denote-get-file-extension file))
- (file-type (denote-filetype-heuristics file))
- (title (or title (denote--retrieve-title-or-filename file file-type)))
- (keywords (or keywords (denote-retrieve-keywords-value file
file-type)))
- (signature (or signature (denote-retrieve-filename-signature file)))
- (new-name (denote-format-file-name dir id keywords (denote-sluggify
title 'title) extension (denote-sluggify-signature signature)))
- (max-mini-window-height denote-rename-max-mini-window-height))
- (when (or no-confirm (denote-rename-file-prompt file new-name))
- (denote-rename-file-and-buffer file new-name)
- (denote-update-dired-buffers)
- (when (denote-file-is-writable-and-supported-p new-name)
- (if (denote--edit-front-matter-p new-name file-type)
- (denote-rewrite-front-matter new-name title keywords file-type
no-confirm)
- (denote--add-front-matter new-name title keywords id file-type))))))
-
;;;###autoload
(defun denote-rename-file (file title keywords signature &optional ask-date)
"Rename file and update existing front matter if appropriate.
@@ -2507,11 +2459,10 @@ the changes made to the file: perform them outright."
(not (denote-retrieve-filename-identifier m
:no-error)))
marks)
(denote--get-all-used-ids))))
- ;; FIXME 2023-10-24: There is repetition between this and
- ;; `denote-rename-file'. We better avoid it.
(dolist (file marks)
(let* ((file-type (denote-filetype-heuristics file))
(file-in-prompt (propertize file 'face 'error))
+ (dir (file-name-directory file))
(id (or (denote-retrieve-filename-identifier file :no-error)
(denote-create-unique-file-identifier file nil
used-ids)))
(title (denote-title-prompt
@@ -2521,9 +2472,16 @@ the changes made to the file: perform them outright."
(format "Rename `%s' with keywords"
file-in-prompt)))
(signature (denote-signature-prompt
(denote-retrieve-filename-signature file)
- (format "Rename `%s' with signature (empty to
ignore)" file-in-prompt))))
- (denote--rename-file-subr file id title keywords signature
used-ids :no-confirm)
- (when used-ids (puthash id t used-ids))))
+ (format "Rename `%s' with signature (empty to
ignore)" file-in-prompt)))
+ (extension (denote-get-file-extension file))
+ (new-name (denote-format-file-name dir id keywords
(denote-sluggify title 'title) extension (denote-sluggify-signature
signature))))
+ (denote-rename-file-and-buffer file new-name)
+ (when (denote-file-is-writable-and-supported-p new-name)
+ (if (denote--edit-front-matter-p new-name file-type)
+ (denote-rewrite-front-matter new-name title keywords
file-type denote-rename-no-confirm)
+ (denote--add-front-matter new-name title keywords id
file-type)))
+ (when used-ids
+ (puthash id t used-ids))))
(denote-update-dired-buffers))
(user-error "No marked files; aborting")))
- [elpa] externals/denote updated (0d7b81955d -> a2d5c4e174), ELPA Syncer, 2023/11/04
- [elpa] externals/denote 7969bb533a 4/8: Revert "Make denote-dired-rename-marked-files-with-keywords use denote--rename-file-subr", ELPA Syncer, 2023/11/04
- [elpa] externals/denote 0f449dd3a5 5/8: Tweak denote-dired-rename-marked-files-with-keywords docstring and prompt, ELPA Syncer, 2023/11/04
- [elpa] externals/denote eba22e8c2b 2/8: Remove needless comment, ELPA Syncer, 2023/11/04
- [elpa] externals/denote 3b1397bd9d 6/8: Set denote-dired-rename-marked-files-with-keywords lexical variable directly, ELPA Syncer, 2023/11/04
- [elpa] externals/denote 05e55e16c0 7/8: Change where signatures are sluggified for consistency, ELPA Syncer, 2023/11/04
- [elpa] externals/denote bd3ddfbe42 1/8: Stop using the 'denote--rename-file-subr' in 'denote-rename-file', ELPA Syncer, 2023/11/04
- [elpa] externals/denote dc66c56cb1 3/8: Add user option 'denote-rename-no-confirm', ELPA Syncer, 2023/11/04
- [elpa] externals/denote a2d5c4e174 8/8: Make denote-dired-rename-files not use the 'denote--rename-file-subr',
ELPA Syncer <=