branch: externals/denote
commit 8bd602b8634e487e787c0d0c3b6a76ebcba25bb6
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>

    Make obsolete the command 'denote-add-front-matter'
    
    This is due to refinements made by Jean-Philippe Gagné Guay to the
    file renaming mechanism. We discussed this deprecation in issue 498:
    <https://github.com/protesilaos/denote/issues/498>.
---
 README.org | 49 +++++--------------------------------------------
 denote.el  | 60 +-----------------------------------------------------------
 2 files changed, 6 insertions(+), 103 deletions(-)

diff --git a/README.org b/README.org
index 4004f9ddad..1a3b294748 100644
--- a/README.org
+++ b/README.org
@@ -2650,50 +2650,11 @@ we shall act accordingly.
 :CUSTOM_ID: h:54b48277-e0e5-4188-ad54-ef3db3b7e772
 :END:
 
-[ As part of {{{development-version}}}, the ~denote-add-front-matter~
-  is for interactive use only. It is no longer possible to call it
-  from Lisp with the arguments =FILE=, =TITLE=, =KEYWORDS=, and
-  =SIGNATURE=. For this purpose, use the functions
-  ~denote-prepend-front-matter~, ~denote-rewrite-front-matter~. ]
-
-#+findex: denote-add-front-matter
-Sometimes the user needs to produce new front matter for an existing
-note. Perhaps because they accidentally deleted a line and could not
-undo the operation. The command ~denote-add-front-matter~ can be used
-for this very purpose.
-
-It inserts front matter at the top of the current file if it is a
-Denote note.
-
-If front matter exists, fully or in part, it rewrites it. Else it
-prepends a new block to the current file.
-
-To prepare the new front matter, it prompts for title, keywords, and
-signature. It does so depending on if those are part of the current
-file ([[#h:4e9c7512-84dc-4dfb-9fa9-e15d51178e5d][The file-naming scheme]]). It 
thus skips the prompt for any
-missing file name component.
-
-At each prompt, it uses the current value of the given file name
-component as the default text in the minibuffer. For the title in
-particular, it reads from the existing front matter to get the
-human-readable version. Otherwise, it reads from the file name.
-
-It does not write the value of the given file name component if the
-minibuffer input is empty.
-
-Whatever the case, it does not rename the file upon completing the
-operation. This is the task of ~denote-rename-file~ or, more probably
-for this case, ~denote-rename-file-using-front-matter~, among others
-([[#h:532e8e2a-9b7d-41c0-8f4b-3c5cbb7d4dca][Renaming files]]).
-
-[ NOTE: Please check with your minibuffer user interface how to
-  provide an empty input. The Emacs default setup accepts the empty
-  minibuffer contents as they are, though popular packages like
-  ~vertico~ use the first available completion candidate instead. For
-  ~vertico~, the user must either move one up to select the prompt and
-  then type =RET= there with empty contents, or use the command
-  ~vertico-exit-input~ with empty contents. That Vertico command is
-  bound to =M-RET= as of this writing on 2024-02-29 09:24 +0200. ]
+As part of version 3.2.0 (currently {{{development-version}}}), the
+command ~denote-add-front-matter~ is superseded by
+~denote-rename-file~ and related 
([[#h:532e8e2a-9b7d-41c0-8f4b-3c5cbb7d4dca][Renaming files]]). Those commands 
will
+add missing front matter or rewrite the modified lines of existing
+front matter.
 
 * Linking notes
 :PROPERTIES:
diff --git a/denote.el b/denote.el
index 2108ddf29f..a23234dc9e 100644
--- a/denote.el
+++ b/denote.el
@@ -3919,65 +3919,7 @@ they have front matter and what that may be."
 
 ;;;;; Creation of front matter
 
-;;;###autoload
-(defun denote-add-front-matter ()
-  "Insert front matter at the top of the current file if it is a Denote note.
-
-If front matter exists, fully or in part, rewrite it.  Else prepend a
-new block to the current file.
-
-To prepare the new front matter, prompt for title, keywords, and
-signature.  Do it depending on if those are part of the current file.
-Skip the prompt for any missing file name component.
-
-At each prompt, use the current value of the given file name component
-as the default text in the minibuffer.  For the title in particular,
-read from the existing front matter to get the human-readable version.
-Otherwise, read from the file name.
-
-Do not write the value of the given file name component if the
-minibuffer input is empty.
-
-Whatever the case, do not rename the file upon completing the operation.
-This is the task of `denote-rename-file' or, more probably for this
-case, `denote-rename-file-using-front-matter', among others.
-
-[ NOTE: Please check with your minibuffer user interface how to
-  provide an empty input.  The Emacs default setup accepts the
-  empty minibuffer contents as they are, though popular packages
-  like `vertico' use the first available completion candidate
-  instead.  For `vertico', the user must either move one up to
-  select the prompt and then type RET there with empty contents,
-  or use the command `vertico-exit-input' with empty contents.
-  That Vertico command is bound to M-RET as of this writing on
-  2024-02-29 09:24 +0200. ]"
-  (declare (advertised-calling-convention nil "3.1.0")
-           (interactive-only t))
-  (interactive nil text-mode)
-  (let* ((file buffer-file-name)
-         (titlep (denote-retrieve-filename-title file))
-         (keywordsp (denote-retrieve-filename-keywords file))
-         (signaturep (denote-retrieve-filename-signature file))
-         (file-type (denote-filetype-heuristics file))
-         (default-title (when titlep (or (denote-retrieve-title-value file 
file-type) titlep "")))
-         (default-keywords (when keywordsp (string-join 
(denote-retrieve-filename-keywords-as-list file) ",")))
-         (default-signature (or signaturep ""))
-         (title (if titlep
-                    (denote-title-prompt default-title "Add TITLE (empty to 
ignore)")
-                  ""))
-         (keywords (if keywordsp
-                       (denote-keywords-sort (denote-keywords-prompt "Add 
KEYWORDS (empty to ignore)" default-keywords))
-                     ""))
-         (signature (if signaturep
-                        (denote-signature-prompt default-signature "Add 
SIGNATURE (empty to ignore)")
-                      "")))
-    (when-let* ((denote-file-is-writable-and-supported-p file)
-                (id (denote-retrieve-filename-identifier file))
-                (date (date-to-time id)))
-      (if (denote--file-has-front-matter-p file file-type)
-          (denote-rewrite-front-matter file title keywords signature date id 
file-type)
-        (denote-prepend-front-matter file title keywords signature date id 
file-type)))))
-
+(make-obsolete 'denote-add-front-matter nil "Use `denote-rename-file' or 
related. Starting with version 3.2.0.")
 
 ;;;###autoload
 (defun denote-change-file-type-and-front-matter (file new-file-type)

Reply via email to