summaryrefslogtreecommitdiff
path: root/lisp/ss-denote.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ss-denote.el')
-rw-r--r--lisp/ss-denote.el49
1 files changed, 49 insertions, 0 deletions
diff --git a/lisp/ss-denote.el b/lisp/ss-denote.el
new file mode 100644
index 0000000..65b9b53
--- /dev/null
+++ b/lisp/ss-denote.el
@@ -0,0 +1,49 @@
+;;; ss-denote.el --- Denote configuration -*- lexical-binding: t; -*-
+
+;;; Commentary:
+
+;; Durable note creation and Denote integration.
+
+;;; Code:
+
+(require 'ss-core)
+
+(declare-function denote-keywords-prompt "denote")
+(declare-function denote-org-capture "denote")
+(declare-function denote-org-capture-with-prompts "denote")
+
+(defun ss-denote-capture-in-directory (directory &optional keywords &rest prompts)
+ "Start a Denote Org capture in DIRECTORY with KEYWORDS and PROMPTS.
+If PROMPTS is empty, rely on `denote-prompts'."
+ (let* ((prompt-for-keywords (memq :keywords prompts))
+ (directory (ss-require-existing-directory directory))
+ (denote-directory directory)
+ (denote-use-directory (unless (memq :subdirectory prompts) directory))
+ (denote-use-keywords
+ (if prompt-for-keywords
+ (delete-dups (append keywords (denote-keywords-prompt)))
+ keywords)))
+ (if prompts
+ (denote-org-capture-with-prompts
+ (memq :title prompts)
+ nil
+ (memq :subdirectory prompts)
+ (memq :date prompts)
+ (memq :template prompts))
+ (denote-org-capture))))
+
+(defun ss-denote-setup ()
+ "Initialize Denote."
+ (use-package denote
+ :ensure t
+ :after org
+ :config
+ (setq denote-directory ss-org-directory
+ denote-known-keywords '("project")
+ denote-prompts '(title keywords)
+ denote-org-capture-specifiers "%?")
+ (denote-rename-buffer-mode 1)))
+
+(provide 'ss-denote)
+
+;;; ss-denote.el ends here