[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 7ccddb5837 6/9: Add signature parameter to denot
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 7ccddb5837 6/9: Add signature parameter to denote--format-front-matter |
Date: |
Sun, 3 Nov 2024 03:57:45 -0500 (EST) |
branch: externals/denote
commit 7ccddb58370e0ea42c87909519eaee82c244e7e4
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Add signature parameter to denote--format-front-matter
---
denote.el | 22 ++++++++++++----------
tests/denote-test.el | 16 ++++++++--------
2 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/denote.el b/denote.el
index 822cce8fe0..ae4eba5f3a 100644
--- a/denote.el
+++ b/denote.el
@@ -1793,17 +1793,19 @@ this list for new note creation. The default is
`org'.")
"Return all `denote-file-types' keys."
(delete-dups (mapcar #'car denote-file-types)))
-(defun denote--format-front-matter (title date keywords id filetype)
+(defun denote--format-front-matter (title date keywords id signature filetype)
"Front matter for new notes.
-TITLE and ID are strings. DATE is a date object. KEYWORDS is a list of
-strings. FILETYPE is one of the values of variable `denote-file-type'."
+TITLE, SIGNATURE, and ID are strings. DATE is a date object. KEYWORDS
+is a list of strings. FILETYPE is one of the values of variable
+`denote-file-type'."
(let* ((fm (denote--front-matter filetype))
(title-string (funcall (denote--title-value-function filetype) title))
(date-string (denote--date date filetype))
(keywords-string (funcall (denote--keywords-value-function filetype)
(denote-sluggify-keywords keywords)))
- (id-string (funcall (denote--identifier-value-function filetype) id)))
- (if fm (format fm title-string date-string keywords-string id-string) "")))
+ (id-string (funcall (denote--identifier-value-function filetype) id))
+ (signature-string (funcall (denote--signature-value-function
filetype) (denote-sluggify-signature signature))))
+ (if fm (format fm title-string date-string keywords-string id-string
signature-string) "")))
;;;; Front matter or content retrieval functions
@@ -2121,7 +2123,7 @@ TEMPLATE, and SIGNATURE should be valid for note
creation."
(let* ((path (denote-format-file-name
directory id keywords title (denote--file-extension file-type)
signature))
(buffer (find-file path))
- (header (denote--format-front-matter title date keywords id
file-type)))
+ (header (denote--format-front-matter title date keywords id signature
file-type)))
(when (file-regular-p path)
(user-error "A file named `%s' already exists" path))
(with-current-buffer buffer
@@ -2931,7 +2933,7 @@ If a buffer is visiting the file, its name is updated."
The TITLE, KEYWORDS ID, 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-to-time id) keywords id file-type)))
+ (when-let* ((new-front-matter (denote--format-front-matter title
(date-to-time id) keywords id "" file-type)))
(with-current-buffer (find-file-noselect file)
(goto-char (point-min))
(insert new-front-matter))))
@@ -2964,7 +2966,7 @@ With optional SAVE-BUFFER, save the buffer corresponding
to FILE.
This function is for use in the commands `denote-keywords-add',
`denote-keywords-remove', `denote-dired-rename-files', or
related."
- (let* ((new-front-matter (denote--format-front-matter "" (current-time)
keywords "" file-type))
+ (let* ((new-front-matter (denote--format-front-matter "" (current-time)
keywords "" "" file-type))
(new-keywords-line
(denote--retrieve-front-matter-keywords-line-from-content new-front-matter
file-type)))
(with-current-buffer (find-file-noselect file)
(save-excursion
@@ -2988,7 +2990,7 @@ prompt to confirm the rewriting of the front matter.
Otherwise
produce a `y-or-n-p' prompt to that effect."
(when-let* ((old-title-line (denote-retrieve-front-matter-title-line file
file-type))
(old-keywords-line (denote-retrieve-front-matter-keywords-line
file file-type))
- (new-front-matter (denote--format-front-matter title
(current-time) keywords "" file-type))
+ (new-front-matter (denote--format-front-matter title
(current-time) keywords "" "" file-type))
(new-title-line
(denote--retrieve-front-matter-title-line-from-content new-front-matter
file-type))
(new-keywords-line
(denote--retrieve-front-matter-keywords-line-from-content new-front-matter
file-type)))
(with-current-buffer (find-file-noselect file)
@@ -5108,7 +5110,7 @@ Consult the manual for template samples."
(`(,title ,keywords _ ,directory ,date ,template ,signature)
(denote--creation-prepare-note-data title keywords 'org
directory date template signature))
(id (denote--find-first-unused-id (denote-get-identifier date)))
- (front-matter (denote--format-front-matter title date keywords
id 'org))
+ (front-matter (denote--format-front-matter title date keywords
id signature 'org))
(template-string (cond ((stringp template) template)
((functionp template) (funcall template))
(t (user-error "Invalid template")))))
diff --git a/tests/denote-test.el b/tests/denote-test.el
index e3e05689ff..f599773db9 100644
--- a/tests/denote-test.el
+++ b/tests/denote-test.el
@@ -178,7 +178,7 @@ Extend what we do in
`denote-test--denote-file-type-extensions'."
(ert-deftest denote-test--denote--format-front-matter ()
"Test that `denote--format-front-matter' formats front matter correctly."
(let ((denote-date-format "%Y-%m-%d"))
- (should (and (equal (denote--format-front-matter "" (date-to-time
"20240101T120000") '("") "" 'text)
+ (should (and (equal (denote--format-front-matter "" (date-to-time
"20240101T120000") '("") "" "" 'text)
(mapconcat #'identity
'("title: "
"date: 2024-01-01"
@@ -190,7 +190,7 @@ Extend what we do in
`denote-test--denote-file-type-extensions'."
(equal
(denote--format-front-matter
"Some test" (date-to-time "2023-06-05") '("one" "two")
- "20230605T102234" 'text)
+ "20230605T102234" "sig" 'text)
(mapconcat #'identity
'("title: Some test"
"date: 2023-06-05"
@@ -199,7 +199,7 @@ Extend what we do in
`denote-test--denote-file-type-extensions'."
"---------------------------\n\n")
"\n"))))
- (should (and (equal (denote--format-front-matter "" (date-to-time
"20240101T120000") nil "" 'org)
+ (should (and (equal (denote--format-front-matter "" (date-to-time
"20240101T120000") nil "" "" 'org)
(mapconcat #'identity
'("#+title: "
"#+date: 2024-01-01"
@@ -211,7 +211,7 @@ Extend what we do in
`denote-test--denote-file-type-extensions'."
(equal
(denote--format-front-matter
"Some test" (date-to-time "2023-06-05") '("one" "two")
- "20230605T102234" 'org)
+ "20230605T102234" "sig" 'org)
(mapconcat #'identity
'("#+title: Some test"
"#+date: 2023-06-05"
@@ -220,7 +220,7 @@ Extend what we do in
`denote-test--denote-file-type-extensions'."
"\n")
"\n"))))
- (should (and (equal (denote--format-front-matter "" (date-to-time
"20240101T120000") nil "" 'markdown-yaml)
+ (should (and (equal (denote--format-front-matter "" (date-to-time
"20240101T120000") nil "" "" 'markdown-yaml)
(mapconcat #'identity
'("---"
"title: \"\""
@@ -234,7 +234,7 @@ Extend what we do in
`denote-test--denote-file-type-extensions'."
(equal
(denote--format-front-matter
"Some test" (date-to-time "2023-06-05") '("one" "two")
- "20230605T102234" 'markdown-yaml)
+ "20230605T102234" "sig" 'markdown-yaml)
(mapconcat #'identity
'("---"
"title: \"Some test\""
@@ -245,7 +245,7 @@ Extend what we do in
`denote-test--denote-file-type-extensions'."
"\n")
"\n"))))
- (should (and (equal (denote--format-front-matter "" (date-to-time
"20240101T120000") nil "" 'markdown-toml)
+ (should (and (equal (denote--format-front-matter "" (date-to-time
"20240101T120000") nil "" "" 'markdown-toml)
(mapconcat #'identity
'("+++"
"title = \"\""
@@ -259,7 +259,7 @@ Extend what we do in
`denote-test--denote-file-type-extensions'."
(equal
(denote--format-front-matter
"Some test" (date-to-time "2023-06-05") '("one" "two")
- "20230605T102234" 'markdown-toml)
+ "20230605T102234" "sig" 'markdown-toml)
(mapconcat #'identity
'("+++"
"title = \"Some test\""
- [elpa] externals/denote updated (f3ac69fcd3 -> 0ea4d88a59), ELPA Syncer, 2024/11/03
- [elpa] externals/denote af2e6a33a3 1/9: Add denote--retrieve-front-matter-*-from-content functions, ELPA Syncer, 2024/11/03
- [elpa] externals/denote 6446650c36 3/9: Make date parameter a date object in denote--format-front-matter, ELPA Syncer, 2024/11/03
- [elpa] externals/denote bd50fbba94 5/9: Remove denote--front-matter-{title/keywords} functions, ELPA Syncer, 2024/11/03
- [elpa] externals/denote 0ea4d88a59 9/9: Merge pull request #472 from jeanphilippegg/front-matter-functions, ELPA Syncer, 2024/11/03
- [elpa] externals/denote f0908dbcc1 2/9: Remove denote--get-{title/keywords}-line-from-front-matter functions, ELPA Syncer, 2024/11/03
- [elpa] externals/denote 4cd24c9730 4/9: Format identifier in denote--format-front-matter, ELPA Syncer, 2024/11/03
- [elpa] externals/denote 7ccddb5837 6/9: Add signature parameter to denote--format-front-matter,
ELPA Syncer <=
- [elpa] externals/denote 4fdae80128 8/9: Refactor denote-rename-file-using-front-matter, ELPA Syncer, 2024/11/03
- [elpa] externals/denote 512672e173 7/9: Add signature parameter to denote--add-front-matter, ELPA Syncer, 2024/11/03