branch: externals/denote commit 97d866ee6d483c81d74f4816330291e16b7c6831 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Replace denote--add-front-matter with denote-prepend-front-matter --- README.org | 7 +++++++ denote.el | 17 +++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README.org b/README.org index de8604a625..5abc987fa5 100644 --- a/README.org +++ b/README.org @@ -5975,6 +5975,13 @@ might change them without further notice. + Function ~denote-rename-file-and-buffer~ :: Rename file named =OLD-NAME= to =NEW-NAME=, updating buffer name. +#+findex: denote-prepend-front-matter ++ Function ~denote-prepend-front-matter~ :: Prepend front matter to + =FILE=. The =TITLE=, =KEYWORDS=, =DATE=, =ID=, =SIGNATURE=, and + =FILE-TYPE= are passed from the renaming command and are used to + construct a new front matter block if appropriate. [ This function + is available as part of {{{development-version}}}. ] + #+findex: denote-rewrite-front-matter + Function ~denote-rewrite-front-matter~ :: Rewrite front matter of note after ~denote-rename-file~ (or related) The =FILE=, =TITLE=, diff --git a/denote.el b/denote.el index 4fd638bc3b..d5b43faf04 100644 --- a/denote.el +++ b/denote.el @@ -3101,11 +3101,16 @@ If a buffer is visiting the file, its name is updated." (with-current-buffer buffer (set-visited-file-name new-name nil t))))) -(defun denote--add-front-matter (file title keywords signature date id file-type) +(define-obsolete-function-alias + 'denote--add-front-matter + 'denote-prepend-front-matter + "3.2.0") + +(defun denote-prepend-front-matter (file title keywords signature date id file-type) "Prepend front matter to FILE. -The TITLE, KEYWORDS, DATE, ID, SIGNATURE, and FILE-TYPE are passed from the -renaming command and are used to construct a new front matter block if -appropriate." +The TITLE, KEYWORDS, DATE, ID, SIGNATURE, and FILE-TYPE are passed from +the renaming command and are used to construct a new front matter block +if appropriate." (when-let* ((new-front-matter (denote--format-front-matter title date keywords id signature file-type))) (with-current-buffer (find-file-noselect file) (goto-char (point-min)) @@ -3462,7 +3467,7 @@ Respect `denote-rename-confirmations', `denote-save-buffers' and (if (denote--file-has-front-matter-p new-name file-type) (denote-rewrite-front-matter new-name title keywords signature date id file-type) (when (denote-add-front-matter-prompt new-name) - (denote--add-front-matter new-name title keywords signature date id file-type)))) + (denote-prepend-front-matter new-name title keywords signature date id file-type)))) (when (and denote--used-ids (not (string-empty-p id))) (puthash id t denote--used-ids)) (denote--handle-save-and-kill-buffer 'rename new-name initial-state) @@ -4006,7 +4011,7 @@ Construct the file name in accordance with the user option (denote-update-dired-buffers) (when (and (denote-file-is-writable-and-supported-p new-name) (denote-add-front-matter-prompt new-name)) - (denote--add-front-matter new-name title keywords signature date id new-file-type) + (denote-prepend-front-matter new-name title keywords signature date id new-file-type) (denote--handle-save-and-kill-buffer 'rename new-name initial-state))))) ;;;; The Denote faces