~protesilaos/denote

* denote.el (denote-directory): Use 'xdg-user-dir' v1 APPLIED

Philip Kaludercic: 2
 * denote.el (denote-directory): Use 'xdg-user-dir'
 Add a major mode for backlink buffers

 2 files changed, 13 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~protesilaos/denote/patches/34561/mbox | git am -3
Learn more about email & git

[PATCH 1/2] * denote.el (denote-directory): Use 'xdg-user-dir' Export this patch

---
 denote.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/denote.el b/denote.el
index 5ffc6b9..0357789 100644
--- a/denote.el
+++ b/denote.el
@@ -98,6 +98,7 @@
(require 'seq)
(require 'xref)
(require 'dired)
(require 'xdg)
(eval-when-compile (require 'subr-x))

(defgroup denote ()
@@ -109,7 +110,7 @@
;; 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/")
(defcustom denote-directory (expand-file-name "notes" (xdg-user-dir "DOCUMENTS"))
  "Directory for storing personal notes.

A safe local value of either `default-directory' or `local' can
-- 
2.37.1

[PATCH 2/2] Add a major mode for backlink buffers Export this patch

* denote.el (denote-backlink-mode-map): Add new map for 'denote-backlink-mode'.
(denote-backlink-mode): Add new mode that derives from 'special-mode'.
(denote-link--prepare-backlinks): Use 'denote-backlink-mode'.
---
 denote.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/denote.el b/denote.el
index 0357789..791145a 100644
--- a/denote.el
+++ b/denote.el
@@ -1895,6 +1895,16 @@ Expand `denote-link-backlinks-display-buffer-action'."
   buf
   `(,@denote-link-backlinks-display-buffer-action)))

(defvar denote-backlink-mode-map
  (let ((m (make-sparse-keymap)))
    (define-key m "n" #'forward-button)
    (define-key m "p" #'backward-button)
    m)
  "Keymap for `denote-backlink-mode'.")

(define-derived-mode denote-backlink-mode special-mode "Backlinks"
  "Major mode for backlinks buffers.")

(defun denote-link--prepare-backlinks (id files &optional title)
  "Create backlinks' buffer for ID including FILES.
Use optional TITLE for a prettier heading."
@@ -1903,7 +1913,7 @@ Use optional TITLE for a prettier heading."
    (with-current-buffer (get-buffer-create buf)
      (setq-local default-directory (denote-directory))
      (erase-buffer)
      (special-mode)
      (denote-backlink-mode)
      (goto-char (point-min))
      (when-let* ((title)
                  (heading (format "Backlinks to %S (%s)" title id))
-- 
2.37.1