Adding performance tweaks through use-package and gcs

This commit is contained in:
Chris Cochrun 2021-02-17 06:57:57 -06:00
parent a55ff13fb3
commit 96ecdb6cf2
2 changed files with 281 additions and 181 deletions

View file

@ -2,73 +2,63 @@
#+AUTHOR: Chris Cochrun #+AUTHOR: Chris Cochrun
* Table of Contents :toc: * Table of Contents :toc:
- [[#early-init][Early Init]]
- [[#init][Init]] - [[#init][Init]]
- [[#set-basic-ui-config][Set basic UI config]]
- [[#startup-performance][Startup Performance]] - [[#startup-performance][Startup Performance]]
- [[#keep-folders-clean][Keep Folders Clean]]
- [[#set-basic-ui-config][Set basic UI config]]
- [[#lets-bootstrap-straightel][Let's bootstrap straight.el]] - [[#lets-bootstrap-straightel][Let's bootstrap straight.el]]
- [[#keybindings][Keybindings]] - [[#keybindings][Keybindings]]
- [[#undo-tree][Undo-Tree]]
- [[#better-ui][Better UI]] - [[#better-ui][Better UI]]
- [[#completion][Completion]] - [[#completion][Completion]]
- [[#help][Help]] - [[#help][Help]]
- [[#format][Format]] - [[#format][Format]]
- [[#org-mode][Org Mode]] - [[#org-mode][Org Mode]]
- [[#magit][Magit]] - [[#magit][Magit]]
- [[#garbage-collection][Garbage Collection]]
- [[#early-init][Early Init]]
* Early Init
#+PROPERTY: header-args:emacs-lisp :tangle early-init.el
As of right now I haven't fully setup my early-init file, this does not export into the early-init.el file currently as it's just a copy from Doom's early-init.
#+begin_src emacs-lisp :tangle no
;;; early-init.el -*- lexical-binding: t; -*-
;; Emacs 27.1 introduced early-init.el, which is run before init.el, before
;; package and UI initialization happens, and before site files are loaded.
;; A big contributor to startup times is garbage collection. We up the gc
;; threshold to temporarily prevent it from running, then reset it later by
;; enabling `gcmh-mode'. Not resetting it will cause stuttering/freezes.
(setq gc-cons-threshold most-positive-fixnum)
;; In noninteractive sessions, prioritize non-byte-compiled source files to
;; prevent the use of stale byte-code. Otherwise, it saves us a little IO time
;; to skip the mtime checks on every *.elc file.
(setq load-prefer-newer noninteractive)
;; In Emacs 27+, package initialization occurs before `user-init-file' is
;; loaded, but after `early-init-file'. Doom handles package initialization, so
;; we must prevent Emacs from doing it early!
(setq package-enable-at-startup nil)
(fset #'package--ensure-init-file #'ignore) ; DEPRECATED Removed in 28
;; `file-name-handler-alist' is consulted on every `require', `load' and various
;; path/io functions. You get a minor speed up by nooping this. However, this
;; may cause problems on builds of Emacs where its site lisp files aren't
;; byte-compiled and we're forced to load the *.el.gz files (e.g. on Alpine)
(unless (daemonp)
(defvar doom--initial-file-name-handler-alist file-name-handler-alist)
(setq file-name-handler-alist nil)
;; Restore `file-name-handler-alist' later, because it is needed for handling
;; encrypted or compressed files, among other things.
(defun doom-reset-file-handler-alist-h ()
;; Re-add rather than `setq', because changes to `file-name-handler-alist'
;; since startup ought to be preserved.
(dolist (handler file-name-handler-alist)
(add-to-list 'doom--initial-file-name-handler-alist handler))
(setq file-name-handler-alist doom--initial-file-name-handler-alist))
(add-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h))
;; Ensure Doom is running out of this file's directory
(setq user-emacs-directory (file-name-directory load-file-name))
;; Load the heart of Doom Emacs
(load (concat user-emacs-directory "core/core") nil 'nomessage)
#+end_src
* Init * Init
#+PROPERTY: header-args:emacs-lisp :tangle init.el :PROPERTIES:
:header-args: emacs-lisp :tangle init.el
:END:
This init section tangles out to =init.el=. We'll do most of our configuring here.
** Startup Performance
Let's create a message that will tell us how long it takes emacs to load in order to keep an eye on performance.
#+begin_src emacs-lisp
;;; init.el -*- lexical-binding: t; -*-
(defun chris/display-startup-time ()
(message "Emacs loaded in %s with %d garbage collections."
(format "%.2f seconds"
(float-time
(time-subtract after-init-time before-init-time)))
gcs-done))
(add-hook 'emacs-startup-hook #'chris/display-startup-time)
#+end_src
Let's also set the =gc-cons-threshold= variable to a high setting for the remainder of our setup process to speed things up.
#+begin_src emacs-lisp
(setq gc-cons-threshold 50000000)
#+end_src
** Keep Folders Clean
Let's setup a backup and auto-save location to keep our main directory clean. The autosave directory needs to be created first.
#+begin_src emacs-lisp :tangle no
(setq backup-directory-alist '(("." . "/home/chris/.dotemacs/tmp/backups/")))
(make-directory (expand-file-name "tmp/autosaves/" user-emacs-directory) t)
(setq auto-save-list-file-prefix (expand-file-name "tmp/autosaves/sessions/" user-emacs-directory)
auto-save-file-name-transforms '((".*" (expand-file-name "tmp/autosaves/" user-emacs-directory) t)))
#+end_src
** Set basic UI config ** Set basic UI config
Let's start by making some basic ui changes like turning off the scrollbar, toolbar, menu, tooltips, and setting our font and some things. Let's start by making some basic ui changes like turning off the scrollbar, toolbar, menu, tooltips, and setting our font and some things.
#+begin_src emacs-lisp #+begin_src emacs-lisp
;;; init.el -*- lexical-binding: t; -*-
(setq inhibit-startup-message t) (setq inhibit-startup-message t)
(scroll-bar-mode -1) (scroll-bar-mode -1)
@ -103,16 +93,6 @@ Also, real quick let's make sure that ~<escape>~ works as the same as ~<C-g>~
#+begin_src emacs-lisp #+begin_src emacs-lisp
(global-set-key (kbd "<escape>") 'keyboard-escape-quit) (global-set-key (kbd "<escape>") 'keyboard-escape-quit)
#+end_src #+end_src
** Startup Performance
#+begin_src emacs-lisp
(defun chris/display-startup-time ()
(message "Emacs loaded in %s with %d garbage collections."
(format "%.2f seconds"
(float-time
(time-subtract after-init-time before-init-time)))
gcs-done))
(add-hook 'emacs-startup-hook #'chris/display-startup-time)
#+end_src
** Let's bootstrap straight.el ** Let's bootstrap straight.el
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -132,10 +112,12 @@ Also, real quick let's make sure that ~<escape>~ works as the same as ~<C-g>~
(setq straight-use-package-by-default t) (setq straight-use-package-by-default t)
(straight-use-package 'use-package) (straight-use-package 'use-package)
(setq use-package-verbose t)
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package command-log-mode) (use-package command-log-mode
:commands command-log-mode)
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -164,14 +146,16 @@ Also, real quick let's make sure that ~<escape>~ works as the same as ~<C-g>~
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package adaptive-wrap) (use-package adaptive-wrap
:defer t)
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package which-key (use-package which-key
:init (which-key-mode) :config
:config (setq which-key-idle-delay 0.3)
(setq which-key-idle-delay 0.3)) (which-key-mode)
:defer 1)
#+end_src #+end_src
** Keybindings ** Keybindings
@ -186,7 +170,8 @@ There are two major packages we need to get the functionality I desire. Evil and
evil-respect-visual-line-mode t evil-respect-visual-line-mode t
evil-want-C-u-delete t) evil-want-C-u-delete t)
:config :config
(evil-mode +1)) (evil-mode +1)
(setq evil-undo-system 'undo-tree))
#+end_src #+end_src
This evil-collection package includes a lot of other evil based things. This evil-collection package includes a lot of other evil based things.
@ -236,10 +221,20 @@ This evil-collection package includes a lot of other evil based things.
:config (setq evil-escape-key-sequence "fd")) :config (setq evil-escape-key-sequence "fd"))
#+end_src #+end_src
** Undo-Tree
#+begin_src emacs-lisp
(use-package undo-tree
:defer 1)
#+end_src
** Better UI ** Better UI
*** Olivetti *** Olivetti
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package olivetti) (use-package olivetti
:after org
:config
(setq olivetti-body-width 0.6
olivetti-minimum-body-width 100))
#+end_src #+end_src
*** TOC-ORG *** TOC-ORG
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -263,7 +258,7 @@ I prefer selectrum over Ivy or Helm for completions. It is using the basic compl
"C-S-j" 'selectrum-goto-end "C-S-j" 'selectrum-goto-end
"C-S-k" 'selectrum-goto-beginning "C-S-k" 'selectrum-goto-beginning
"TAB" 'selectrum-insert-current-candidate) "TAB" 'selectrum-insert-current-candidate)
:commands (completing-read)) :commands completing-read)
#+END_SRC #+END_SRC
@ -345,7 +340,8 @@ This is similar but using mini-frame. Mini-frame works well, but not if using ex
*** CONSULT *** CONSULT
Consult has a lot of nice functions like Ivy's Counsel functions (enhanced searching functions), lets set some of them in the keymap so they are easily used. Consult has a lot of nice functions like Ivy's Counsel functions (enhanced searching functions), lets set some of them in the keymap so they are easily used.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package consult) (use-package consult
:after selectrum)
#+end_src #+end_src
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
@ -383,27 +379,34 @@ Marginalia makes for some great decoration to our minibuffer completion items. W
#+RESULTS: #+RESULTS:
** Help ** Help
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package helpful) (use-package helpful
:commands (helpful-callable helpful-variable helpful-command helpful-key))
#+end_src #+end_src
** Format ** Format
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package format-all (use-package format-all
:config :config
(format-all-mode +1)) (format-all-mode +1)
:defer 1)
#+end_src #+end_src
** Org Mode ** Org Mode
Need to setup auto tangle and make sure I have some structure templates for org-mode.
#+begin_src emacs-lisp
(use-package org
:config
(setq org-startup-indented t)
(defun chris/org-babel-tangle-config ()
(when (string-equal (buffer-file-name)
(expand-file-name "~/.personal-emacs/init.org"))
(let ((org-confirm-babel-evaluate nil))
(org-babel-tangle))))
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'chris/org-babel-tangle-config))) Let's start by creating a self contained function of what I'd like started on every org buffer.
#+begin_src emacs-lisp
(defun chris/org-mode-setup ()
(org-indent-mode +1)
(toc-org-mode +1)
(olivetti-mode +1))
#+end_src
This is the use-package definition with a lot of customization. Need to setup auto tangle and make sure I have some structure templates for org-mode.
#+begin_src emacs-lisp
(use-package org
:config
(setq org-startup-indented t
org-edit-src-content-indentation 0)
(add-hook 'org-mode-hook 'chris/org-mode-setup)
(org-babel-do-load-languages (org-babel-do-load-languages
'org-babel-load-languages 'org-babel-load-languages
@ -453,8 +456,6 @@ Need to setup auto tangle and make sure I have some structure templates for org-
org-capture-use-agenda-date t) org-capture-use-agenda-date t)
;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖")) ;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖"))
(setq olivetti-body-width 0.6)
(setq olivetti-minimum-body-width 100)
(setq org-imenu-depth 4) (setq org-imenu-depth 4)
(setq org-odt-styles-file "/home/chris/org/style.odt") (setq org-odt-styles-file "/home/chris/org/style.odt")
@ -463,10 +464,6 @@ Need to setup auto tangle and make sure I have some structure templates for org-
(sequence "[ ](T)" "[-](S)" "[?](W)" "|" "[X](D)"))) (sequence "[ ](T)" "[-](S)" "[?](W)" "|" "[X](D)")))
(add-hook 'org-mode-hook
(toc-org-mode +1)
(olivetti-mode +1))
(setq org-agenda-files (setq org-agenda-files
'("/home/chris/org/DMPREADME.org" "/home/chris/org/DMPTODO.org" "/home/chris/org/inbox.org" "/home/chris/org/notes.org" "/home/chris/org/repetition.org" "/home/chris/org/tasks.org" "/home/chris/org/tfc_plans.org" "/home/chris/org/ministry_team.org" "/home/chris/org/todo.org" "/home/chris/org/newsletter.org")) '("/home/chris/org/DMPREADME.org" "/home/chris/org/DMPTODO.org" "/home/chris/org/inbox.org" "/home/chris/org/notes.org" "/home/chris/org/repetition.org" "/home/chris/org/tasks.org" "/home/chris/org/tfc_plans.org" "/home/chris/org/ministry_team.org" "/home/chris/org/todo.org" "/home/chris/org/newsletter.org"))
(setq org-id-method 'ts) (setq org-id-method 'ts)
@ -490,6 +487,17 @@ We need to create a lesson capture function to find our lesson files differently
(search-forward "PLAN"))) (search-forward "PLAN")))
#+end_src #+end_src
We are also going to make our config auto-tangle. This is so helpful on saving the .org file tangles out the config automatically.
#+begin_src emacs-lisp
(defun chris/org-babel-tangle-config ()
(when (string-equal (buffer-file-name)
(expand-file-name "~/.dotemacs/README.org"))
(let ((org-confirm-babel-evaluate nil))
(org-babel-tangle))))
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'chris/org-babel-tangle-config
:append :local)))
#+end_src
*** Org-Roam *** Org-Roam
Here we are going to add org-roam. This is a note-takers paradise by adding an automatic backlinking function. Here we are going to add org-roam. This is a note-takers paradise by adding an automatic backlinking function.
@ -555,6 +563,71 @@ Use magit, because why wouldn't you? duh!
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package magit (use-package magit
:commands (magit-status magit-get-current-branch) :commands (magit-status magit-get-current-branch)
:general
(chris/leader-keys "g g" 'magit-status)
:custom :custom
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
#+end_src #+end_src
** Garbage Collection
We set the =gc-cons-threshold= variable to really high, now lets set it back low to make sure emacs performs properly.
#+begin_src emacs-lisp
(setq gc-cons-threshold 2000000)
#+end_src
#+begin_src emacs-lisp
#+end_src
* Early Init
:PROPERTIES:
:header-args: emacs-lisp :tangle early-init.el
:END:
As of right now I haven't fully setup my early-init file, this does not export into the early-init.el file currently as it's just a copy from Doom's early-init.
#+begin_src emacs-lisp :tangle early-init.el
;;; early-init.el -*- lexical-binding: t; -*-
;; Emacs 27.1 introduced early-init.el, which is run before init.el, before
;; package and UI initialization happens, and before site files are loaded.
;; A big contributor to startup times is garbage collection. We up the gc
;; threshold to temporarily prevent it from running, then reset it later by
;; enabling `gcmh-mode'. Not resetting it will cause stuttering/freezes.
(setq gc-cons-threshold 50000000)
;; ;; In noninteractive sessions, prioritize non-byte-compiled source files to
;; ;; prevent the use of stale byte-code. Otherwise, it saves us a little IO time
;; ;; to skip the mtime checks on every *.elc file.
;; (setq load-prefer-newer noninteractive)
;; ;; In Emacs 27+, package initialization occurs before `user-init-file' is
;; ;; loaded, but after `early-init-file'. Doom handles package initialization, so
;; ;; we must prevent Emacs from doing it early!
;; (setq package-enable-at-startup nil)
;; (fset #'package--ensure-init-file #'ignore) ; DEPRECATED Removed in 28
;; ;; `file-name-handler-alist' is consulted on every `require', `load' and various
;; ;; path/io functions. You get a minor speed up by nooping this. However, this
;; ;; may cause problems on builds of Emacs where its site lisp files aren't
;; ;; byte-compiled and we're forced to load the *.el.gz files (e.g. on Alpine)
;; (unless (daemonp)
;; (defvar doom--initial-file-name-handler-alist file-name-handler-alist)
;; (setq file-name-handler-alist nil)
;; ;; Restore `file-name-handler-alist' later, because it is needed for handling
;; ;; encrypted or compressed files, among other things.
;; (defun doom-reset-file-handler-alist-h ()
;; ;; Re-add rather than `setq', because changes to `file-name-handler-alist'
;; ;; since startup ought to be preserved.
;; (dolist (handler file-name-handler-alist)
;; (add-to-list 'doom--initial-file-name-handler-alist handler))
;; (setq file-name-handler-alist doom--initial-file-name-handler-alist))
;; (add-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h))
;; ;; Ensure Doom is running out of this file's directory
;; (setq user-emacs-directory (file-name-directory load-file-name))
;; ;; Load the heart of Doom Emacs
;; (load (concat user-emacs-directory "core/core") nil 'nomessage)
#+end_src

203
init.el
View file

@ -1,4 +1,14 @@
;;; init.el -*- lexical-binding: t; -*- ;;; init.el -*- lexical-binding: t; -*-
(defun chris/display-startup-time ()
(message "Emacs loaded in %s with %d garbage collections."
(format "%.2f seconds"
(float-time
(time-subtract after-init-time before-init-time)))
gcs-done))
(add-hook 'emacs-startup-hook #'chris/display-startup-time)
(setq gc-cons-threshold 50000000)
(setq inhibit-startup-message t) (setq inhibit-startup-message t)
(scroll-bar-mode -1) (scroll-bar-mode -1)
@ -24,14 +34,6 @@
(global-set-key (kbd "<escape>") 'keyboard-escape-quit) (global-set-key (kbd "<escape>") 'keyboard-escape-quit)
(defun chris/display-startup-time ()
(message "Emacs loaded in %s with %d garbage collections."
(format "%.2f seconds"
(float-time
(time-subtract after-init-time before-init-time)))
gcs-done))
(add-hook 'emacs-startup-hook #'chris/display-startup-time)
(defvar bootstrap-version) (defvar bootstrap-version)
(let ((bootstrap-file (let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
@ -48,8 +50,10 @@
(setq straight-use-package-by-default t) (setq straight-use-package-by-default t)
(straight-use-package 'use-package) (straight-use-package 'use-package)
(setq use-package-verbose t)
(use-package command-log-mode) (use-package command-log-mode
:commands command-log-mode)
(use-package all-the-icons) (use-package all-the-icons)
@ -68,12 +72,14 @@
(use-package rainbow-delimiters (use-package rainbow-delimiters
:hook (prog-mode . rainbow-delimiters-mode)) :hook (prog-mode . rainbow-delimiters-mode))
(use-package adaptive-wrap) (use-package adaptive-wrap
:defer t)
(use-package which-key (use-package which-key
:init (which-key-mode)
:config :config
(setq which-key-idle-delay 0.3)) (setq which-key-idle-delay 0.3)
(which-key-mode)
:defer 1)
(use-package evil (use-package evil
:init :init
@ -84,7 +90,8 @@
evil-respect-visual-line-mode t evil-respect-visual-line-mode t
evil-want-C-u-delete t) evil-want-C-u-delete t)
:config :config
(evil-mode +1)) (evil-mode +1)
(setq evil-undo-system 'undo-tree))
(use-package evil-collection (use-package evil-collection
:after evil :after evil
@ -126,7 +133,14 @@
:init (evil-escape-mode +1) :init (evil-escape-mode +1)
:config (setq evil-escape-key-sequence "fd")) :config (setq evil-escape-key-sequence "fd"))
(use-package olivetti) (use-package undo-tree
:defer 1)
(use-package olivetti
:after org
:config
(setq olivetti-body-width 0.6
olivetti-minimum-body-width 100))
(use-package toc-org (use-package toc-org
:after org) :after org)
@ -142,7 +156,7 @@
"C-S-j" 'selectrum-goto-end "C-S-j" 'selectrum-goto-end
"C-S-k" 'selectrum-goto-beginning "C-S-k" 'selectrum-goto-beginning
"TAB" 'selectrum-insert-current-candidate) "TAB" 'selectrum-insert-current-candidate)
:commands (completing-read)) :commands completing-read)
(use-package prescient (use-package prescient
:config :config
@ -154,7 +168,8 @@
(selectrum-prescient-mode +1) (selectrum-prescient-mode +1)
:after selectrum) :after selectrum)
(use-package consult) (use-package consult
:after selectrum)
;; Enable richer annotations using the Marginalia package ;; Enable richer annotations using the Marginalia package
(use-package marginalia (use-package marginalia
@ -179,91 +194,88 @@
(setq marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil)) (setq marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil))
:after selectrum) :after selectrum)
(use-package helpful) (use-package helpful
:commands (helpful-callable helpful-variable helpful-command helpful-key))
(use-package format-all (use-package format-all
:config :config
(format-all-mode +1)) (format-all-mode +1)
:defer 1)
(defun chris/org-mode-setup ()
(org-indent-mode +1)
(toc-org-mode +1)
(olivetti-mode +1))
(use-package org (use-package org
:config :config
(setq org-startup-indented t) (setq org-startup-indented t
(defun chris/org-babel-tangle-config () org-edit-src-content-indentation 0)
(when (string-equal (buffer-file-name)
(expand-file-name "~/.personal-emacs/init.org"))
(let ((org-confirm-babel-evaluate nil))
(org-babel-tangle))))
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'chris/org-babel-tangle-config))) (add-hook 'org-mode-hook 'chris/org-mode-setup)
(org-babel-do-load-languages (org-babel-do-load-languages
'org-babel-load-languages 'org-babel-load-languages
'((emacs-lisp . t) '((emacs-lisp . t)
(python . t) (python . t)
(shell . t))) (shell . t)))
(require 'org-tempo) (require 'org-tempo)
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(add-to-list 'org-structure-template-alist '("py" . "src python")) (add-to-list 'org-structure-template-alist '("py" . "src python"))
(add-to-list 'org-structure-template-alist '("sh" . "src shell")) (add-to-list 'org-structure-template-alist '("sh" . "src shell"))
(add-to-list 'org-structure-template-alist '("q" . "quote")) (add-to-list 'org-structure-template-alist '("q" . "quote"))
(setq org-capture-templates (setq org-capture-templates
'(("t" "Personal todo" entry '(("t" "Personal todo" entry
(file+headline +org-capture-todo-file "Inbox") (file+headline +org-capture-todo-file "Inbox")
"* TODO %^{TODO name}\nSCHEDULED: %T\n%a\n%i%?" :prepend t) "* TODO %^{TODO name}\nSCHEDULED: %T\n%a\n%i%?" :prepend t)
("n" "Personal notes" entry ("n" "Personal notes" entry
(file+headline +org-capture-notes-file "Inbox") (file+headline +org-capture-notes-file "Inbox")
"* %u %?\n%i\n%a" :prepend t) "* %u %?\n%i\n%a" :prepend t)
("j" "Journal" entry ("j" "Journal" entry
(file+olp+datetree +org-capture-journal-file) (file+olp+datetree +org-capture-journal-file)
"* %U %?\n%i\n%a" :prepend t) "* %U %?\n%i\n%a" :prepend t)
("p" "TFC Plan" entry ("p" "TFC Plan" entry
(function chris/org-roam-capture-lesson-file) (function chris/org-roam-capture-lesson-file)
(file ".templates/tfcplantemplate.org") (file ".templates/tfcplantemplate.org")
:prepend nil :prepend nil
:jump-to-captured t :jump-to-captured t
:empty-lines 1) :empty-lines 1)
("r" "Templates for projects") ("r" "Templates for projects")
("rt" "Project-local todo" entry ("rt" "Project-local todo" entry
(file+headline +org-capture-project-todo-file "Inbox") (file+headline +org-capture-project-todo-file "Inbox")
"* TODO %?\n%i\n%a" :prepend t) "* TODO %?\n%i\n%a" :prepend t)
("rn" "Project-local notes" entry ("rn" "Project-local notes" entry
(file+headline +org-capture-project-notes-file "Inbox") (file+headline +org-capture-project-notes-file "Inbox")
"* %U %?\n%i\n%a" :prepend t) "* %U %?\n%i\n%a" :prepend t)
("rc" "Project-local changelog" entry ("rc" "Project-local changelog" entry
(file+headline +org-capture-project-changelog-file "Unreleased") (file+headline +org-capture-project-changelog-file "Unreleased")
"* %U %?\n%i\n%a" :prepend t) "* %U %?\n%i\n%a" :prepend t)
("o" "Centralized templates for projects") ("o" "Centralized templates for projects")
("ot" "Project todo" entry #'+org-capture-central-project-todo-file ("ot" "Project todo" entry #'+org-capture-central-project-todo-file
"* TODO %?\n %i\n %a" :heading "Tasks" :prepend nil) "* TODO %?\n %i\n %a" :heading "Tasks" :prepend nil)
("on" "Project notes" entry #'+org-capture-central-project-notes-file ("on" "Project notes" entry #'+org-capture-central-project-notes-file
"* %U %?\n %i\n %a" :heading "Notes" :prepend t) "* %U %?\n %i\n %a" :heading "Notes" :prepend t)
("oc" "Project changelog" entry #'+org-capture-central-project-changelog-file ("oc" "Project changelog" entry #'+org-capture-central-project-changelog-file
"* %U %?\n %i\n %a" :heading "Changelog" :prepend t)) "* %U %?\n %i\n %a" :heading "Changelog" :prepend t))
org-capture-use-agenda-date t) org-capture-use-agenda-date t)
;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖")) ;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖"))
(setq olivetti-body-width 0.6) (setq org-imenu-depth 4)
(setq olivetti-minimum-body-width 100) (setq org-odt-styles-file "/home/chris/org/style.odt")
(setq org-imenu-depth 4)
(setq org-odt-styles-file "/home/chris/org/style.odt")
(setq org-todo-keywords (setq org-todo-keywords
'((sequence "TODO(t)" "PROJ(p)" "STRT(s)" "WAIT(w)" "HOLD(h)" "|" "DONE(d)" "CNCL(c)") '((sequence "TODO(t)" "PROJ(p)" "STRT(s)" "WAIT(w)" "HOLD(h)" "|" "DONE(d)" "CNCL(c)")
(sequence "[ ](T)" "[-](S)" "[?](W)" "|" "[X](D)"))) (sequence "[ ](T)" "[-](S)" "[?](W)" "|" "[X](D)")))
(add-hook 'org-mode-hook (setq org-agenda-files
(toc-org-mode +1) '("/home/chris/org/DMPREADME.org" "/home/chris/org/DMPTODO.org" "/home/chris/org/inbox.org" "/home/chris/org/notes.org" "/home/chris/org/repetition.org" "/home/chris/org/tasks.org" "/home/chris/org/tfc_plans.org" "/home/chris/org/ministry_team.org" "/home/chris/org/todo.org" "/home/chris/org/newsletter.org"))
(olivetti-mode +1)) (setq org-id-method 'ts)
:general
(setq org-agenda-files (chris/leader-keys "o a" 'org-agenda)
'("/home/chris/org/DMPREADME.org" "/home/chris/org/DMPTODO.org" "/home/chris/org/inbox.org" "/home/chris/org/notes.org" "/home/chris/org/repetition.org" "/home/chris/org/tasks.org" "/home/chris/org/tfc_plans.org" "/home/chris/org/ministry_team.org" "/home/chris/org/todo.org" "/home/chris/org/newsletter.org")) (chris/leader-keys "c" 'org-capture))
(setq org-id-method 'ts)
:general
(chris/leader-keys "o a" 'org-agenda)
(chris/leader-keys "c" 'org-capture))
(defun chris/org-roam-capture-lesson-file () (defun chris/org-roam-capture-lesson-file ()
"Function to return the lesson file that is needed for TFC plan capture and move to correct position for plan insertion" "Function to return the lesson file that is needed for TFC plan capture and move to correct position for plan insertion"
@ -277,6 +289,15 @@
(goto-char (point-min)) (goto-char (point-min))
(search-forward "PLAN"))) (search-forward "PLAN")))
(defun chris/org-babel-tangle-config ()
(when (string-equal (buffer-file-name)
(expand-file-name "~/.dotemacs/README.org"))
(let ((org-confirm-babel-evaluate nil))
(org-babel-tangle))))
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'chris/org-babel-tangle-config
:append :local)))
(use-package org-roam (use-package org-roam
:after org :after org
:config :config
@ -324,5 +345,11 @@
(use-package magit (use-package magit
:commands (magit-status magit-get-current-branch) :commands (magit-status magit-get-current-branch)
:general
(chris/leader-keys "g g" 'magit-status)
:custom :custom
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
(setq gc-cons-threshold 2000000)