mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
Initial extract
This commit is contained in:
14
README.org
Normal file
14
README.org
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
* Org-roam
|
||||||
|
|
||||||
|
Rudimentary Roam replica in org-mode. Dependent on deft being setup properly.
|
||||||
|
|
||||||
|
** Usage
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package org-roam
|
||||||
|
:after deft org
|
||||||
|
:straight (:host "github" :repo "jethrokuan/org-roam")
|
||||||
|
:bind
|
||||||
|
("C-c n l" . org-roam-get-linked-files)
|
||||||
|
("C-c n i" . org-roam-insert))
|
||||||
|
#+end_src
|
27
org-roam.el
Normal file
27
org-roam.el
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
(require 'deft)
|
||||||
|
|
||||||
|
(defcustom org-roam-zettel-indicator "§"
|
||||||
|
"Indicator in front of a zettel.")
|
||||||
|
|
||||||
|
(defun org-roam-insert (file-name)
|
||||||
|
"Finds a file, inserts it as a link with the base file name as the link name, and adds the zd-link-indicator I use to the front."
|
||||||
|
(interactive (list (completing-read "File: " (deft-find-all-files-no-prefix))))
|
||||||
|
(let ((org-link-file-type 'relative))
|
||||||
|
(org-insert-link nil (concat "file:" (concat deft-directory file-name))
|
||||||
|
(concat org-roam-zettel-indicator (file-name-base file-name)))))
|
||||||
|
|
||||||
|
(defun org-roam-get-linked-files ()
|
||||||
|
"Show links to this file."
|
||||||
|
(interactive)
|
||||||
|
(let* ((search-term (file-name-nondirectory buffer-file-name))
|
||||||
|
(files deft-all-files)
|
||||||
|
(tnames (mapcar #'file-truename files)))
|
||||||
|
(multi-occur
|
||||||
|
(mapcar (lambda (x)
|
||||||
|
(with-current-buffer
|
||||||
|
(or (get-file-buffer x) (find-file-noselect x))
|
||||||
|
(widen)
|
||||||
|
(current-buffer)))
|
||||||
|
files)
|
||||||
|
search-term
|
||||||
|
3)))
|
Reference in New Issue
Block a user