Clean up Doom Emacs config

This commit is contained in:
Gabriel Arazas 2022-01-11 22:19:46 +08:00
parent f7d09f9484
commit 70126373f0
5 changed files with 122 additions and 193 deletions

View File

@ -6,30 +6,27 @@
user-mail-address "foo.dogsquared@gmail.com") user-mail-address "foo.dogsquared@gmail.com")
(setq doom-font (font-spec :family "Iosevka" :size 16) (setq doom-font (font-spec :family "Iosevka" :size 16)
doom-serif-font (font-spec :family "Source Serif Pro")) doom-serif-font (font-spec :family "Source Serif 4"))
(setq doom-theme 'doom-nord) (setq doom-theme 'doom-nord)
(setq org-directory "~/writings/orgnotes" (setq org-directory "~/library/writings/wiki"
org-roam-directory "~/writings/wiki" org-roam-directory "~/library/writings/wiki"
org-roam-dailies-directory (f-join org-roam-directory "daily")) org-roam-db-location (f-join org-roam-directory "org-roam.db")
org-agenda-files '("~/library/writings/wiki/inbox")
(setq global-display-line-numbers-mode t org-roam-dailies-directory (f-join org-roam-directory "daily")
display-line-numbers-type 'relative
projectile-project-search-path '("~/projects/software/" "~/writings/"))
(setq
org-id-link-to-org-use-id t org-id-link-to-org-use-id t
+file-templates-dir (expand-file-name "templates" doom-private-dir) +file-templates-dir (expand-file-name "templates" doom-private-dir)
+wiki-directory "~/writings/wiki" +wiki-directory "~/library/writings/wiki"
org-export-coding-system 'utf-8
org-journal-dir "~/writings/journal"
org-journal-file-format "%F"
enable-local-variables "query" enable-local-variables "query"
image-use-external-converter t image-use-external-converter t
org-startup-with-inline-images t) org-startup-with-inline-images t
global-display-line-numbers-mode t
display-line-numbers-type 'relative
projectile-project-search-path '("~/library/projects/software" "~/library/writings" "~/library/projects/learning"))
(add-to-list 'org-modules 'org-habit) (add-to-list 'org-modules 'org-habit)
(add-to-list 'org-modules 'org-checklist) (add-to-list 'org-modules 'org-checklist)

View File

@ -15,176 +15,101 @@
;; directory (for easy access to its source code). ;; directory (for easy access to its source code).
(doom! :input (doom! :input
;;chinese chinese
japanese japanese
:completion :completion
(company +childframe) ; the ultimate code completion backend (company +childframe)
;;helm ; the *other* search engine for love and life (vertico +icons)
;;ido ; the other *other* search engine...
ivy ; a search engine for love and life
:ui :ui
;;deft ; notational velocity for Emacs doom
doom ; what makes DOOM look the way it does doom-dashboard
doom-dashboard ; a nifty splash screen for Emacs doom-quit
doom-quit ; DOOM quit-message prompts when you quit Emacs hl-todo
;;fill-column ; a `fill-column' indicator indent-guides
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW modeline
;;hydra ophints
indent-guides ; highlighted indent columns (popup +defaults)
modeline ; snazzy, Atom-inspired modeline, plus API (ligatures +extra)
;;nav-flash ; blink the current line after jumping unicode
;;neotree ; a project drawer, like NERDTree for vim vc-gutter
ophints ; highlight the region an operation acts on vi-tilde-fringe
(popup +defaults) ; tame sudden yet inevitable temporary windows workspaces
ligatures ; ligatures or substitute text with pretty symbols
;;tabs ; an tab bar for Emacs
;;treemacs ; a project drawer, like neotree but cooler
unicode ; extended unicode support for various languages
vc-gutter ; vcs diff in the fringe
vi-tilde-fringe ; fringe tildes to mark beyond EOB
;;window-select ; visually switch windows
workspaces ; tab emulation, persistence & separate workspaces
;;zen ; distraction-free coding or writing
:editor :editor
(evil +everywhere); come to the dark side, we have cookies (evil +everywhere)
file-templates ; auto-snippets for empty files file-templates
fold ; (nigh) universal code folding fold
format ; automated prettiness format
;;god ; run Emacs commands without modifier keys lispy
;;lispy ; vim for lisp, for people who don't like vim snippets
;;multiple-cursors ; editing in many places at once word-wrap
;;objed ; text object editing for the innocent
;;parinfer ; turn lisp into python, sort of
;;rotate-text ; cycle region at point between text candidates
snippets ; my elves. They type so I don't have to
word-wrap ; soft wrapping with language-aware indent
:emacs :emacs
(dired +ranger) ; making dired pretty [functional] (dired +ranger)
electric ; smarter, keyword-based electric-indent electric
;;ibuffer ; interactive buffer management undo
undo ; persistent, smarter undo for your inevitable mistakes vc
vc ; version-control and Emacs, sitting in a tree
:term :term
;;eshell ; the elisp shell that works everywhere vterm
;;shell ; simple shell REPL for Emacs
;;term ; basic terminal emulator for Emacs
vterm ; the best terminal emulation in Emacs
:checkers :checkers
syntax ; tasing you for every semicolon you forget syntax
;;spell ; tasing you for misspelling mispelling
;;grammar ; tasing grammar mistake every you make
:tools :tools
;;ansible
biblio biblio
(debugger +lsp) ; FIXME stepping through code, to help you add bugs (debugger +lsp)
direnv direnv
;;docker editorconfig
editorconfig ; let someone else argue about tabs vs spaces (eval +overlay)
;;ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls)
;;gist ; interacting with github gists
(lookup (lookup
+dictionary +dictionary
+offline) ; navigate your code and its documentation +offline)
lsp lsp
;;macos ; MacOS-specific commands magit
magit ; a git porcelain for Emacs pdf
;;make ; run make tasks from Emacs rgb
;;pass ; password manager for nerds upload
pdf ; pdf enhancements
;;prodigy ; FIXME managing external services & code builders
rgb ; creating color strings
;;terraform ; infrastructure as code
;;tmux ; an API for interacting with tmux
upload ; map local to remote projects via ssh/ftp
:lang :lang
;;agda ; types of types of types of types... (cc +lsp)
assembly ; assembly for fun or debugging clojure
(cc +lsp) ; C/C++/Obj-C madness common-lisp
clojure ; java with a lisp data
common-lisp ; if you've seen one lisp, you've seen them all (dart +flutter)
;;coq ; proofs-as-programs emacs-lisp
;;crystal ; ruby at the speed of c ess
csharp ; unity, .NET, and mono shenanigans (gdscript +lsp)
data ; config/data formats (latex +latexmk)
(dart +flutter) ; paint ui and not much else lua
;;elixir ; erlang done right markdown
;;elm ; care for a cup of TEA? nix
emacs-lisp ; drown in parentheses
;;erlang ; an elegant language for a more civilized age
ess ; emacs speaks statistics
;;faust ; dsp, but you get to keep your soul
;;fsharp ; ML stands for Microsoft's Language
;;fstar ; (dependent) types and (monadic) effects and Z3
(gdscript +lsp) ; the language I waited for
;;(go +lsp) ; the hipster dialect
;;(haskell +dante) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python
;;idris ;
;;(java +meghanada) ; the poster child for carpal tunnel syndrome
;;javascript ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script)
(latex +latexmk) ; writing papers in Emacs has never been so fun
;;lean
;;factor
;;ledger ; an accounting system in Emacs
lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore
nim ; python + lisp at the speed of c
nix ; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel
(org +gnuplot (org +gnuplot
+dragndrop
+hugo +hugo
+journal +journal
+noter +noter
+pandoc +pandoc
+present) ; organize your plain life in plain text +present
raku ; write code no one else can comprehend +pretty
;;php ; perl's insecure younger brother +roam2)
;;plantuml ; diagrams for confusing people more raku
;;purescript ; javascript, but functional
(python +lsp (python +lsp
+pyright +pyright
+cython) ; beautiful is better than ugly +cython)
;;qt ; the 'cutest' gui framework ever racket
racket ; a DSL for DSLs (ruby +rails)
;;rest ; Emacs as a REST client (rust +lsp)
;;rst ; ReST in peace scheme
(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} sh
(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() web
;;scala ; java, but good
scheme ; a fully conniving family of lisps
sh ; she sells {ba,z,fi}sh shells on the C xor
;;sml
;;solidity ; do you need a blockchain? No.
;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance.
web ; the tubes
:email
;;(mu4e +gmail)
;;notmuch
;;(wanderlust +gmail)
:app
;;calendar
;;irc ; how neckbeards socialize
;;(rss +org) ; emacs as an RSS reader
;;twitter ; twitter client https://twitter.com/vnought
:config :config
;;literate
(default +bindings +smartparens) (default +bindings +smartparens)
;; My custom modules should be placed here.
:tools :tools
(wiki +anki (wiki +anki
+biblio +biblio

View File

@ -4,36 +4,36 @@
#+language: en #+language: en
* Description * Description
This module set up my personal wiki configuration with Emacs primarily with org-roam. This module set up my personal wiki configuration with Emacs primarily with org-roam.
Just like Emacs itself, tried my best to make it fully configurable. Just like Emacs itself, tried my best to make it fully configurable.
The setup uses org-roam v2. The setup uses org-roam v2.
This module assumes that the wiki is used for multiple purposes such as managing different types of notes such as literature notes.
In addition, it can also manage your cards with a single flag toggle away.
** Module flags ** Module flags
- ~+anki~ enables Anki cards editing with [[https://github.com/louietan/anki-editor/][anki-editor]]. - ~+anki~ enables Anki cards editing with [[https://github.com/louietan/anki-editor/][anki-editor]].
- ~+biblio~ enables reference management with [[https://github.com/jkitchin/org-ref][org-ref]] and [[https://github.com/org-roam/org-roam-bibtex][org-roam-bibtex]]. - ~+biblio~ enables reference management with [[https://github.com/jkitchin/org-ref][org-ref]] and [[https://github.com/org-roam/org-roam-bibtex][org-roam-bibtex]].
- ~+dendron~ adds [[https://dendron.so/][Dendron]]-inspired features with [[https://github.com/vicrdguez/dendroam][dendroam]]. - ~+dendron~ adds [[https://dendron.so/][Dendron]]-inspired features with [[https://github.com/vicrdguez/dendroam][dendroam]].
- ~+graph~ adds a graphical user interface for your notes. - ~+graph~ adds a graphical user interface for your notes.
- ~+markdown~ adds Markdown support in org-roam. - ~+markdown~ adds Markdown support in org-roam.
** Plugins ** Plugins
- [[https://github.com/org-roam/org-roam/][org-roam]] v2 - [[https://github.com/org-roam/org-roam/][org-roam]] v2
- =+anki=
- [[https://github.com/louietan/anki-editor/][anki-editor]] - [[https://github.com/louietan/anki-editor/][anki-editor]]
- =+dendroam=
- [[https://github.com/vicrdguez/dendroam][dendroam]] - [[https://github.com/vicrdguez/dendroam][dendroam]]
- =+markdown=
- [[https://github.com/nobiot/md-roam][md-roam]] - [[https://github.com/nobiot/md-roam][md-roam]]
- =+biblio=
- [[https://github.com/jkitchin/org-ref][org-ref]] - [[https://github.com/jkitchin/org-ref][org-ref]]
- [[https://github.com/org-roam/org-roam-bibtex][org-roam-bibtex]] - [[https://github.com/org-roam/org-roam-bibtex][org-roam-bibtex]]
- =+graph=
- [[https://github.com/org-roam/org-roam-ui][org-roam-ui]] - [[https://github.com/org-roam/org-roam-ui][org-roam-ui]]
* Prerequisites * Prerequisites
This module has a handful of requirements to work properly. This module has a handful of requirements to work properly.

View File

@ -27,9 +27,13 @@
"Setup the variables for the wiki config." "Setup the variables for the wiki config."
(setq +wiki-bibliography-file (f-join +wiki-directory +wiki-references-filename) (setq +wiki-bibliography-file (f-join +wiki-directory +wiki-references-filename)
+wiki-bibliography-note (f-join +wiki-directory +wiki-bibliography-note-filename) +wiki-bibliography-note (f-join +wiki-directory +wiki-bibliography-note-filename)
org-cite-global-bibliography `(,+wiki-bibliography-file) org-cite-global-bibliography `(,+wiki-bibliography-file)
org-ref-default-bibliography +wiki-bibliography-file
org-ref-bibliography-notes +wiki-bibliography-note citar-bibliography `(,+wiki-bibliography-file)
citar-notes-paths `(,+wiki-directory)
citar-open-note-function 'orb-citar-edit-note
bibtex-completion-bibliography +wiki-bibliography-file bibtex-completion-bibliography +wiki-bibliography-file
bibtex-completion-notes-path +wiki-directory)) bibtex-completion-notes-path +wiki-directory))
@ -37,20 +41,22 @@
:after org-roam :after org-roam
:preface :preface
:config :config
(require 'org-ref)
(+wiki/biblio-setup))) (+wiki/biblio-setup)))
(when (featurep! +anki) (when (featurep! +anki)
(defvar +anki-cards-directory-name "cards") (defvar +anki-cards-directory-name "cards")
(defvar +anki-cards-directory (f-join +wiki-directory +anki-cards-directory-name)) (defvar +anki-cards-directory (f-join +wiki-directory +anki-cards-directory-name))
(defun +anki-editor-push-all-notes-to-anki () (defun +anki-editor-push-all-notes-to-anki ()
(interactive) (interactive)
(anki-editor-push-notes nil nil (directory-files-recursively +anki-cards-directory "\\.*org" nil))) (anki-editor-push-notes nil nil (directory-files-recursively +anki-cards-directory "\\.*org" nil)))
(defun +anki-editor-reset-note () (defun +anki-editor-reset-note ()
"Reset the Anki note in point by deleting the note ID and the deck." "Reset the Anki note in point by deleting the note ID and the deck."
(interactive) (interactive)
(org-entry-delete (point) anki-editor-prop-note-id) (org-entry-delete (point) anki-editor-prop-note-id)
(org-entry-delete (point) anki-editor-prop-deck)) (org-entry-delete (point) anki-editor-prop-deck))
(defun +anki-editor-reset-all-notes () (defun +anki-editor-reset-all-notes ()
"Reset the Anki notes in the current buffer by deleting the note ID and the deck." "Reset the Anki notes in the current buffer by deleting the note ID and the deck."
(interactive) (interactive)
@ -60,9 +66,11 @@
:hook (org-mode . anki-editor-mode) :hook (org-mode . anki-editor-mode)
:preface :preface
(defvar +wiki-directory nil) (defvar +wiki-directory nil)
:init :init
(map! :localleader (map!
:map org-roam-mode-map :map org-roam-mode-map
:localleader
(:prefix ("C" . "Anki cards") (:prefix ("C" . "Anki cards")
:desc "Push all cards in current document" :n "p" #'anki-editor-push-notes :desc "Push all cards in current document" :n "p" #'anki-editor-push-notes
:desc "Push all cards in cards directory to Anki" :n "P" #'+anki-editor-push-all-notes-to-anki :desc "Push all cards in cards directory to Anki" :n "P" #'+anki-editor-push-all-notes-to-anki
@ -72,6 +80,7 @@
:desc "Export the subtree as HTML" :n "e" #'anki-editor-export-subtree-to-html :desc "Export the subtree as HTML" :n "e" #'anki-editor-export-subtree-to-html
:desc "Remove all anki-editor-related properties in a card" :n "d" #'+anki-editor-reset-note :desc "Remove all anki-editor-related properties in a card" :n "d" #'+anki-editor-reset-note
:desc "Remove all properties in all notes" :n "D" #'+anki-editor-reset-all-notes)) :desc "Remove all properties in all notes" :n "D" #'+anki-editor-reset-all-notes))
:config :config
(setq anki-editor-create-decks 't (setq anki-editor-create-decks 't
+anki-cards-directory (f-join +wiki-directory +anki-cards-directory-name)))) +anki-cards-directory (f-join +wiki-directory +anki-cards-directory-name))))

View File

@ -6,8 +6,6 @@
:recipe (:host github :repo "org-roam/org-roam")) :recipe (:host github :repo "org-roam/org-roam"))
(when (featurep! +biblio) (when (featurep! +biblio)
(package! org-ref
:recipe (:host github :repo "jkitchin/org-ref"))
(package! org-roam-bibtex (package! org-roam-bibtex
:recipe (:host github :repo "org-roam/org-roam-bibtex"))) :recipe (:host github :repo "org-roam/org-roam-bibtex")))