Refactor reference system code to roam module

This commit is contained in:
Max Schlueter 2023-10-11 17:09:37 +02:00
parent 0d8c0a6164
commit 618e69fc3d
3 changed files with 90 additions and 112 deletions

110
config.el
View File

@ -222,10 +222,6 @@
;; :category "next"))
;; ))))))))
(use-package! org-inline-pdf
:hook (org-mode . org-inline-pdf-mode))
(use-package! indium
:hook ((js-mode typescript-mode) . indium-interaction-mode)
:init
@ -301,85 +297,6 @@
;; ;; (add-hook 'kill-emacs-hook 'org-caldav-sync-at-close)
;; )
(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))
(setq +org-roam-open-buffer-on-find-file nil)
(after! org-roam
(setq org-roam-capture-templates
'(("d" "default" plain
"%?"
:target
(file+head
"${slug}.org"
"#+title: ${note-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"))))
;; ("j" "journal" entry
;; #'org-roam-capture--get-point
;; "* %?"
;; :file-name "daily/%<%Y-%m-%d>"
;; :head "#+title: %<%Y-%m-%d>\n"
;; :olp ("Journal"))))
(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! 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"))
(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))
(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 t))
(after! biblio
(map! :map biblio-selection-mode-map
"C-j" #'biblio--selection-next
@ -404,9 +321,6 @@
'ivy-bibtex
'(("x" max/ivy-bibtex-org-capture "Capture PDF to read"))))
(use-package! nov
:mode ("\\.epub\\'" . nov-mode))
;; Taken from: https://github.com/hlissner/doom-emacs/pull/6077
;; (use-package! org-roam-bibtex
;; ;; :when (featurep! :lang org +roam2)
@ -480,7 +394,6 @@ Adapted from `org-clock-get-clock-string'."
;; (org-agenda-quit)
;; (org-agenda nil " ")))
(after! auth-source
(when IS-MAC
(setq auth-sources '(macos-keychain-internet macos-keychain-generic))))
@ -512,15 +425,10 @@ Adapted from `org-clock-get-clock-string'."
(setq +latex-viewers '(pdf-tools))
(setq org-roam-directory (concat org-directory "roam/"))
;; (setq! +biblio-pdf-library-dir "~/Nextcloud/Papers/"
;; +biblio-default-bibliography-files '("~/Nextcloud/Papers/library.bib")
;; +biblio-notes-path org-roam-directory)
(after! org-roam-bibtex
(setq orb-insert-link-description 'citekey))
;; https://tecosaur.github.io/emacs-config/config.html#getting-notified
;; http://cachestocaches.com/2017/3/complete-guide-email-emacs-using-mu-and-/
;; (use-package! mu4e-alert
@ -588,28 +496,10 @@ Adapted from `org-clock-get-clock-string'."
(setq codeql-transient-binding "C-c q")
(setq codeql-configure-eglot-lsp t))
(defadvice! +default--dont-prompt-for-save-file-a (&rest _)
:before #'server-edit
(save-buffer))
;; (server-start)
;; (use-package! mac-pseudo-daemon
;; :config
;; (mac-pseudo-daemon-mode)
;; )
;; (load! nix-docbook-mode)
;;; (after! calfw-org
;;; (autoload (function cfw:org-create-file-source) "cfw:org-create-file-source" nil t))
;;; (after! calfw-org
;;; (autoload #'cfw:org-create-file-source "cfw:org-create-file-source"))
;; load personal modules
(load! "email")
(load! "gtd")

7
gtd.el
View File

@ -32,8 +32,6 @@
org-refile-targets `(("tasks.org" . (:maxlevel . 2))
(,(expand-file-name "gtd/someday.org" org-directory) . (:maxlevel . 1)))))
;; Getting the following on capture:
;;
;; Greedy org-protocol handler. Killing client.
@ -230,3 +228,8 @@ show up there.\n\n"))
(setq org-pomodoro-length 25
org-pomodoro-short-break-length 5
org-pomodoro-long-break-length 20))
;;
;;; Reference system
(load! "roam")

85
roam.el Normal file
View File

@ -0,0 +1,85 @@
;;; roam.el -*- lexical-binding: t; -*-
(after! org-roam
(setq org-roam-capture-templates
'(("d" "default" plain
"%?"
:target
(file+head
"${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))
(after! org-roam-bibtex
(setq orb-insert-link-description 'citekey))