emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/denote 23e8e2202f: Simplify check for silo directory


From: ELPA Syncer
Subject: [elpa] externals/denote 23e8e2202f: Simplify check for silo directory
Date: Mon, 20 Feb 2023 23:57:37 -0500 (EST)

branch: externals/denote
commit 23e8e2202f466556a41aedbebaf88132f3c812c9
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    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/%3CB124A5AF-9968-4F7E-9F4B-2BC763E0BFCF@disroot.org%3E#%3Cm0sff0nnhb.fsf@disroot.org%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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]