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

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

[elpa] externals/denote 1646c43bc3 05/12: Make denote-keywords-{add, re


From: ELPA Syncer
Subject: [elpa] externals/denote 1646c43bc3 05/12: Make denote-keywords-{add, remove} honour denote-rename-no-confirm
Date: Thu, 15 Feb 2024 00:58:18 -0500 (EST)

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

    Make denote-keywords-{add,remove} honour denote-rename-no-confirm
    
    We want all commands that rename the file to conform with this use
    option. The idea is to have an "expert mode" for those who know what
    is happening and do not need to go through any further prompts or
    extra steps.
---
 README.org |  5 +++++
 denote.el  | 12 ++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/README.org b/README.org
index 7fcb748b81..6603ae2dcc 100644
--- a/README.org
+++ b/README.org
@@ -527,6 +527,11 @@ Similarly, the ~denote-keywords-remove~ removes one or 
more keywords
 from the list of existing keywords and then renames the file
 accordingly.
 
+[ The following is part of {{{development-version}}}. ]
+
+Both commands will automatically save the buffer if the user option
+~denote-rename-no-confirm~ is set to a non-nil value 
([[#h:a2ae9090-c49e-4b32-bcf5-eb8944241fd7][The ~denote-rename-no-confirm~ 
option]]).
+
 ** Create a note from the current Org subtree
 :PROPERTIES:
 :CUSTOM_ID: h:d0c7cb79-21e5-4176-a6af-f4f68578c8dd
diff --git a/denote.el b/denote.el
index a7c5f0ee91..26ead141f2 100644
--- a/denote.el
+++ b/denote.el
@@ -2384,7 +2384,10 @@ note's actual title.  At the `denote-file-prompt' type
 When called from Lisp, KEYWORDS is a list of strings.
 
 Rename the file without further prompt so that its name reflects
-the new front matter, per `denote-rename-file-using-front-matter'."
+the new front matter, per `denote-rename-file-using-front-matter'.
+
+If the user option `denote-rename-no-confirm' is non-nil, save
+the buffer.  Otherwise, leave it unsaved for further review."
   (interactive (list (denote-keywords-prompt)))
   ;; A combination of if-let and let, as we need to take into account
   ;; the scenario in which there are no keywords yet.
@@ -2396,6 +2399,7 @@ the new front matter, per 
`denote-rename-file-using-front-matter'."
                             (seq-uniq (append keywords cur-keywords)))))
         (denote-rewrite-keywords file new-keywords file-type)
         (denote-rename-file-using-front-matter file :auto-confirm)
+        (when denote-rename-no-confirm (save-buffer))
         (run-hooks 'denote-after-rename-file-hook))
     (user-error "Buffer not visiting a Denote file")))
 
@@ -2415,7 +2419,10 @@ output is sorted with `string-collate-lessp'."
 Keywords are retrieved from the file's front matter.
 
 Rename the file without further prompt so that its name reflects
-the new front matter, per `denote-rename-file-using-front-matter'."
+the new front matter, per `denote-rename-file-using-front-matter'.
+
+If the user option `denote-rename-no-confirm' is non-nil, save
+the buffer.  Otherwise, leave it unsaved for further review."
   (declare (interactive-only t))
   (interactive)
   (if-let ((file (buffer-file-name))
@@ -2428,6 +2435,7 @@ the new front matter, per 
`denote-rename-file-using-front-matter'."
          (seq-difference cur-keywords del-keyword)
          file-type)
         (denote-rename-file-using-front-matter file :auto-confirm)
+        (when denote-rename-no-confirm (save-buffer))9
         (run-hooks 'denote-after-rename-file-hook))
     (user-error "Buffer not visiting a Denote file")))
 



reply via email to

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