201 lines
7.1 KiB
EmacsLisp
201 lines
7.1 KiB
EmacsLisp
;;; roam.el -*- lexical-binding: t; -*-
|
|
|
|
(after! org-roam
|
|
(setq org-roam-capture-templates
|
|
'(("m" "main" plain
|
|
"%?"
|
|
:target
|
|
(file+head
|
|
"main/${slug}.org"
|
|
"#+title: ${title}\n")
|
|
:unnarrowed t)
|
|
("c" "cheatsheet" plain
|
|
"%?"
|
|
:target
|
|
(file+head
|
|
"cheatsheet/${slug}.org"
|
|
"#+title: ${title}\n")
|
|
:unnarrowed t)
|
|
("w" "worksheet" plain
|
|
"%?"
|
|
:target
|
|
(file+head
|
|
"worksheet/${slug}.org"
|
|
"#+title: ${title}\n")
|
|
:unnarrowed t)
|
|
("p" "person" plain
|
|
"%?"
|
|
:target
|
|
(file+head
|
|
"person/${slug}.org"
|
|
"#+title: ${title}\n")
|
|
:unnarrowed t)
|
|
("n" "literature note" plain
|
|
"%?"
|
|
:target
|
|
(file+head
|
|
"%(concat
|
|
(when citar-org-roam-subdir (concat citar-org-roam-subdir \"/\")) \"${citekey}.org\")"
|
|
"#+title: ${title}\n")
|
|
:unnarrowed t)))
|
|
(setq org-roam-dailies-capture-templates
|
|
'(("d" "default" entry
|
|
"* %?"
|
|
:target (file+head "%<%Y-%m-%d>.org"
|
|
"#+title: %<%Y-%m-%d>\n"))))
|
|
(map! :leader
|
|
:desc "Capture today" "n n" #'org-roam-dailies-capture-today)
|
|
(setq org-roam-directory (concat org-directory "roam/")
|
|
org-roam-completion-everywhere nil))
|
|
|
|
(after! org-download
|
|
(setq org-download-screenshot-method "flameshot gui --raw > %s"))
|
|
|
|
(after! citar
|
|
;; (setq citar-file-parser-functions
|
|
;; '(citar-file--parser-default
|
|
;; citar-file--parser-triplet))
|
|
(setq citar-org-roam-capture-template-key "n")
|
|
(setq! citar-library-paths '("~/Zotero" "~/Nextcloud/Calibre")
|
|
citar-notes-paths `(,(expand-file-name "reference" org-roam-directory))
|
|
citar-bibliography `(,(expand-file-name "library.bib" org-roam-directory)
|
|
,(expand-file-name "books.bib" org-roam-directory))))
|
|
|
|
(after! citar-org-roam
|
|
;; (citar-register-notes-source
|
|
;; 'orb-citar-source (list :name "Org-Roam Notes"
|
|
;; :category 'org-roam-node
|
|
;; :items #'citar-org-roam--get-candidates
|
|
;; :hasitems #'citar-org-roam-has-notes
|
|
;; :open #'citar-org-roam-open-note
|
|
;; :create #'orb-citar-edit-note
|
|
;; :annotate #'citar-org-roam--annotate))
|
|
;; (setq citar-notes-source 'orb-citar-source)
|
|
(setq citar-org-roam-subdir "reference"))
|
|
|
|
;; insert drawings from my RM2
|
|
(use-package! org-inline-pdf
|
|
:hook (org-mode . org-inline-pdf-mode))
|
|
|
|
(use-package! org-roam-ui
|
|
:after org-roam
|
|
:config
|
|
(setq org-roam-ui-sync-theme t
|
|
org-roam-ui-follow t
|
|
org-roam-ui-update-on-save t
|
|
org-roam-ui-open-on-start t))
|
|
|
|
(after! org-noter
|
|
;; (map! :map pdf-view-mode-map "i" nil)
|
|
;; (map! :map pdf-view-mode-map :gn "i" #'org-noter-insert-note)
|
|
(setq org-noter-always-create-frame nil))
|
|
|
|
(use-package! nov
|
|
:mode ("\\.epub\\'" . nov-mode))
|
|
|
|
(use-package! org-transclusion
|
|
:after org
|
|
:init
|
|
(map!
|
|
:map global-map "<f12>" #'org-transclusion-add
|
|
:leader
|
|
:prefix "n"
|
|
:desc "Org Transclusion Mode" "t" #'org-transclusion-mode))
|
|
|
|
(defun my/org-remark-notes-file-name-function ()
|
|
(cond ((buffer-file-name)
|
|
(let ((source-filename (org-remark-source-find-file-name)))
|
|
(when (and (stringp source-filename)
|
|
(file-exists-p source-filename))
|
|
(concat (file-name-sans-extension
|
|
(file-name-nondirectory source-filename))
|
|
"-notes.org"))))
|
|
((eq major-mode 'eww-mode)
|
|
(my/org-remark-eww--create-capture-note eww-data))))
|
|
|
|
(defun my/org-remark-eww--create-capture-note (info)
|
|
"Open or create org-roam node from `eww-data'."
|
|
;; (let* ((title (plist-get eww-data :title))
|
|
;; (ref (plist-get eww-data :url)))
|
|
(org-roam-capture-
|
|
;; :keys (plist-get info :template)
|
|
:node (org-roam-node-create :title (plist-get info :title))
|
|
:info (list :ref (plist-get info :url))
|
|
;; :body (plist-get info :body))
|
|
:templates '(("r" "reference" plain "%?"
|
|
:target (file+head "${slug}.org"
|
|
"#+title: ${title}")
|
|
:immediate-finish t
|
|
:unnarrowed t))))
|
|
|
|
|
|
;; :templates org-roam-capture-ref-templates))
|
|
;; (apply 'org-roam-capture-
|
|
;; :info (setq infoplist
|
|
;; ;; Add notetitle in case someone wants to use it in their
|
|
;; ;; capture template.
|
|
;; (plist-put infoplist :note-title notetitle))
|
|
;; :info (list )
|
|
;; :node (org-roam-node-create :title title)
|
|
;; :props '(:finalize find-file)
|
|
;; (if templatekey
|
|
;; (list :keys templatekey)
|
|
;; (list
|
|
;; :templates
|
|
;; '(("r" "reference" plain "%?" :if-new
|
|
;; (file+head
|
|
;; "%(concat
|
|
;; (when citar-org-roam-subdir (concat citar-org-roam-subdir \"/\")) \"${citar-citekey}.org\")"
|
|
;; "#+title: ${note-title}\n")
|
|
;; :immediate-finish t
|
|
;; :unnarrowed t)))))
|
|
;; (org-roam-ref-add url)))
|
|
|
|
;; (org-roam-capture-
|
|
;; :keys (plist-get info :template)
|
|
;; :node (org-roam-node-create :title (plist-get info :title))
|
|
;; :info (list :ref (plist-get info :ref)
|
|
;; :body (plist-get info :body))
|
|
;; :templates org-roam-capture-ref-templates))
|
|
|
|
;; (use-package! org-remark
|
|
;; :after org
|
|
;; :init
|
|
;; (require 'org-remark-global-tracking)
|
|
;; (org-remark-global-tracking-mode +1)
|
|
;; (map! "C-c n m" #'org-remark-mark)
|
|
;; :config
|
|
;; (map! :map org-remark-mode-map
|
|
;; "C-c n o" #'org-remark-open
|
|
;; "C-c n ]" #'org-remark-view-next
|
|
;; "C-c n [" #'org-remark-view-prev
|
|
;; "C-c n R" #'org-remark-remove))
|
|
|
|
(use-package! org-remark
|
|
:bind (;; :bind keyword also implicitly defers org-remark itself.
|
|
;; Keybindings before :map is set for global-map.
|
|
("C-c n m" . org-remark-mark)
|
|
("C-c n l" . org-remark-mark-line)
|
|
:map org-remark-mode-map
|
|
("C-c n o" . org-remark-open)
|
|
("C-c n ]" . org-remark-view-next)
|
|
("C-c n [" . org-remark-view-prev)
|
|
("C-c n r" . org-remark-remove)
|
|
("C-c n d" . org-remark-delete))
|
|
;; Alternative way to enable `org-remark-global-tracking-mode' in
|
|
;; `after-init-hook'.
|
|
;; :hook (after-init . org-remark-global-tracking-mode)
|
|
:init
|
|
;; It is recommended that `org-remark-global-tracking-mode' be
|
|
;; enabled when Emacs initializes. Alternatively, you can put it to
|
|
;; `after-init-hook' as in the comment above
|
|
(org-remark-global-tracking-mode +1)
|
|
:config
|
|
(setq org-remark-notes-file-name #'my/org-remark-notes-file-name-function)
|
|
(use-package org-remark-info :after info :config (org-remark-info-mode +1))
|
|
(use-package org-remark-eww :after eww :config (org-remark-eww-mode +1))
|
|
(use-package org-remark-nov :after nov :config (org-remark-nov-mode +1)))
|
|
|
|
(after! org-roam-bibtex
|
|
(setq orb-insert-link-description 'citekey))
|