diff options
| author | 2026-10-21 11:21:25 -0700 | |
|---|---|---|
| committer | 2026-11-27 22:50:55 -0700 | |
| commit | 60a3ac3f063d26124e8b139c5ba16cc55cdd9ebd (patch) | |
| tree | 5e7bbfd4acba74dbe4d40490d3159f2d2b6b87b0 /emacs | |
| parent | 2190716716d4f24dc991db945d061a3e0cef5e6d (diff) | |
| download | new-dotfiles-60a3ac3f063d26124e8b139c5ba16cc55cdd9ebd.tar.gz new-dotfiles-60a3ac3f063d26124e8b139c5ba16cc55cdd9ebd.zip | |
Emacs: Add some org customizations from oni-org
Diffstat (limited to 'emacs')
| -rw-r--r-- | emacs/.emacs.d/init.org | 111 |
1 files changed, 94 insertions, 17 deletions
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 97cf534..2bb72f5 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -530,6 +530,17 @@ Also install =markdown-indent-mode= which is very much like =org-indent-mode= (b I like using org-mode to write in. This entire configuration is written as a literate org-mode document. +- =org-archive-location= :: Make a new archive for each year so the file never grows too large and needs to be shrunk. +- =org-extend-today-until= :: I frequently stay up past midnight and with this setting if I complete a task at 1am it still counts as the day before I went to sleep. +- =org-special-ctrl-a/e= :: Make =C-a= and =C-e= jump to the start and end of headlines first, before going to the start and end of lines. Press =C-a= once to go to the start of the headline text, after any =****= that might be there, and a second time to go to the start of the line (before the =****=). Press =C-e= onse to go to the end of the healine text, before any tags, and a second time to go to the end of the line (after tags). +- =org-special-ctrl-k= :: Make =C-k= a little more intelligent about what to delete in headlines. Discovered [[https://github.com/novoid/dot-emacs/blob/23c28944f1991c636ea71ec7d5c3d266e6dbeb8a/config.org#general-org-mode-settings][here]]. +- =org-src-fontify-natively= :: Show code blocks fontified by their respective major modes. +- =org-tags-column= :: Right-align the tags in a headline (somewhat). +- =org-tags-exclude-from-inheritance= :: A child of a project is not a project itself, so don't let this tag be inherited. +- =org-tags-sort-function= :: Sort all the tags alphabetically when they're inserted. +- =org-use-fast-todo-selection= :: Make todo state selection faster. Instead of cycling through them all show a list of them with prefix keys that can be used to set the state. This does require that at least one state has a shortcut key defined, the rest can be inferred. +- =org-use-sub-superscripts= :: Require that ={}= be used to group a sub- or superscript text together. I do run into the need to have =_= characters in words sometimes, and not always as code, so if it tries to do it without the delimiters it gets in my way sometimes. + #+begin_src emacs-lisp (use-package org :init (define-key global-map (kbd "C-c o") (make-sparse-keymap)) @@ -537,10 +548,28 @@ I like using org-mode to write in. This entire configuration is written as a lit ("C-c o a" . org-agenda) ("C-c o l" . org-store-link) ("C-c o b" . org-switchb)) + :custom + (org-archive-location (format-time-string "%%s_archive_%Y::")) + (org-extend-today-until 4) + (org-special-ctrl-a/e t) + (org-special-ctrl-k t) + (org-src-fontify-natively t) + (org-tags-column -80) + (org-tags-exclude-from-inheritance '("project")) + (org-tags-sort-function #'string<) + (org-use-fast-todo-selection t) + (org-use-sub-superscripts '{}) :config - (add-hook 'org-mode-hook 'visual-line-mode) - (add-hook 'org-mode-hook 'org-indent-mode)) + (add-hook 'org-mode-hook 'visual-line-mode)) +#+end_src +Set some capture templates. + +- =t= :: Just a simple TODO item. +- =d= :: An item I've already completed. +- =N= :: A note inserted into the currently clocked-in item. Good for when I'm logging that I'm working on something and I need to add some context to what's going on. + +#+begin_src emacs-lisp (use-package org-capture :config (map-put org-capture-templates "t" @@ -553,26 +582,74 @@ I like using org-mode to write in. This entire configuration is written as a lit :PROPERTIES: :CREATED: %U :END:")) - (map-put org-capture-templates "n" - '("A simple note" entry (file "") "* Note taken on %U - :PROPERTIES: - :CREATED: %U - :END: - - %?")) (map-put org-capture-templates "N" '("A simple note (on current task)" item (clock) "- Note taken on %U: \\\\ - %?")) - (map-put org-capture-templates "r" - '("An Operational Request came in" entry (file "") "* TODO Operation Request %^U - :PROPERTIES: - :CREATED: %U - :END: + %?"))) +#+end_src + +This sets up some hooks so that when I clock in to a task it's automatically moved to the next "in-progress" state, and when I clock out it might be changed back to TODO. + +#+begin_src emacs-lisp + (use-package org-clock + :custom + (org-clock-in-switch-to-state #'oni-org-maybe-change-to-wip-state) + (org-clock-out-switch-to-state #'oni-org-maybe-change-to-todo-state) + :config + (defun oni-org-maybe-change-to-wip-state (current-state) + "Change the state of the current task to in-progress CURRENT-STATE is todo." + (if (and (not org-capture-mode) + (member current-state org-todo-heads)) + (cadr (member current-state org-todo-keywords-1)) + current-state)) + + (defun oni-org-maybe-change-to-todo-state (current-state) + "Change the state of the current task to in-progress CURRENT-STATE is wip." + (if (and (not org-capture-mode) + (equal current-state (cadr org-todo-keywords-1))) + (car org-todo-keywords-1) + current-state))) +#+end_src + +This just changes the setting =org-fold-catch-invisible-edits= so that an error is thrown when I try to type in an area that's hidden by org-mode. I usually find that I have trouble reasoning about where this text will actually appear, and visually it doesn't always expand the headings right, so I prefer just not being able to type there and having to expand the section manually first. + +#+begin_src emacs-lisp + (use-package org-fold + :custom + (org-fold-catch-invisible-edits 'error)) +#+end_src - %c"))) +Automatically renumber footnotes when new ones are added or old ones removed. + +#+begin_src emacs-lisp + (use-package org-footnote + :custom + (org-footnote-auto-adjust t)) +#+end_src + +Display the habit consistency graph a little bit further away to give the task name a bit more breathing room. + +#+begin_src emacs-lisp + (use-package org-habit + :custom + (org-habit-graph-column 80)) +#+end_src + +Enable Org indent to make org documents look nice, without storing the actual formatting in the file. + +#+begin_src emacs-lisp + (use-package org-indent + :hook (org-mode)) +#+end_src + +Open links just by pressing =RET=, not only =C-c o=. + +#+begin_src emacs-lisp + (use-package org-keys + :custom + (org-return-follows-link t)) #+end_src -** Org-Caldav +** Caldav This allows me to synchronize tasks and events between my phone and Emacs. |
