[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote b5704da5c2 6/7: Refactor denote--file-extension
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote b5704da5c2 6/7: Refactor denote--file-extension and denote--path |
Date: |
Wed, 10 Aug 2022 00:57:41 -0400 (EDT) |
branch: externals/denote
commit b5704da5c27f1a6b6344b06fcf9b05721ef1dc63
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Refactor denote--file-extension and denote--path
- Make all parameters mandatory in denote--path.
- Add file-type parameter in denote--file-extension and use it instead
of denote-file-type.
---
denote.el | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/denote.el b/denote.el
index e99a436e0b..66b9796d0f 100644
--- a/denote.el
+++ b/denote.el
@@ -627,9 +627,9 @@ Parse `denote--retrieve-xrefs'."
;;;;; Common helpers for new notes
-(defun denote--file-extension ()
- "Return file type extension based on `denote-file-type'."
- (pcase denote-file-type
+(defun denote--file-extension (file-type)
+ "Return file type extension based on FILE-TYPE."
+ (pcase file-type
('markdown-toml ".md")
('markdown-yaml ".md")
('text ".txt")
@@ -643,7 +643,7 @@ string. EXTENSION is the file type extension, either a
string
which include the starting dot or the return value of
`denote--file-extension'."
(let ((kws (denote--keywords-combine keywords))
- (ext (or extension (denote--file-extension)))
+ (ext (or extension (denote--file-extension denote-file-type)))
(file-name (concat path id)))
(when (and title-slug (not (string-empty-p title-slug)))
(setq file-name (concat file-name "--" title-slug)))
@@ -742,16 +742,13 @@ provided by `denote'. FILETYPE is one of the values of
('org (format denote-org-front-matter title date
(denote--format-front-matter-keywords keywords 'org)
id)))))
-(defun denote--path (title keywords &optional dir id)
- "Return path to new file with TITLE and KEYWORDS.
-With optional DIR, use it instead of variable `denote-directory'.
-With optional ID, use it else format the current time."
+(defun denote--path (title keywords dir id file-type)
+ "Return path to new file with ID, TITLE, KEYWORDS and FILE-TYPE in DIR."
(denote--format-file
- (or dir (file-name-as-directory (denote-directory)))
- (or id (format-time-string denote--id-format))
+ dir id
(denote--sluggify-keywords keywords)
(denote--sluggify title)
- (denote--file-extension)))
+ (denote--file-extension file-type)))
;; Adapted from `org-hugo--org-date-time-to-rfc3339' in the `ox-hugo'
;; package: <https://github.com/kaushalmodi/ox-hugo>.
@@ -792,8 +789,7 @@ With optional DATE, use it else use the current one."
Arguments TITLE, KEYWORDS, DATE, ID, DIRECTORY, FILE-TYPE,
and TEMPLATE should be valid for note creation."
- (let* ((denote-file-type file-type)
- (path (denote--path title keywords directory id))
+ (let* ((path (denote--path title keywords directory id file-type))
(buffer (find-file path))
(header (denote--format-front-matter
title (denote--date date) keywords
@@ -2170,7 +2166,10 @@ Consult the manual for template samples."
(front-matter (denote--format-front-matter
title (denote--date nil) keywords
(format-time-string denote--id-format nil) 'org)))
- (setq denote-last-path (denote--path title keywords))
+ (setq denote-last-path
+ (denote--path title keywords
+ (file-name-as-directory (denote-directory))
+ (format-time-string denote--id-format) 'org))
(denote--keywords-add-to-history keywords)
(concat front-matter denote-org-capture-specifiers)))
- [elpa] externals/denote updated (55b4a09606 -> 82424803d0), ELPA Syncer, 2022/08/10
- [elpa] externals/denote 12dc9e23ac 1/7: Rename denote--retrieve-process-grep and denote-link-button-action, ELPA Syncer, 2022/08/10
- [elpa] externals/denote 34daa52ea3 4/7: Refactor denote--dir-in-denote-directory-p, ELPA Syncer, 2022/08/10
- [elpa] externals/denote b5704da5c2 6/7: Refactor denote--file-extension and denote--path,
ELPA Syncer <=
- [elpa] externals/denote ca6aa0d104 5/7: Make filetype parameter mandatory in denote--format-front-matter, ELPA Syncer, 2022/08/10
- [elpa] externals/denote eb1131af24 2/7: Refactor denote--format-front-matter-keywords, ELPA Syncer, 2022/08/10
- [elpa] externals/denote a992c74a71 3/7: Delete denote--prompt-symbols, ELPA Syncer, 2022/08/10
- [elpa] externals/denote 82424803d0 7/7: Merge pull request #82 from jeanphilippegg/cleanup, ELPA Syncer, 2022/08/10