[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 8eb27246a5 267/355: Refine buffer-local 'denote-
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 8eb27246a5 267/355: Refine buffer-local 'denote-directory'; update doc |
Date: |
Sun, 26 Jun 2022 23:58:31 -0400 (EDT) |
branch: externals/denote
commit 8eb27246a51197306bcc5928b36ffff127c87f36
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Refine buffer-local 'denote-directory'; update doc
---
README.org | 15 ++++++++-------
denote.el | 22 +++++++++++++++-------
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/README.org b/README.org
index 9e9867a570..019b51a959 100644
--- a/README.org
+++ b/README.org
@@ -919,13 +919,14 @@ default used by regular ~denote~.
Given Denote's composable code, you can tweak the output however you
like, including the contents of the file
([[#h:f69371d5-1843-493d-9ff5-c1ab3b43024e][Tweaking the front matter]]).
-If you do place different types of notes in their own directories,
-consider introducing directory-local variables to keep things working
-seamlessly. An obvious candidate for such a local variable is the
-~denote-directory~: you want notes in =~/Documents/blog/= to treat their
-directory as the canonical one; while those in =~/Documents/random/= to
-do the same for that path. Write a =.dir-locals.el= file with the
-following contents and place it in each of those directories:
+If you do place different types of notes in their own directories, you
+must introduce directory-local variables to keep things working
+seamlessly. Otherwise you cannot create notes, retrieve backlinks, and
+so on. To that end, the ~denote-directory~ variable considers the
+symbols =default-directory= or =local= as safe local variables. Write a
+=.dir-locals.el= file in each of your non-default notes directories with
+the following contents (replacing =default-directory= with =local=, if
+you prefer):
#+begin_src emacs-lisp
;;; Directory Local Variables
diff --git a/denote.el b/denote.el
index cb10570415..a5816179ff 100644
--- a/denote.el
+++ b/denote.el
@@ -90,14 +90,23 @@
;;;; User options
+;; About the autoload: (info "(elisp) File Local Variables")
+
+;;;###autoload (put 'denote-directory 'safe-local-variable (lambda (val) (or
(eq val 'local) (eq val 'default-directory))))
(defcustom denote-directory (expand-file-name "~/Documents/notes/")
"Directory for storing personal notes.
+
+A safe local value of either `default-directory' or `local' can
+be added as a value in a .dir-local.el file. Do this if you
+intend to use multiple directories for your notes while still
+relying on a global value (which is the value of this variable).
+The Denote manual has a sample (search for '.dir-locals.el').
+
If you intend to reference this variable in Lisp, consider using
the function `denote-directory' instead: it returns the path as a
-directory."
+directory and also checks if a safe local value should be used."
:group 'denote
- :safe (lambda (val)
- (and (symbolp val) (eq val 'default-directory)))
+ :safe (lambda (val) (or (eq val 'local) (eq val 'default-directory)))
:type 'directory)
(defcustom denote-known-keywords
@@ -232,10 +241,9 @@ We consider those characters illigal for our purposes.")
(defun denote-directory ()
"Return path of variable `denote-directory' as a proper 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))))
+ (let* ((val (or (buffer-local-value 'denote-directory (current-buffer))
+ denote-directory))
+ (path (if (or (eq val 'default-directory) (eq val 'local))
default-directory val)))
(unless (file-directory-p path)
(make-directory path t))
(file-name-as-directory path)))
- [elpa] externals/denote 5213c9e7af 241/355: Add section with alternatives to Denote, (continued)
- [elpa] externals/denote 5213c9e7af 241/355: Add section with alternatives to Denote, ELPA Syncer, 2022/06/27
- [elpa] externals/denote e0ff114a93 238/355: Update Denote sources in manual's introduction, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 7ce2f7d3e3 251/355: Use the 'denote-directory' function, not variable, ELPA Syncer, 2022/06/27
- [elpa] externals/denote c8f3e707c2 223/355: Revise one-line descriptions, where needed, ELPA Syncer, 2022/06/27
- [elpa] externals/denote a436cdf07e 221/355: Tweak doc strings, ELPA Syncer, 2022/06/27
- [elpa] externals/denote a5940b315a 265/355: Replace needless 'let*' with 'let', ELPA Syncer, 2022/06/27
- [elpa] externals/denote 5686e86cfc 262/355: Only show valid notes in file prompt, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 3d606cbe95 272/355: Simplify completion via 'org-insert-link', ELPA Syncer, 2022/06/27
- [elpa] externals/denote f21a99775d 256/355: Improve rename prompt; only rename regular files, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 941258d8d4 263/355: Remove faulty MUSTMATCH from file prompt, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 8eb27246a5 267/355: Refine buffer-local 'denote-directory'; update doc,
ELPA Syncer <=
- [elpa] externals/denote 385c7e9689 287/355: Clarify use of uspecified face attribute, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 90875d5419 233/355: Sort backlinks from oldest to newest, ELPA Syncer, 2022/06/27
- [elpa] externals/denote efd9d537cd 278/355: Give appropriate name to backlink button object, ELPA Syncer, 2022/06/27
- [elpa] externals/denote a062d9a351 294/355: Update link-related docs (cover buttonization), ELPA Syncer, 2022/06/27
- [elpa] externals/denote 750f8bf95c 307/355: Add FAQ about handling "last modified" scenario, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 627250dc0b 306/355: Make minor rewordings or clarifications to FAW, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 2e13b3451d 347/355: Update denote-link.el Commentary section, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 2d3a6fd8f3 327/355: Reword comment about multi-line button recognition, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 80eb7528aa 335/355: doc: Update documentation, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 0fac78ada3 338/355: Refine how link format for target is done, ELPA Syncer, 2022/06/27