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

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

[elpa] externals/denote d34af36ef1 1/2: Add denote-dired-rename-marked-f


From: ELPA Syncer
Subject: [elpa] externals/denote d34af36ef1 1/2: Add denote-dired-rename-marked-files optional arg to skip front matter prompt
Date: Sun, 9 Jul 2023 00:57:39 -0400 (EDT)

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

    Add denote-dired-rename-marked-files optional arg to skip front matter 
prompt
    
    Thanks to Jay Rajput for asking the question that inspired me to
    implement this.  It was done in issue 155 on the GitHub mirror:
    <https://github.com/protesilaos/denote/issues/155>.
---
 README.org | 34 ++++++++++++++++++++--------------
 denote.el  | 25 ++++++++++++++-----------
 2 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/README.org b/README.org
index 939921a1d8..ad2ec20244 100644
--- a/README.org
+++ b/README.org
@@ -1059,14 +1059,19 @@ following:
   applied to all file names;
 
 - if the file is recognized as a Denote note, this command adds or
-  rewrites front matter to include the new keywords.  A confirmation to
-  carry out this step is performed once at the outset.  Note that the
-  affected buffers are not saved.  The user can thus check them to
-  confirm that the new front matter does not cause any problems
-  (e.g. with the command ~diff-buffer-with-file~).  Multiple buffers can
-  be saved with ~save-some-buffers~ (read its doc string).  The addition
-  of front matter takes place only if the given file has the appropriate
-  file type extension (per the user option ~denote-file-type~).
+  rewrites front matter to include the new keywords.  A confirmation
+  to carry out this step is performed once at the outset, unless
+  optional =SKIP-FRONT-MATTER-PROMPT= is non-nil (such as with a
+  universal prefix argument).  Note that the affected buffers are not
+  saved.  The user can thus check them to confirm that the new front
+  matter does not cause any problems (e.g. with the command
+  ~diff-buffer-with-file~).  Multiple buffers can be saved with
+  ~save-some-buffers~ (read its doc string).  The addition of front
+  matter takes place only if the given file has the appropriate file
+  type extension (per the user option ~denote-file-type~).
+
+[ The optional =SKIP-FRONT-MATTER-PROMPT= is added to
+  ~denote-dired-rename-marked-files~ as part of {{{development-version}}}. ]
 
 ** Rename a single file based on its front matter
 :PROPERTIES:
@@ -4423,12 +4428,13 @@ Denote is meant to be a collective effort.  Every bit 
of help matters.
 + Ideas and/or user feedback :: Abin Simon, Aditya Yadav, Alan
   Schmitt, Alfredo Borrás, Benjamin Kästner, Colin McLear, Damien
   Cassou, Elias Storms, Federico Stilman, Florian, Frank Ehmsen, Guo
-  Yong, Hanspeter Gisler, Jack Baty, Jeremy Friesen, Jonathan Sahar,
-  Juanjo Presa, Johan Bolmsjö, Kai von Fintel, Kaushal Modi, M. Hadi
-  Timachi, Mirko Hernandez, Niall Dooley, Paul van Gelder, Peter
-  Prevos, Shreyas Ragavan, Stefan Thesing, Summer Emacs, Sven Seebeck,
-  Taoufik, Viktor Haag, Wade Mealing, Yi Liu, Ypot, atanasj, doolio,
-  drcxd, hpgisler, pRot0ta1p, rbenit68, relict007, sienic, sundar bp.
+  Yong, Hanspeter Gisler, Jack Baty, Jay Rajput, Jeremy Friesen,
+  Jonathan Sahar, Juanjo Presa, Johan Bolmsjö, Kai von Fintel, Kaushal
+  Modi, M. Hadi Timachi, Mirko Hernandez, Niall Dooley, Paul van
+  Gelder, Peter Prevos, Shreyas Ragavan, Stefan Thesing, Summer Emacs,
+  Sven Seebeck, Taoufik, Viktor Haag, Wade Mealing, Yi Liu, Ypot,
+  atanasj, doolio, drcxd, hpgisler, pRot0ta1p, rbenit68, relict007,
+  sienic, sundar bp.
 
 Special thanks to Peter Povinec who helped refine the file-naming
 scheme, which is the cornerstone of this project.
diff --git a/denote.el b/denote.el
index dcad07aa29..3053d8de1c 100644
--- a/denote.el
+++ b/denote.el
@@ -2341,7 +2341,7 @@ of the file.  This needs to be done manually."
         (denote--add-front-matter new-name title keywords id new-file-type)))))
 
 ;;;###autoload
-(defun denote-dired-rename-marked-files ()
+(defun denote-dired-rename-marked-files (&optional skip-front-matter-prompt)
   "Rename marked files in Dired to Denote file name.
 
 The operation does the following:
@@ -2360,18 +2360,21 @@ The operation does the following:
 
 - if the file is recognized as a Denote note, add a front matter
   or rewrite it to include the new keywords.  A confirmation to
-  carry out this step is performed once at the outset.  Note that
-  the affected buffers are not saved.  The user can thus check
-  them to confirm that the new front matter does not cause any
-  problems (e.g. with the command `diff-buffer-with-file').
-  Multiple buffers can be saved with `save-some-buffers' (read
-  its doc string).  The addition of front matter takes place only
-  if the given file has the appropriate file type extension (per
-  the user option `denote-file-type')."
-  (interactive nil dired-mode)
+  carry out this step is performed once at the outset, unless
+  optional SKIP-FRONT-MATTER-PROMPT is non-nil (such as with a
+  universal prefix argument).  Note that the affected buffers are
+  not saved.  The user can thus check them to confirm that the
+  new front matter does not cause any problems (e.g. with the
+  command `diff-buffer-with-file').  Multiple buffers can be
+  saved with `save-some-buffers' (read its doc string).  The
+  addition of front matter takes place only if the given file has
+  the appropriate file type extension (per the user option
+  `denote-file-type')."
+  (interactive "P" dired-mode)
   (if-let ((marks (dired-get-marked-files)))
       (let ((keywords (denote-keywords-prompt)))
-        (when (yes-or-no-p "Add front matter if necessary (buffers are not 
saved)?")
+        (when (or skip-front-matter-prompt
+                  (yes-or-no-p "Add front matter if necessary (buffers are not 
saved)?"))
           (progn
             (dolist (file marks)
               (let* ((dir (file-name-directory file))



reply via email to

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