mirror of
https://github.com/foo-dogsquared/dotfiles.git
synced 2025-04-24 06:19:10 +00:00
Update custom Doom wiki module
This commit is contained in:
parent
75de71b4d0
commit
de6b66c657
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
(setq org-directory "~/writings/orgnotes"
|
(setq org-directory "~/writings/orgnotes"
|
||||||
org-roam-directory "~/writings/wiki"
|
org-roam-directory "~/writings/wiki"
|
||||||
org-roam-dailies-directory (concat org-roam-directory "/daily"))
|
org-roam-dailies-directory (f-join org-roam-directory "daily"))
|
||||||
|
|
||||||
;; This determines the style of line numbers in effect. If set to `nil', line
|
;; This determines the style of line numbers in effect. If set to `nil', line
|
||||||
;; numbers are disabled. For relative line numbers, set this to `relative'.
|
;; numbers are disabled. For relative line numbers, set this to `relative'.
|
||||||
@ -55,54 +55,51 @@
|
|||||||
; Set the capture
|
; Set the capture
|
||||||
org-capture-templates `(
|
org-capture-templates `(
|
||||||
("i" "inbox" entry
|
("i" "inbox" entry
|
||||||
(file ,(concat org-directory "/inbox.org"))
|
(file ,(f-join org-directory "inbox.org"))
|
||||||
,(concat "* TODO %?\n"
|
,(concat "* TODO %?\n"
|
||||||
"entered on %<%F %T %:z>"))
|
"entered on %<%F %T %:z>"))
|
||||||
|
|
||||||
("p" "project" entry
|
("p" "project" entry
|
||||||
(file ,(concat org-directory "/projects.org"))
|
(file ,(f-join org-directory "projects.org"))
|
||||||
,(concat "* PROJ %?\n"
|
,(concat "* PROJ %?\n"
|
||||||
"- [ ] %?"))
|
"- [ ] %?"))
|
||||||
|
|
||||||
("c" "org-protocol-capture" entry
|
("c" "org-protocol-capture" entry
|
||||||
(file ,(concat org-directory "/inbox.org"))
|
(file ,(f-join org-directory "inbox.org"))
|
||||||
"* TODO [[%:link][%:description]]\n%x"
|
"* TODO [[%:link][%:description]]\n%x"
|
||||||
:immediate-finish t))
|
:immediate-finish t))
|
||||||
|
|
||||||
; Configure org-roam.
|
; Configure org-roam.
|
||||||
org-roam-capture-templates '(
|
org-roam-capture-templates `(
|
||||||
("p" "permanent" plain
|
("p" "permanent" plain "%?"
|
||||||
#'org-roam-capture--get-point "%?"
|
:if-new
|
||||||
:file-name "%<%Y-%m-%d-%H-%M-%S>"
|
(file+head "%<%Y-%m-%d-%H-%M-%S>.org"
|
||||||
:head "#+title: ${title}
|
"#+title: ${title}
|
||||||
#+date: \"%<%Y-%m-%d %T %:z>\"
|
#+date: \"%<%Y-%m-%d %T %:z>\"
|
||||||
#+date_modified: \"%<%Y-%m-%d %T %:z>\"
|
#+date_modified: \"%<%Y-%m-%d %T %:z>\"
|
||||||
#+language: en"
|
#+language: en")
|
||||||
:unnarrowed t)
|
:unnarrowed t)
|
||||||
|
|
||||||
("c" "cards" plain
|
("c" "cards" plain "%?"
|
||||||
#'org-roam-capture--get-point "%?"
|
:if-new
|
||||||
:head "#+title: Anki: ${title}
|
(file+head ,(f-join "cards" "${slug}.org") "#+title: Anki: ${title}
|
||||||
#+date: \"%<%Y-%m-%d %T %:z>\"
|
#+date: \"%<%Y-%m-%d %T %:z>\"
|
||||||
#+date_modified: \"%<%Y-%m-%d %T %:z>\"
|
#+date_modified: \"%<%Y-%m-%d %T %:z>\"
|
||||||
#+language: en
|
#+language: en
|
||||||
#+property: anki_deck ${title}"
|
#+property: anki_deck ${title}")
|
||||||
:file-name "cards/${slug}"
|
|
||||||
:unnarrowed t)
|
:unnarrowed t)
|
||||||
|
|
||||||
("l" "literature" plain
|
("l" "literature" plain "%?"
|
||||||
#'org-roam-capture--get-point "%?"
|
:if-new
|
||||||
:head "#+title: ${title}
|
(file+head ,(f-join "literature" "%<%Y-%m-%d-%H-%M-%S>")"#+title: ${title}
|
||||||
#+date: \"%<%Y-%m-%d %T %:z>\"
|
#+date: \"%<%Y-%m-%d %T %:z>\"
|
||||||
#+date_modified: \"%<%Y-%m-%d %T %:z>\"
|
#+date_modified: \"%<%Y-%m-%d %T %:z>\"
|
||||||
#+language: en"
|
#+language: en")
|
||||||
:file-name "literature/%<%Y-%m-%d-%H-%M-%S>"
|
:unnarrowed t))
|
||||||
:unnarrowed t)
|
|
||||||
|
|
||||||
("d" "dailies" entry
|
org-roam-dailies-capture-templates `(("d" "default" entry "* %?"
|
||||||
#'org-roam-capture--get-point "%?"
|
:if-new
|
||||||
:file-name "daily/%<%Y-%m-%d>"
|
(file+head ,(expand-file-name "%<%Y-%m-%d>.org" org-roam-dailies-directory) "#+title: %<%Y-%m-%d>\n")))
|
||||||
:head "#+title %<%Y-%m-%d>"))
|
|
||||||
|
|
||||||
;; Get the tags from vanilla and Roam-specific properties.
|
;; Get the tags from vanilla and Roam-specific properties.
|
||||||
org-roam-tag-sources '(prop vanilla))
|
org-roam-tag-sources '(prop vanilla))
|
||||||
|
@ -14,12 +14,7 @@
|
|||||||
;; Alternatively, press 'gd' (or 'C-c g d') on a module to browse its
|
;; Alternatively, press 'gd' (or 'C-c g d') on a module to browse its
|
||||||
;; directory (for easy access to its source code).
|
;; directory (for easy access to its source code).
|
||||||
|
|
||||||
(doom!
|
(doom! :input
|
||||||
;; All custom modules will be put here.
|
|
||||||
:tools
|
|
||||||
(wiki +anki)
|
|
||||||
|
|
||||||
:input
|
|
||||||
;;chinese
|
;;chinese
|
||||||
japanese
|
japanese
|
||||||
|
|
||||||
@ -187,4 +182,8 @@
|
|||||||
|
|
||||||
:config
|
:config
|
||||||
;;literate
|
;;literate
|
||||||
(default +bindings +smartparens))
|
(default +bindings +smartparens)
|
||||||
|
|
||||||
|
:tools
|
||||||
|
(wiki +anki
|
||||||
|
+dendron))
|
||||||
|
37
emacs/modules/tools/wiki/README.org
Normal file
37
emacs/modules/tools/wiki/README.org
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#+title: tools/wiki
|
||||||
|
#+date: "2021-05-05 00:27:26 +08:00"
|
||||||
|
#+date_modified: "2021-05-05 01:52:39 +08:00"
|
||||||
|
#+language: en
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Description
|
||||||
|
|
||||||
|
This module set up my personal wiki configuration with Emacs primarily with org-roam.
|
||||||
|
The setup uses org-roam v2.
|
||||||
|
|
||||||
|
|
||||||
|
** Module flags
|
||||||
|
|
||||||
|
- ~+anki~ enables Anki cards editing with [[https://github.com/louietan/anki-editor/][anki-editor]].
|
||||||
|
- ~+markdown~ adds Markdown support in org-roam.
|
||||||
|
- ~+dendron~ adds [[https://dendron.so/][Dendron]]-inspired features with [[https://github.com/vicrdguez/dendroam][dendroam]].
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
** Plugins
|
||||||
|
|
||||||
|
- [[https://github.com/org-roam/org-roam/][org-roam]] v2
|
||||||
|
- [[https://github.com/louietan/anki-editor/][anki-editor]]
|
||||||
|
- [[https://github.com/vicrdguez/dendroam][dendroam]]
|
||||||
|
- [[https://github.com/nobiot/md-roam][md-roam]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Prerequisites
|
||||||
|
|
||||||
|
This module has a handful of requirements to work properly.
|
||||||
|
|
||||||
|
- SQLite v3 binary is installed in order for org-roam to work.
|
||||||
|
- The ~+anki~ feature requires Anki and the setup described from the [[https://github.com/louietan/anki-editor][project README]].
|
@ -2,6 +2,27 @@
|
|||||||
|
|
||||||
;; My custom configuration for setting up my personal wiki.
|
;; My custom configuration for setting up my personal wiki.
|
||||||
;; Also a good opportunity for training my Elisp-fu.
|
;; Also a good opportunity for training my Elisp-fu.
|
||||||
|
(require 'f)
|
||||||
|
|
||||||
|
(defvar +anki-cards-directory nil
|
||||||
|
"The location of the Anki cards")
|
||||||
|
|
||||||
|
(defvar +structured-notes-directory nil
|
||||||
|
"The path of the structured notes used for the Dendron-like features.
|
||||||
|
The structured notes are considered separate to the org-roam notes.
|
||||||
|
Though, both notes are integrated in the mindset that org-roam is an extension of
|
||||||
|
the structured notes needed to create atmoic notes.")
|
||||||
|
|
||||||
|
(defun +anki-editor-reset-note ()
|
||||||
|
"Reset the Anki note in point by deleting the note ID and the deck."
|
||||||
|
(interactive)
|
||||||
|
(org-entry-delete (point) anki-editor-prop-note-id)
|
||||||
|
(org-entry-delete (point) anki-editor-prop-deck))
|
||||||
|
|
||||||
|
(defun +anki-editor-reset-all-notes ()
|
||||||
|
"Reset the Anki notes in the current buffer by deleting the note ID and the deck."
|
||||||
|
(interactive)
|
||||||
|
(anki-editor-map-note-entries #'+anki-editor-reset-note))
|
||||||
|
|
||||||
(use-package! org-roam
|
(use-package! org-roam
|
||||||
:hook (org-load . org-roam-mode)
|
:hook (org-load . org-roam-mode)
|
||||||
@ -11,27 +32,38 @@
|
|||||||
org-roam-capture
|
org-roam-capture
|
||||||
org-roam-node-find)
|
org-roam-node-find)
|
||||||
:preface (defvar org-roam-directory nil)
|
:preface (defvar org-roam-directory nil)
|
||||||
:config
|
:init
|
||||||
(setq org-roam-completion-everywhere t)
|
|
||||||
(org-roam-setup)
|
|
||||||
(map! :leader
|
(map! :leader
|
||||||
|
:after org
|
||||||
|
:map org-roam-dailies-map
|
||||||
(:prefix ("n r" . "org-roam")
|
(:prefix ("n r" . "org-roam")
|
||||||
:desc "Go to a random node in your Roam database" "R" #'org-roam-node-random
|
:desc "Go to a random node" "R" #'org-roam-node-random
|
||||||
:desc "Find node" "f" #'org-roam-node-find
|
:desc "Find node" "f" #'org-roam-node-find
|
||||||
:desc "Org Roam capture" "c" #'org-roam-capture
|
:desc "Org Roam capture" "c" #'org-roam-capture
|
||||||
:desc "Org Roam setup" "s" #'org-roam-setup
|
:desc "Org Roam setup" "s" #'org-roam-setup
|
||||||
:desc "Org Roam teardown" "S" #'org-roam-teardown
|
:desc "Org Roam teardown" "S" #'org-roam-teardown
|
||||||
:desc "Open backlinks buffer" "b" #'org-roam-buffer-toggle
|
:desc "Open backlinks buffer" "b" #'org-roam-buffer-toggle
|
||||||
|
|
||||||
(:prefix ("d" . "dailies")
|
(:prefix ("d" . "dailies")
|
||||||
:desc "Dailies for today" "t" #'org-roam-dailies-find-today
|
:desc "Daily note for today" "t" #'org-roam-dailies-find-today
|
||||||
:desc "Dailies for a specific date" "d" #'org-roam-dailies-find-date
|
:desc "Daily note for a specific date" "d" #'org-roam-dailies-find-date
|
||||||
:desc "Dailies for yesterday" "y" #'org-roam-dailies-find-yesterday))))
|
:desc "Daily note for yesterday" "y" #'org-roam-dailies-find-yesterday
|
||||||
|
:desc "Previous daily note" "Y" #'org-roam-dailies-find-previous-note)))
|
||||||
|
|
||||||
|
:config
|
||||||
|
(setq org-roam-completion-everywhere t
|
||||||
|
org-roam-directory (file-name-as-directory
|
||||||
|
(file-truename
|
||||||
|
(expand-file-name (or org-roam-directory "roam")
|
||||||
|
org-directory)))
|
||||||
|
org-roam-dailies-directory (f-join org-roam-directory "daily"))
|
||||||
|
(org-roam-setup))
|
||||||
|
|
||||||
(use-package! anki-editor
|
(use-package! anki-editor
|
||||||
:hook (org-mode . anki-editor-mode)
|
:hook (org-mode . anki-editor-mode)
|
||||||
:config
|
:config
|
||||||
(setq anki-editor-create-decks 't)
|
(setq anki-editor-create-decks 't
|
||||||
|
+anki-cards-directory (f-join org-roam-directory "cards"))
|
||||||
(map! :localleader
|
(map! :localleader
|
||||||
:map org-mode-map
|
:map org-mode-map
|
||||||
(:prefix ("C" . "Anki cards")
|
(:prefix ("C" . "Anki cards")
|
||||||
@ -39,4 +71,11 @@
|
|||||||
"r" #'anki-editor-retry-failure-notes
|
"r" #'anki-editor-retry-failure-notes
|
||||||
"i" #'anki-editor-insert-note
|
"i" #'anki-editor-insert-note
|
||||||
"I" #'anki-editor-cloze-region
|
"I" #'anki-editor-cloze-region
|
||||||
"e" #'anki-editor-export-subtree-to-html)))
|
"e" #'anki-editor-export-subtree-to-html
|
||||||
|
"d" #'+anki-editor-reset-note
|
||||||
|
"D" #'+anki-editor-reset-all-notes)))
|
||||||
|
|
||||||
|
(use-package! dendroam
|
||||||
|
:after org-roam
|
||||||
|
:config
|
||||||
|
(setq +structured-notes-directory (f-join org-roam-directory "structured")))
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
;; -*- no-byte-compile: t; -*-
|
;; -*- no-byte-compile: t; -*-
|
||||||
;;; tools/wiki
|
;;; tools/wiki/packages.el
|
||||||
|
|
||||||
;; The main package for creating a wiki.
|
;; The main package for creating a wiki.
|
||||||
(package! org-roam
|
(package! org-roam
|
||||||
@ -11,10 +11,10 @@
|
|||||||
:repo "louietan/anki-editor")
|
:repo "louietan/anki-editor")
|
||||||
:pin "546774a453ef4617b1bcb0d1626e415c67cc88df"))
|
:pin "546774a453ef4617b1bcb0d1626e415c67cc88df"))
|
||||||
|
|
||||||
;;(when (featurep! +markdown)
|
(when (featurep! +markdown)
|
||||||
;; (package! md-roam
|
(package! md-roam
|
||||||
;; :recipe (:host github :repo "nobiot/md-roam" :branch "v2")))
|
:recipe (:host github :repo "nobiot/md-roam" :branch "v2")))
|
||||||
;;
|
|
||||||
;;(when (featurep! +dendron)
|
(when (featurep! +dendron)
|
||||||
;; (package! dendroam
|
(package! dendroam
|
||||||
;; :recipe (:host github :repo "vicrdguez/dendroam")))
|
:recipe (:host github :repo "vicrdguez/dendroam")))
|
||||||
|
Loading…
Reference in New Issue
Block a user