302 lines
8.8 KiB
Org Mode
302 lines
8.8 KiB
Org Mode
* Table of Contents :TOC:
|
|
- [[#misc][Misc]]
|
|
- [[#appearance][Appearance]]
|
|
- [[#font][Font]]
|
|
- [[#theme][Theme]]
|
|
- [[#line-numbers][Line numbers]]
|
|
- [[#battery-indicator][Battery indicator]]
|
|
- [[#current-line][Current line]]
|
|
- [[#programming][Programming]]
|
|
- [[#lsp][LSP]]
|
|
- [[#rust][Rust]]
|
|
- [[#cc][C/C++]]
|
|
- [[#org-mode][Org mode]]
|
|
- [[#agenda-setup][Agenda setup]]
|
|
- [[#journal][Journal]]
|
|
- [[#org-ids][Org IDs]]
|
|
- [[#roam][Roam]]
|
|
- [[#doom-specific][Doom specific]]
|
|
|
|
* Misc
|
|
|
|
Enable lexical binding, of course...
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
;;; -*- lexical-binding: t; -*-
|
|
#+END_SRC
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(setq enable-dir-local-variables nil)
|
|
#+END_SRC
|
|
|
|
* Appearance
|
|
|
|
** Font
|
|
|
|
Doom exposes five (optional) variables for controlling fonts in Doom. Here are
|
|
the three important ones:
|
|
|
|
- =doom-font=
|
|
- =doom-variable-pitch-font=
|
|
- =doom-big-font= -- used for =doom-big-font-mode=; use this for presentations
|
|
or streaming.
|
|
|
|
They all accept either a font-spec, font string (=Input Mono-12=), or xlfd font
|
|
string. You generally only need these two:
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(setq doom-font (font-spec :family "Input Mono Narrow Medium" :size 12))
|
|
#+END_SRC
|
|
|
|
** Theme
|
|
|
|
A list of all doom themes can be found here:
|
|
|
|
https://github.com/hlissner/emacs-doom-themes
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(setq doom-theme 'doom-one)
|
|
#+END_SRC
|
|
|
|
** Line numbers
|
|
|
|
Possible values of =display-line-numbers-type= are =nil=, =t=, and ='relative=.
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(setq display-line-numbers-type 'relative)
|
|
#+END_SRC
|
|
|
|
** Battery indicator
|
|
|
|
I'm on a laptop, so let's display my battery in the modeline:
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(display-battery-mode 1)
|
|
#+END_SRC
|
|
|
|
** Current line
|
|
|
|
Always highlight the current line:
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(global-hl-line-mode +1)
|
|
#+END_SRC
|
|
|
|
* Programming
|
|
|
|
** LSP
|
|
|
|
Doom disables documentation display in child frames by default; I like those, so
|
|
re-enable them, and reset [[https://github.com/emacs-lsp/lsp-ui/blob/242dfe859c3497c456eaacfd84942e12419529fe/lsp-ui-doc.el#L84][the defaults]].
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(after! lsp-ui
|
|
(setq lsp-ui-doc-max-width 150)
|
|
(setq lsp-ui-doc-max-height 30)
|
|
(setq lsp-ui-doc-enable t))
|
|
#+END_SRC
|
|
|
|
** Rust
|
|
|
|
By default =rustic-mode= uses =rls=, I want to use =rust-analyzer= instead.
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(setq rustic-lsp-server 'rust-analyzer)
|
|
#+END_SRC
|
|
|
|
I don't want to enable format-on-save globally in Doom, but having it in rust is
|
|
nice.
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(after! rustic
|
|
(setq rustic-format-trigger 'on-save))
|
|
#+END_SRC
|
|
|
|
** C/C++
|
|
|
|
Setup the default format for C/C++ editing.
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(setq c-default-style "gnu")
|
|
(setq c-basic-offset 2)
|
|
#+END_SRC
|
|
|
|
Flycheck never works well for C / C++ without configuration or a CMake build
|
|
system. Let's disable it.
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(after! flycheck
|
|
(setq flycheck-global-modes '(not c-mode c++-mode)))
|
|
#+END_SRC
|
|
|
|
* Org mode
|
|
|
|
** Agenda setup
|
|
|
|
Here are the [[https://orgmode.org/manual/TODO-Extensions.html#TODO-Extensions][keywords]] I'm using to track task progress. I'm also making use of
|
|
some automatic [[https://orgmode.org/manual/Tracking-TODO-state-changes.html#Tracking-TODO-state-changes][state changes]].
|
|
|
|
| keyword | meaning |
|
|
|-------------+--------------------------------------------------------------------------|
|
|
| =TODO= | Self explanatory |
|
|
| =WAITING= | I'm probably waiting on someone to do something before I can act on this |
|
|
| =DONE= | This task is finished, no longer displayed in the agenda |
|
|
| =CANCELLED= | This task isn't finished but is no longer relevant |
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(after! org
|
|
(setq org-todo-keywords
|
|
'((sequence
|
|
"TODO(t)"
|
|
"WAITING(w@/!)"
|
|
"|"
|
|
"DONE(d!)"
|
|
"CANCELLED(c@/!)")
|
|
(sequence
|
|
"[ ](T)"
|
|
"[-](S)"
|
|
"[?](W)"
|
|
"|"
|
|
"[X](D)"))))
|
|
#+END_SRC
|
|
|
|
Of course I also need to setup [[https://orgmode.org/manual/Capture-templates.html][capture templates]]:
|
|
|
|
The first one just prompts me for a new task to add to my inbox, I can then
|
|
[[https://orgmode.org/guide/Refile-and-Copy.html][refile]] them where I want later.
|
|
|
|
The second one exists because I like to keep a separate list of articles /
|
|
papers / books to read.
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(after! org
|
|
(setq org-capture-templates
|
|
'(("t" "Task" entry (file "inbox.org")
|
|
"* TODO %?")
|
|
("r" "Reading" entry (file "reading.org")
|
|
"* TODO %x"))))
|
|
#+END_SRC
|
|
|
|
All these tasks, once captured, are then centralized in my [[https://orgmode.org/guide/Agenda-Views.html][agenda view]].
|
|
|
|
I'm using multiple categories to organize tasks, depending on their triage /
|
|
status (inspired by [[https://blog.jethro.dev/posts/org_mode_workflow_preview/]]).
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(after! org-agenda
|
|
(setq org-agenda-custom-commands
|
|
'((" " "Agenda"
|
|
((agenda ""
|
|
((org-agenda-span 'day)
|
|
(org-agenda-start-day nil)
|
|
(org-deadline-warning-days 365)))
|
|
(todo "TODO"
|
|
((org-agenda-overriding-header "Triage")
|
|
(org-agenda-files '("~/org/inbox.org"))))
|
|
(todo "TODO"
|
|
((org-agenda-overriding-header "School")
|
|
(org-agenda-files '(
|
|
"~/org/image.org"
|
|
"~/org/rdi.org"
|
|
))))
|
|
(todo "TODO"
|
|
((org-agenda-overriding-header "Tasks")
|
|
(org-agenda-files '("~/org/tasks.org"))
|
|
(org-agenda-skip-function '(org-agenda-skip-entry-if 'deadline
|
|
'scheduled))))
|
|
(todo "TODO"
|
|
((org-agenda-files '("~/org/reading.org"))
|
|
(org-agenda-overriding-header "To Read")))
|
|
(todo "TODO"
|
|
((org-agenda-files '("~/org/project.org"))
|
|
(org-agenda-overriding-header "Personal projects")))
|
|
)))))
|
|
#+END_SRC
|
|
|
|
I want the default agenda view to be a weekly view, with a log of what I've done
|
|
during the day.
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(after! org-agenda
|
|
(setq org-agenda-span 'week)
|
|
(setq org-agenda-start-on-weekday 1)
|
|
(setq org-agenda-start-with-log-mode '(clock)))
|
|
#+END_SRC
|
|
|
|
I also remove the block separators in the agenda view:
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(after! org-agenda
|
|
(setq org-agenda-block-separator ""))
|
|
#+END_SRC
|
|
|
|
** Journal
|
|
|
|
For [[https://github.com/bastibe/org-journal][org-journal]] I want weekly entries (the default is ='daily=).
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(after! org-journal
|
|
(setq org-journal-date-format "%A (%d/%m/%Y)")
|
|
(setq org-journal-file-type 'weekly)
|
|
(setq org-journal-file-format "%Y-%m-%d.org")
|
|
|
|
;; see `org-journal-dir-and-format->regex' documentation
|
|
(setq org-journal-file-pattern (org-journal-dir-and-format->regex
|
|
org-journal-dir org-journal-file-format))
|
|
(add-to-list 'auto-mode-alist (cons org-journal-file-pattern 'org-journal-mode)))
|
|
#+END_SRC
|
|
|
|
** Org IDs
|
|
|
|
Org can link to entries using UUIDs, but we need the module to be loaded for
|
|
links to work:
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(add-to-list 'org-modules 'org-id)
|
|
#+END_SRC
|
|
|
|
** Roam
|
|
|
|
Setup for [[https://github.com/jethrokuan/org-roam][org-roam]].
|
|
|
|
First, set a directory where =org-roam= will index things.
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(setq org-roam-directory (expand-file-name "notes/" org-directory))
|
|
#+END_SRC
|
|
|
|
Customize the capture templates:
|
|
|
|
- the first one is [[https://github.com/jethrokuan/org-roam/blob/772505ba70c073ebc7905c4fcb8b9cc3759c775a/org-roam-capture.el#L81][the default one]], I just removed the timestamp from the file
|
|
title.
|
|
- the second one I use to create new entries about website links, blog posts,
|
|
articles... The ~%x~ in the template is replaced by the content of my X
|
|
clipboard, so I just have to copy the website URL before capturing it.
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(after! org-roam
|
|
(set-face-attribute 'org-roam-link nil :foreground "#CCCC60")
|
|
(setq org-roam-capture-templates
|
|
'(("d" "default" plain (function org-roam-capture--get-point)
|
|
"%?"
|
|
:file-name "${slug}"
|
|
:head "#+TITLE: ${title}\n"
|
|
:unnarrowed t)
|
|
("w" "website" plain (function org-roam-capture--get-point)
|
|
""
|
|
:file-name "websites/${slug}"
|
|
:head "#+TITLE: ${title}\n#+ROAM_KEY: %x\n"
|
|
:unnarrowed t))))
|
|
#+END_SRC
|
|
|
|
** Doom specific
|
|
|
|
Doom replaces the default tab behavior on headings, this restores the default
|
|
one. Taken from [[https://github.com/hlissner/doom-emacs/tree/develop/modules/lang/org#hacks][here]].
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(after! evil-org
|
|
(remove-hook 'org-tab-first-hook #'+org-cycle-only-current-subtree-h))
|
|
#+END_SRC
|