(setq
org_notes (concat (getenv "HOME") "/work/roam")
deft-directory org_notes
org-roam-directory org_notes
)
(executable-find "sqlite3")
(add-hook 'after-init-hook 'org-roam-mode)
(use-package hide-mode-line
:ensure t
:commands my/toggle-hide-mode-line
:init
(my/leader-keys
"tm" 'my/toggle-hide-mode-line))
;;;###autoload
(defun my/toggle-hide-mode-line ()
(interactive)
(hide-mode-line-mode (if hide-mode-line-mode -1 +1))
(unless hide-mode-line-mode
(redraw-display)))
(use-package deft
:commands deft
:ensure t
:init
(setq deft-default-extension "org"
;; de-couples filename and note title:
deft-use-filename-as-title nil
deft-use-filter-string-for-filename t
;; disable auto-save
deft-auto-save-interval -1.0
;; converts the filter string into a readable file-name using kebab-case:
deft-file-naming-rules
'((noslash . "-")
(nospace . "-")
(case-fn . downcase)))
:config
(add-to-list 'deft-extensions "tex")
)
(setq
bibtex-completion-notes-path "~/work/roam/"
bibtex-completion-bibliography "~/work/bibliography/references.bib"
bibtex-completion-pdf-field "file"
bibtex-completion-notes-template-multiple-files
(concat
"#+TITLE: ${title}\n"
"#+ROAM_KEY: cite:${=key=}\n"
"* TODO Notes\n"
":PROPERTIES:\n"
":Custom_ID: ${=key=}\n"
":NOTER_DOCUMENT: %(orb-process-file-field \"${=key=}\")\n"
":AUTHOR: ${author-abbrev}\n"
":JOURNAL: ${journaltitle}\n"
":DATE: ${date}\n"
":YEAR: ${year}\n"
":DOI: ${doi}\n"
":URL: ${url}\n"
":END:\n\n"
)
)
(use-package org-ref
;; :init
; code to run before loading org-ref
:config
(setq
org-ref-completion-library 'org-ref-ivy-cite
org-ref-get-pdf-filename-function 'org-ref-get-pdf-filename-helm-bibtex
org-ref-default-bibliography (list "~/work/bibliography/references.bib")
org-ref-bibliography-notes "~/work/roam/notes.org"
org-ref-note-title-format "* TODO %y - %t\n :PROPERTIES:\n :Custom_ID: %k\n :NOTER_DOCUMENT: %F\n :ROAM_KEY: cite:%k\n :AUTHOR: %9a\n :JOURNAL: %j\n :YEAR: %y\n :VOLUME: %v\n :PAGES: %p\n :DOI: %D\n :URL: %U\n :END:\n\n"
org-ref-notes-directory "~/work/roam/"
org-ref-notes-function 'orb-edit-notes
))
(use-package org-roam
:ensure t
:hook (org-load . org-roam-mode)
:commands (org-roam-buffer-toggle-display
org-roam-find-file
org-roam-graph
org-roam-insert
org-roam-switch-to-buffer
org-roam-dailies-date
org-roam-dailies-today
org-roam-dailies-tomorrow
org-roam-dailies-yesterday)
:preface
;; Set this to nil so we can later detect whether the user has set a custom
;; directory for it, and default to `org-directory' if they haven't.
(defvar org-roam-directory nil)
:init
:config
(setq org-roam-directory (expand-file-name (or org-roam-directory "roam")
org-directory)
org-roam-verbose nil ; https://youtu.be/fn4jIlFwuLU
org-roam-buffer-no-delete-other-windows t ; make org-roam buffer sticky
org-roam-completion-system 'default
))
;; Normally, the org-roam buffer doesn't open until you explicitly call
;; `org-roam'. If `+org-roam-open-buffer-on-find-file' is non-nil, the
;; org-roam buffer will be opened for you when you use `org-roam-find-file'
;; (but not `find-file', to limit the scope of this behavior).
(add-hook 'find-file-hook
(defun +org-roam-open-buffer-maybe-h ()
(and +org-roam-open-buffer-on-find-file
(memq 'org-roam-buffer--update-maybe post-command-hook)
(not (window-parameter nil 'window-side)) ; don't proc for popups
(not (eq 'visible (org-roam-buffer--visibility)))
(with-current-buffer (window-buffer)
(org-roam-buffer--get-create)))))
;; Hide the mode line in the org-roam buffer, since it serves no purpose. This
;; makes it easier to distinguish among other org buffers.
(add-hook 'org-roam-buffer-prepare-hook #'hide-mode-line-mode))
;; Since the org module lazy loads org-protocol (waits until an org URL is
;; detected), we can safely chain `org-roam-protocol' to it.
(use-package org-roam-protocol
:ensure t
:after org-protocol)
(use-package company-org-roam
:ensure t
:after org-roam
:config
(set-company-backend! 'org-mode '(company-org-roam company-yasnippet company-dabbrev)))
(use-package org-roam-bibtex
:ensure t
:after (org-roam)
:hook (org-roam-mode . org-roam-bibtex-mode)
:config
(setq org-roam-bibtex-preformat-keywords
'("=key=" "title" "url" "file" "author-or-editor" "keywords"))
(setq orb-templates
'(("r" "ref" plain (function org-roam-capture--get-point)
""
:file-name "${slug}"
:head "#+TITLE: ${=key=}: ${title}\n#+ROAM_KEY: ${ref}
- tags ::
- keywords :: ${keywords}
\n* ${title}\n :PROPERTIES:\n :Custom_ID: ${=key=}\n :URL: ${url}\n :AUTHOR: ${author-or-editor}\n :NOTER_DOCUMENT: %(orb-process-file-field \"${=key=}\")\n :NOTER_PAGE: \n :END:\n\n"
:unnarrowed t))))
(use-package org-noter
:ensure t
:after (:any org pdf-view)
:config
(setq
;; The WM can handle splits
org-noter-notes-window-location 'other-frame
;; Please stop opening frames
org-noter-always-create-frame nil
;; I want to see the whole file
org-noter-hide-other nil
;; Everything is relative to the main notes file
org-noter-notes-search-path (list org_notes)
)
)
;; Since the org module lazy loads org-protocol (waits until an org URL is
;; detected), we can safely chain `org-roam-protocol' to it.
(use-package org-roam-protocol
:ensure t
:after org-protocol)
(use-package company-org-roam
:ensure t
:after org-roam
:config
(set-company-backend! 'org-mode '(company-org-roam company-yasnippet company-dabbrev)))