[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 75d63e54e2 3/6: Ensure that 'denote' doesn't cre
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 75d63e54e2 3/6: Ensure that 'denote' doesn't create dir via Lisp |
Date: |
Sat, 16 Jul 2022 03:57:28 -0400 (EDT) |
branch: externals/denote
commit 75d63e54e2f8f3d5206578be4b82622482edcb52
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Ensure that 'denote' doesn't create dir via Lisp
---
denote.el | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/denote.el b/denote.el
index d1482e1d0f..00c04e3410 100644
--- a/denote.el
+++ b/denote.el
@@ -721,6 +721,18 @@ Optional DEFAULT-TITLE is used as the default value."
;;;;; The `denote' command
+;; TODO 2022-07-16: Should we check for an absolute path? Now it is
+;; relative, so "testing" is true if ~/testing exists when called from
+;; $HOME.
+(defun denote--path-to-directory-p (directory)
+ "Return DIRECTORY if it exists, else throw an `error'.
+This is to ensure that `denote' does not create file paths when
+called from Lisp."
+ (if (and (file-exists-p directory)
+ (file-directory-p directory))
+ directory
+ (error "`%s' does not exist; Denote will not create it; do it manually"
directory)))
+
;;;###autoload
(defun denote (&optional title keywords file-type subdirectory date)
"Create a new note with the appropriate metadata and file name.
@@ -759,7 +771,7 @@ When called from Lisp, all arguments are optional.
(current-time)
(denote--valid-date date)))
(id (format-time-string denote--id-format date))
- (denote-directory (or subdirectory (denote-directory))))
+ (denote-directory (or (denote--path-to-directory-p subdirectory)
(denote-directory))))
(denote--barf-duplicate-id id)
(denote--prepare-note (or title "") keywords nil date id)
(denote--keywords-add-to-history keywords)))
- [elpa] externals/denote updated (0ab480b628 -> d42aa0f608), ELPA Syncer, 2022/07/16
- [elpa] externals/denote d42aa0f608 6/6: Clarify point on org-capture template constraint, ELPA Syncer, 2022/07/16
- [elpa] externals/denote 511989a047 1/6: Fix reference to crm-separator in the manual, ELPA Syncer, 2022/07/16
- [elpa] externals/denote 6502817682 2/6: Make denote-link-find-file work with plain links, ELPA Syncer, 2022/07/16
- [elpa] externals/denote fbd223dfe8 5/6: Follow-up on commit 86b9022 for denote-org-capture, ELPA Syncer, 2022/07/16
- [elpa] externals/denote 75d63e54e2 3/6: Ensure that 'denote' doesn't create dir via Lisp,
ELPA Syncer <=
- [elpa] externals/denote 86b90227ed 4/6: Tweak denote-org-capture doc string, ELPA Syncer, 2022/07/16