branch: externals/denote
commit 8167d0c30c677b11e265fd50f4348611be7fd819
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Revert "Stop recording the file path in the front matter"
This reverts commit cfe6e98e7ba3b2779e4748dac92919dee6c21c96.
We actually need it for making links. Perhaps we can find a way to only
rely on the identifier. Will need to check this further.
---
denote.el | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/denote.el b/denote.el
index 01d17297b8..639715639b 100644
--- a/denote.el
+++ b/denote.el
@@ -288,16 +288,18 @@ is specified."
(ext (or extension ".org")))
(format "%s%s--%s--%s%s" path id kws slug ext)))
-(defun denote--file-meta-header (title date keywords id)
+(defun denote--file-meta-header (title date keywords filename id)
"Front matter for new notes.
-TITLE, DATE, KEYWORDS, and ID are all strings which are provided
- by `denote-new-note'."
+TITLE, DATE, KEYWORDS, FILENAME, ID are all strings which are
+ provided by `denote-new-note'."
(let ((kw (denote--keywords-capitalize keywords)))
(concat "#+title: " title "\n"
"#+date: " date "\n"
"#+filetags: " kw "\n"
"#+identifier: " id "\n"
+ "#+filename: " (string-remove-prefix denote-directory filename)
"\n"
+ "#+path: " filename "\n"
"\n\n")))
(defun denote--path (title keywords)
@@ -323,11 +325,11 @@ Format current time, else use optional ID."
(defun denote--prepare-note (title keywords &optional path)
"Use TITLE and KEYWORDS to prepare new note file.
Use optional PATH, else create it with `denote--path'."
- (let* ((default-directory denote-directory)
- (p (or path (denote--path title keywords)))
+ (let* ((p (or path (denote--path title keywords)))
+ (default-directory denote-directory)
(buffer (unless path (find-file p)))
(header (denote--file-meta-header
- title (denote--date) keywords
+ title (denote--date) keywords p
(format-time-string denote--id))))
(unless path
(with-current-buffer buffer (insert header))