commit f042c7f63fa2a68a266b140c628899fd869e2001
parent ac4e00f3fcba5070ff52ef117e11e5476d40e667
Author: Vincent Demeester <vincent@sbr.pm>
Date: Wed, 10 Jun 2020 18:40:34 +0200
tools/emacs: configure org-roam
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
3 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
@@ -75,7 +75,7 @@ soon-ish 👼):
Most of the `make` commands will try to populate this ahead of time. The assumption is :
have a `sync` folder where the assets are. *Note: how to bootstrap (as syncthing will
not be there, and the `sync` folder either)*
-- `docs`: holds documentation about this code, literate configuration, see [literate configuration](#orgb210a13).
+- `docs`: holds documentation about this code, literate configuration, see [literate configuration](#org55d6923).
`make publish` will publish the `README.org` and the `docs` folder to my website.
- `lib`: shared code used during configuration (mostly `nix` code).
- `machines`: configuration per machines
@@ -85,7 +85,7 @@ soon-ish 👼):
- `private`: holds non-shareable code, like *secrets*.
- `tmp`: things to… organize (e.g. where I import my other *legacy* configuration)
-<a id="orgb210a13"></a>As I'm slowly, but <span class="underline">surely</span>, going to have `org-mode` files for
+<a id="org55d6923"></a>As I'm slowly, but <span class="underline">surely</span>, going to have `org-mode` files for
literate configuration files in this repository, I have to think of how to organize files
in order to end up with one huge file. The goal of having those `org-mode` files, is
mainly to document my configuration and publish it, most likely on [sbr.pm](https://sbr.pm).
diff --git a/tools/emacs/config/config-org.el b/tools/emacs/config/config-org.el
@@ -583,9 +583,65 @@ With prefix argument, also display headlines without a TODO keyword."
(use-package org-capture-pop-frame
:after org)
-
(use-package orgit
:after org)
+(use-package org-roam
+ :commands (org-roam org-roam-build-cache)
+ ;; :hook
+ ;; (after-init . org-roam-mode)
+ :bind (("C-c o n" . org-roam-mode)
+ :map org-roam-mode-map
+ (("C-c n l" . org-roam)
+ ("C-c n f" . org-roam-find-file)
+ ("C-c n g" . org-roam-show-graph)
+ ("C-c n b" . org-roam-switch-to-buffer))
+ :map org-mode-map
+ (("C-c n i" . org-roam-insert)))
+ :custom
+ (org-roam-directory org-default-technical-dir)
+ :custom-face
+ (org-roam-link ((t (:inherit org-link :foreground "#C991E1"))))
+ :config
+ (require 'org-roam-protocol)
+ ;; (defun jethro/conditional-hugo-enable ()
+ ;; (save-excursion
+ ;; (if (cdr (assoc "SETUPFILE" (org-roam--extract-global-props '("SETUPFILE"))))
+ ;; (org-hugo-auto-export-mode +1)
+ ;; (org-hugo-auto-export-mode -1))))
+ ;;
+ ;; (with-eval-after-load 'org
+ ;; (defun my/org-roam--backlinks-list (file)
+ ;; (if (org-roam--org-roam-file-p file)
+ ;; (--reduce-from
+ ;; (concat acc (format "- [[file:%s][%s]]\n"
+ ;; (file-relative-name (car it) org-roam-directory)
+ ;; (org-roam--get-title-or-slug (car it))))
+ ;; "" (org-roam-sql [:select [file-from]
+ ;; :from file-links
+ ;; :where (= file-to $s1)
+ ;; :and file-from :not :like $s2] file "%private%"))
+ ;; ""))
+ ;; (defun my/org-export-preprocessor (_backend)
+ ;; (let ((links (my/org-roam--backlinks-list (buffer-file-name))))
+ ;; (unless (string= links "")
+ ;; (save-excursion
+ ;; (goto-char (point-max))
+ ;; (insert (concat "\n* Backlinks\n" links))))))
+ ;; (add-hook 'org-export-before-processing-hook 'my/org-export-preprocessor))
+ (setq org-roam-capture-templates
+ '(("d" "default" plain (function org-roam--capture-get-point)
+ "%?"
+ :file-name "${slug}"
+ :head "#+SETUPFILE:../templates/articles.org
+#+TITLE: ${title}\n"
+ :unnarrowed t)
+ ("p" "private" plain (function org-roam--capture-get-point)
+ "%?"
+ :file-name "private-${slug}"
+ :head "#+TITLE: ${title}\n"
+ :unnarrowed t)))
+
+
(provide 'config-org)
;;; config-org.el ends here
diff --git a/users/vincent/dev/emacs.nix b/users/vincent/dev/emacs.nix
@@ -84,6 +84,7 @@ in
org-gcal
org-ql
org-ref
+ org-roam
org-super-agenda
org-web-tools
ox-pandoc