Skip to content

Commit 9a9748c

Browse files
committed
tweak(notes): better org-roam protocol handling
1 parent 1eaa535 commit 9a9748c

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

modules/me-notes.el

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,31 @@
1515
"f" #'org-roam-node-find
1616
"r" #'org-roam-ref-find
1717
"i" #'org-roam-node-insert
18-
"R" #'org-roam-node-random))
18+
"R" #'org-roam-node-random
19+
"B" #'org-roam-buffer-display-dedicated))
20+
21+
(use-package org-roam-protocol
22+
:after org-roam
23+
:demand t
24+
:custom
25+
(org-roam-protocol-store-links t)
26+
;; Add this as bookmarklet in your browser
27+
;; javascript:location.href='org-protocol://roam-ref?template=r&ref=%27+encodeURIComponent(location.href)+%27&title=%27+encodeURIComponent(document.title)+%27&body=%27+encodeURIComponent(window.getSelection())
28+
(org-roam-capture-ref-templates
29+
'(("r" "ref" plain "%?"
30+
:if-new (file+head "web/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+created: %U\n\n${body}\n")
31+
:unnarrowed t)))
32+
:config
33+
;; Save a local snapshot of the captured web page using "single-file-cli"
34+
(advice-add
35+
'org-roam-protocol-open-ref :after
36+
(defun +org-roam-protocol--single-file-snapshot-a (info)
37+
(+single-file
38+
(plist-get info :ref)
39+
(+file-name-incremental
40+
(expand-file-name
41+
(concat "web/snapshots/" (+clean-file-name (plist-get info :title)) ".html")
42+
org-roam-directory))))))
1943

2044
(use-package org-roam-ui
2145
:straight t
@@ -24,8 +48,6 @@
2448

2549
(use-package consult-org-roam
2650
:straight t
27-
:after org-roam
28-
:demand t
2951
:init
3052
(+map! :infix "n"
3153
"s" #'consult-org-roam-search

0 commit comments

Comments
 (0)