branch: externals/denote
commit 23e8e2202f466556a41aedbebaf88132f3c812c9
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Simplify check for silo directory
Older versions of this prototype were searching in the PATH argument
but this is no longer the case since commits 3d2e1d5, d5cf35e.
Thanks to Hilde Rhyne for pointing this out on the mailing list:
<https://lists.sr.ht/~protesilaos/denote/%[email protected]%3E#%[email protected]%3E>.
---
denote.el | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/denote.el b/denote.el
index 6bf8dbf9e5..6629b894cd 100644
--- a/denote.el
+++ b/denote.el
@@ -491,10 +491,10 @@ things accordingly.")
`(metadata (category . ,category))
(complete-with-action action candidates string pred))))
-(defun denote--silo-p (path)
- "Return path to silo if PATH is a silo."
- (when-let (((and path (file-directory-p path)))
- (dir-locals (dir-locals-find-file path)))
+(defun denote--default-directory-is-silo-p ()
+ "Return path to silo if `default-directory' is a silo."
+ (when-let ((dir-locals (dir-locals-find-file default-directory))
+ ((alist-get 'denote-directory dir-local-variables-alist)))
(cond
((listp dir-locals)
(car dir-locals))
@@ -504,7 +504,7 @@ things accordingly.")
(defun denote-directory ()
"Return path of variable `denote-directory' as a proper directory."
- (let ((path (or (denote--silo-p default-directory)
+ (let ((path (or (denote--default-directory-is-silo-p)
(when (and (stringp denote-directory)
(not (file-directory-p denote-directory)))
(make-directory denote-directory t))