From ddc78add9022cb7b1580f933b21249202b6471a3 Mon Sep 17 00:00:00 2001 From: Inhji Date: Mon, 5 Feb 2024 13:22:49 +0100 Subject: [PATCH] emacs: add config wide paths to important files --- config/dot_config/doom/config.el | 36 ++++++++++++------ config/dot_config/doom/config.org | 61 ++++++++++++++++++++++--------- 2 files changed, 68 insertions(+), 29 deletions(-) diff --git a/config/dot_config/doom/config.el b/config/dot_config/doom/config.el index bc5b745..f772326 100644 --- a/config/dot_config/doom/config.el +++ b/config/dot_config/doom/config.el @@ -1,14 +1,20 @@ ;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- -;; config.el (setq user-full-name "Jonathan Jenne" user-mail-address "johnnie@posteo.de") +(setq +user-org-path "~/Notes/Org" + +user-org-todo-file "Todo.org" + +user-org-notes-file "Notes.org" + +user-org-journal-file "Journal.org") + (setq shell-file-name (executable-find "bash")) (setq display-line-numbers-type t) (setq doom-theme 'doom-one) +(setq org-src-tab-acts-natively t) + (after! org (setq org-agenda-show-all-dates nil org-agenda-span 2 @@ -22,21 +28,29 @@ "◀── now ──────────────────────────────────────────────── \\o/" org-agenda-block-separator ?─ ;; Consider all org files part of the org-agenda - org-agenda-files (list "~/Notes/Org"))) + org-agenda-files (list +user-org-path))) (setq org-auto-tangle-default nil) -(after! org (setq +org-capture-notes-file "Notes.org" - +org-capture-todo-file "Todo.org")) +(after! org (setq +org-capture-notes-file (expand-file-name +user-org-notes-file +user-org-path) + +org-capture-todo-file (expand-file-name +user-org-todo-file +user-org-path) + +org-capture-journal-file (expand-file-name +user-org-journal-file +user-org-path))) -(setq org-directory "~/Notes/Org") +(setq org-capture-templates + '(("t" "Personal todo" entry + (file+headline +org-capture-todo-file "Inbox") + "* TODO %?\n" :prepend t) + + ("n" "Personal notes" entry + (file+headline +org-capture-notes-file "Inbox") + "* %u %?\n" :prepend t) + + ("j" "Journal" entry + (file+olp+datetree +org-capture-journal-file) + "* %U %?\n" :prepend t))) + +(setq org-directory +user-org-path) (add-hook 'org-mode-hook #'org-modern-mode) (add-hook 'org-agenda-finalize-hook #'org-modern-agenda) (add-hook 'org-mode-hook 'org-auto-tangle-mode) - -(setq org-journal-date-prefix "#+TITLE: " - org-journal-time-prefix "* " - org-journal-date-format "%a, %Y-%m-%d" - org-journal-file-format "%Y/%m/%Y-%m-%d.org" - org-journal-dir "~/Notes/Org/Journal") diff --git a/config/dot_config/doom/config.org b/config/dot_config/doom/config.org index 1bfdbd1..1ac67a0 100644 --- a/config/dot_config/doom/config.org +++ b/config/dot_config/doom/config.org @@ -5,33 +5,37 @@ * Table of contents :toc: - [[#notes][Notes]] -- [[#base-setup][Base Setup]] +- [[#config-basics][Config Basics]] - [[#appearance][Appearance]] - [[#org-mode][Org Mode]] + - [[#org-basics][Org Basics]] - [[#org-agenda][Org Agenda]] - [[#org-auto-tangle][Org Auto Tangle]] - [[#org-capture][Org Capture]] - [[#org-directory][Org Directory]] - [[#org-hooks][Org Hooks]] - - [[#org-journal][Org Journal]] * Notes Remember, you do not need to run 'doom sync' after modifying this file! -* Base Setup +* Config Basics This codeblock should be the first in this file! #+begin_src emacs-lisp ;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- -;; config.el #+end_src #+begin_src emacs-lisp (setq user-full-name "Jonathan Jenne" user-mail-address "johnnie@posteo.de") +(setq +user-org-path "~/Notes/Org" + +user-org-todo-file "Todo.org" + +user-org-notes-file "Notes.org" + +user-org-journal-file "Journal.org") + (setq shell-file-name (executable-find "bash")) #+end_src @@ -44,8 +48,17 @@ This codeblock should be the first in this file! * Org Mode +** Org Basics +*** TAB uses the language's major-mode binding in code blocks + +#+begin_src emacs-lisp +(setq org-src-tab-acts-natively t) +#+end_src + ** Org Agenda +To have a less overwhelming agenda, show only TODOs for today and tomorrow. DONE items are not interesting, so they are also hidden. + #+begin_src emacs-lisp (after! org (setq org-agenda-show-all-dates nil @@ -60,26 +73,48 @@ This codeblock should be the first in this file! "◀── now ──────────────────────────────────────────────── \\o/" org-agenda-block-separator ?─ ;; Consider all org files part of the org-agenda - org-agenda-files (list "~/Notes/Org"))) + org-agenda-files (list +user-org-path))) #+end_src ** Org Auto Tangle +Only tangle org files where it has been explicitly enabled, like this config file + #+begin_src emacs-lisp (setq org-auto-tangle-default nil) #+end_src ** Org Capture +*** Capture Files + #+begin_src emacs-lisp -(after! org (setq +org-capture-notes-file "Notes.org" - +org-capture-todo-file "Todo.org")) +(after! org (setq +org-capture-notes-file (expand-file-name +user-org-notes-file +user-org-path) + +org-capture-todo-file (expand-file-name +user-org-todo-file +user-org-path) + +org-capture-journal-file (expand-file-name +user-org-journal-file +user-org-path))) +#+end_src + +*** Capture Templates + +#+begin_src emacs-lisp +(setq org-capture-templates + '(("t" "Personal todo" entry + (file+headline +org-capture-todo-file "Inbox") + "* TODO %?\n" :prepend t) + + ("n" "Personal notes" entry + (file+headline +org-capture-notes-file "Inbox") + "* %u %?\n" :prepend t) + + ("j" "Journal" entry + (file+olp+datetree +org-capture-journal-file) + "* %U %?\n" :prepend t))) #+end_src ** Org Directory #+begin_src emacs-lisp -(setq org-directory "~/Notes/Org") +(setq org-directory +user-org-path) #+end_src ** Org Hooks @@ -90,13 +125,3 @@ This codeblock should be the first in this file! (add-hook 'org-mode-hook 'org-auto-tangle-mode) #+end_src -** Org Journal - -#+begin_src emacs-lisp -(setq org-journal-date-prefix "#+TITLE: " - org-journal-time-prefix "* " - org-journal-date-format "%a, %Y-%m-%d" - org-journal-file-format "%Y/%m/%Y-%m-%d.org" - org-journal-dir "~/Notes/Org/Journal") -#+end_src -