summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/org-capture-config.el30
-rw-r--r--modules/org-roam-config.el22
2 files changed, 46 insertions, 6 deletions
diff --git a/modules/org-capture-config.el b/modules/org-capture-config.el
index b035752b..55a12e2f 100644
--- a/modules/org-capture-config.el
+++ b/modules/org-capture-config.el
@@ -17,7 +17,6 @@
;;; Code:
-
;; ---------------------------- Org Webpage Clipper ----------------------------
;; Allows saving a copy of the page eww is visiting for offline reading.
;; In other words, it's a "Pocket/Instapaper" that keeps the article in Emacs.
@@ -110,13 +109,34 @@ Captured On: %U"
(file+headline inbox-file "Shopping List") "* %?")
;; requires cj/org-web-clipper function defined above
- ("w" "Web Page Clipper" entry
- (file+headline inbox-file "To Read")
- "* %a\nURL: %L\nCaptured On:%U\n%(cj/org-webpage-clipper)\n"
- :prepend t :immediate-finish t)
+ ("w" "Web Page Clipper" plain
+ (function cj/org-roam-capture-webclip)
+ "" :immediate-finish t)
)) ;; end setq
) ;; end use-package org-protocol
+;; -------------------------- Org-Roam-Capture-Webclip -------------------------
+
+(defun cj/org-roam-capture-webclip ()
+ "Capture current webpage as an org-roam node with webclipped tag."
+ (let* ((url (plist-get org-store-link-plist :link))
+ (title (or (plist-get org-store-link-plist :description) ""))
+ (body (cj/org-webpage-clipper)))
+ (org-roam-capture- :node (org-roam-node-create :title title)
+ :templates '(("w" "webclip" plain "%?"
+ :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
+ "#+TITLE: ${title}
+#+FILETAGS: webclipped
+#+ROAM_KEY: ${url}
+URL: ${url}
+Captured On: %U
+
+${body}")
+ :unnarrowed t
+ :immediate-finish t))
+ :props =(:url ,url
+ :body ,body))))
+
;; ---------------------------- Simple Task Capture ----------------------------
;; the simplest way to capture a task. Also a simple way to write this function.
diff --git a/modules/org-roam-config.el b/modules/org-roam-config.el
index be0c0876..1f1524aa 100644
--- a/modules/org-roam-config.el
+++ b/modules/org-roam-config.el
@@ -23,6 +23,16 @@
'(("d" "default" plain "%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}\n")
:unnarrowed t)
+ ("w" "webclip" plain "%?"
+ :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}
+#+FILETAGS: webclipped
+#+ROAM_KEY: ${url}
+URL: ${url}
+Captured On: %U
+
+${body}")
+ :unnarrowed t
+ :immediate-finish t)
("v" "v2mom" plain
(function (lambda () (concat roam-dir "templates/v2mom.org")))
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}\n")
@@ -30,7 +40,7 @@
("r" "recipe" plain
(function (lambda () (concat roam-dir "templates/recipe.org")))
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}
- #+CATEGORY: ${title}\n#+FILETAGS: Recipe\n#+STARTUP: showall")
+ #+CATEGORY: ${title}\n#+FILETAGS: Recipe\n#+STARTUP: showall")
:unnarrowed t)
("p" "project" plain
(function (lambda () (concat roam-dir "templates/project.org")))
@@ -49,6 +59,7 @@
("C-c n r" . cj/org-roam-find-node-recipe)
("C-c n t" . cj/org-roam-find-node-topic)
("C-c n i" . org-roam-node-insert)
+ ("C-c n w" . cj/org-roam-find-node-webclip)
:map org-mode-map
("C-M-i" . completion-at-point)
:map org-roam-dailies-map
@@ -140,6 +151,15 @@ created nodes are added to the agenda and follow a template defined by
(interactive)
(cj/org-roam-find-node "Project" "p" (concat roam-dir "templates/project.org")))
+(defun cj/org-roam-find-node-webclip ()
+ "List nodes of type 'webclipped' in completing read for selection."
+ (interactive)
+ (org-roam-node-find
+ nil
+ nil
+ (cj/org-roam-filter-by-tag "webclipped")
+ nil))
+
;; ---------------------- Org Capture After Finalize Hook ----------------------
(defun cj/org-roam-add-node-to-agenda-files-finalize-hook ()