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

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

[elpa] externals/denote d09249d48f 253/355: Make 'default-directory' saf


From: ELPA Syncer
Subject: [elpa] externals/denote d09249d48f 253/355: Make 'default-directory' safe for denote-directory
Date: Sun, 26 Jun 2022 23:58:30 -0400 (EDT)

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

    Make 'default-directory' safe for denote-directory
    
    This relates to the example we cover in the manual, which was updated in
    commit 47a9024.
    
    Thanks to Sven Seebeck for reporting the bug in issue 16 over at the
    GitHub mirror: <https://github.com/protesilaos/denote/issues/16>.
---
 denote.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/denote.el b/denote.el
index 811d7f1ca3..f1e7b414f7 100644
--- a/denote.el
+++ b/denote.el
@@ -96,6 +96,8 @@ If you intend to reference this variable in Lisp, consider 
using
 the function `denote-directory' instead: it returns the path as a
 directory."
   :group 'denote
+  :safe (lambda (val)
+          (and (symbolp val) (eq val 'default-directory)))
   :type 'directory)
 
 (defcustom denote-known-keywords
@@ -230,7 +232,10 @@ We consider those characters illigal for our purposes.")
 
 (defun denote-directory ()
   "Return path of variable `denote-directory' as a proper directory."
-  (let ((path denote-directory))
+  (let ((path (or (buffer-local-value 'denote-directory (current-buffer))
+                  denote-directory)))
+    (when (and (symbolp path) (eq path 'default-directory))
+      (setq path (buffer-local-value 'default-directory (current-buffer))))
     (unless (file-directory-p path)
       (make-directory path t))
     (file-name-as-directory path)))



reply via email to

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