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

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

[elpa] externals/denote bd3ddfbe42 1/8: Stop using the 'denote--rename-f


From: ELPA Syncer
Subject: [elpa] externals/denote bd3ddfbe42 1/8: Stop using the 'denote--rename-file-subr' in 'denote-rename-file'
Date: Sat, 4 Nov 2023 00:57:50 -0400 (EDT)

branch: externals/denote
commit bd3ddfbe423df53e2c55c8eda69293ae56656d18
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Stop using the 'denote--rename-file-subr' in 'denote-rename-file'
    
    That abstraction was not good enough and thus makes things more
    difficult for us. I am reverting to what we had before. We will see
    how best to proceed.
    
    Thanks to Jean-Philippe Gagné Guay for telling me about the drawbacks
    of the 'denote--rename-file-subr'. This was done on the GitHub mirror.
---
 denote.el | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/denote.el b/denote.el
index 3a2dba93c8..8b1e970ca2 100644
--- a/denote.el
+++ b/denote.el
@@ -2457,7 +2457,23 @@ place."
        (denote-retrieve-filename-signature file)
        (format "Rename `%s' with signature (empty to ignore)" file-in-prompt))
       current-prefix-arg)))
-  (denote--rename-file-subr file nil title keywords signature ask-date))
+  (let* ((dir (file-name-directory file))
+         (id (or (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 signature))
+         (max-mini-window-height denote-rename-max-mini-window-height))
+    (when (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)
+          (denote--add-front-matter new-name title keywords id file-type))))))
 
 ;;;###autoload
 (defun denote-dired-rename-files ()



reply via email to

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