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

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

[elpa] externals/denote 85ae81782b 6/8: Make renaming commands rename th


From: ELPA Syncer
Subject: [elpa] externals/denote 85ae81782b 6/8: Make renaming commands rename the current file without prompt
Date: Fri, 17 May 2024 00:57:49 -0400 (EDT)

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

    Make renaming commands rename the current file without prompt
---
 README.org |  5 +++--
 denote.el  | 20 +++++++++++---------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/README.org b/README.org
index 962fd3a2cd..c855831a48 100644
--- a/README.org
+++ b/README.org
@@ -1483,8 +1483,9 @@ prepends new front matter to the top of the file.  We do 
this as a
 safety precaution since the user can, in principle, add arbitrary
 extras to their front matter that we would not want to touch.
 
-If in Dired, ~denote-change-file-type-and-front-matter~ operates on
-the file at point, else it prompts with minibuffer completion for one.
+If in Dired, ~denote-change-file-type-and-front-matter~ operates on the
+file at point, else the current file, else it prompts with minibuffer
+completion for one.
 
 The title of the file is retrieved from a line starting with a title
 field in the file's front matter, depending on the previous file type
diff --git a/denote.el b/denote.el
index b4db98af58..e2cd1165ad 100644
--- a/denote.el
+++ b/denote.el
@@ -2658,10 +2658,11 @@ produce a `y-or-n-p' prompt to that effect."
 
 ;;;;; The renaming commands and their prompts
 
-(defun denote--rename-dired-file-or-prompt ()
-  "Return Dired file at point, else prompt for one.
+(defun denote--rename-dired-file-or-current-file-or-prompt ()
+  "Return Dired file at point or the current file, else prompt for one.
 Throw error if FILE is not regular, else return FILE."
   (or (dired-get-filename nil t)
+      buffer-file-name
       (let* ((file (buffer-file-name))
              (format (if file
                          (format "Rename FILE Denote-style [%s]: " file)
@@ -2790,9 +2791,10 @@ renaming commands."
 Always rename the file where it is located in the file system:
 never move it to another directory.
 
-If in Dired, consider FILE to be the one at point, else prompt
-with minibuffer completion for one.  When called from Lisp, FILE
-is a file system path represented as a string.
+If in Dired, consider FILE to be the one at point, else the
+current file, else prompt with minibuffer completion for one.
+When called from Lisp, FILE is a file system path represented as
+a string.
 
 If FILE has a Denote-compliant identifier, retain it while
 updating components of the file name referenced by the user
@@ -2890,7 +2892,7 @@ file-naming scheme.
 For a version of this command that works with multiple files
 one-by-one, use `denote-dired-rename-files'."
   (interactive
-   (let* ((file (denote--rename-dired-file-or-prompt)))
+   (let* ((file (denote--rename-dired-file-or-current-file-or-prompt)))
      (append (list file) 
(denote--rename-get-file-info-from-prompts-or-existing file))))
   (let ((new-name (denote--rename-file file title keywords signature date)))
     (denote-update-dired-buffers)
@@ -3165,8 +3167,8 @@ relevant front matter.
 (defun denote-change-file-type-and-front-matter (file new-file-type)
   "Change file type of FILE and add an appropriate front matter.
 
-If in Dired, consider FILE to be the one at point, else prompt
-with minibuffer completion for one.
+If in Dired, consider FILE to be the one at point, else the
+current file, else prompt with minibuffer completion for one.
 
 Add a front matter in the format of the NEW-FILE-TYPE at the
 beginning of the file.
@@ -3183,7 +3185,7 @@ Important note: No attempt is made to modify any other 
elements
 of the file.  This needs to be done manually."
   (interactive
    (list
-    (denote--rename-dired-file-or-prompt)
+    (denote--rename-dired-file-or-current-file-or-prompt)
     (denote--valid-file-type (or (denote-file-type-prompt) denote-file-type))))
   (let* ((dir (file-name-directory file))
          (old-file-type (denote-filetype-heuristics file))



reply via email to

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