summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Mikkelsen <petermikkelsen10@gmail.com>2026-11-12 22:49:41 +0100
committerPeter Mikkelsen <petermikkelsen10@gmail.com>2026-11-12 22:49:41 +0100
commit1df366b3d6e775f0e43bf5539a539c03d2ca0e31 (patch)
treea62946f64d82c5721450969fc87d905969c7694c
parentd201f5cf1cbc288267921de51b3f07663af93442 (diff)
Put emacs configuration into an org mode file, which must then be tangled to become the final init.el
-rw-r--r--.emacs.d/early-init.el9
-rw-r--r--.emacs.d/init.el94
-rw-r--r--.emacs.d/init.org160
3 files changed, 219 insertions, 44 deletions
diff --git a/.emacs.d/early-init.el b/.emacs.d/early-init.el
deleted file mode 100644
index 084bce8..0000000
--- a/.emacs.d/early-init.el
+++ /dev/null
@@ -1,9 +0,0 @@
-;; -*- lexical-binding: t; -*-
-(setq modus-themes-mixed-fonts t
- modus-themes-variable-pitch-ui t
- modus-themes-disable-other-themes t)
-(set-face-attribute 'default nil :family "Iosevka" :height 140)
-(set-face-attribute 'fixed-pitch nil :family "Iosevka Extended")
-(set-face-attribute 'fixed-pitch-serif nil :family "Iosevka Slab Extended")
-(set-face-attribute 'variable-pitch nil :family "Iosevka Etoile")
-(load-theme 'modus-operandi-tinted :no-confirm)
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 83bfb8f..a482935 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -1,60 +1,84 @@
-;; -*- lexical-binding: t; -*-
+; -*- lexical-binding: t; -*-
+
+; NOTE: This file is automatically generated from init.org. Changes
+; should go there, not here.
+
+(setq custom-file (locate-user-emacs-file "custom.el"))
+
+(load custom-file t)
(require 'package)
+(package-initialize)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
-(package-initialize)
+
+(setq use-package-always-defer t)
+
+(require 'use-package-ensure)
+(setq use-package-always-ensure t)
(use-package emacs
- :ensure t
- :init
+ :demand t
+ :custom
+ (inhibit-splash-screen t)
+ (initial-buffer-choice "~/org-files/startup.org")
+ (completion-eager-display t)
+ (completion-eager-update t)
+ (completion-show-help nil)
+ (completion-show-inline-help nil)
+ (completions-detailed t)
+ (completions-group t)
+ (completions-max-height 10)
+ (completions-sort 'historical)
+ (minibuffer-completion-auto-choose t)
+ (read-buffer-completion-ignore-case t)
+ (read-file-name-completion-ignore-case t)
+ :config
(when (eq system-type 'darwin)
(setq mac-right-option-modifier 'none))
- (setq inhibit-splash-screen t)
+ (set-face-attribute 'default nil :family "Iosevka" :height 140)
+ (set-face-attribute 'fixed-pitch nil :family "Iosevka Extended")
+ (set-face-attribute 'fixed-pitch-serif nil :family "Iosevka Slab Extended")
+ (set-face-attribute 'variable-pitch nil :family "Iosevka Etoile")
(menu-bar-mode -1)
- (tool-bar-mode -1)
(scroll-bar-mode -1)
- (setq initial-buffer-choice "~/org-files/startup.org"))
+ (tool-bar-mode -1)
+ (minibuffer-electric-default-mode)
+ )
-(use-package ghostel
- :ensure t)
+(use-package modus-themes
+ :demand t
+ :custom
+ (modus-themes-mixed-fonts t)
+ (modus-themes-variable-pitch-ui t)
+ (modus-themes-disable-other-themes t)
+ :config
+ (modus-themes-load-theme 'modus-operandi-tinted))
-(use-package magit
- :ensure t)
+(use-package magit)
+
+(use-package ghostel)
(use-package mediawiki
- :ensure t
- :init
- (setq mediawiki-site-default "dyalog")
+ :custom
+ (mediawiki-site-defaut "dyalog")
:config
(add-to-list 'mediawiki-site-alist
- '("dyalog" "https://wiki.bramley.dyalog.com" "peterm" nil "" :description "Dyalog internal wiki" :first-page "Main Page")))
-
-(use-package auth-source
- :ensure t
- :init
- (setq auth-sources '("~/.authinfo.gpg")))
+ '("dyalog" "https://wiki.bramley.dyalog.com" "peterm" nil ""
+ :description "Dyalog internal wiki" :first-page "User:Peterm")))
(use-package project
- :ensure t
- :init
- (setq project-mode-line t))
+ :custom
+ (project-mode-line t))
(use-package org
- :ensure t
:bind
(("C-c l" . org-store-link)
("C-c a" . org-agenda)
- ("C-c c" . org-capture)
- ))
+ ("C-c c" . org-capture)))
(use-package org-roam
- :ensure t
- :init
- (setq org-roam-directory (file-truename "~/org-files/roam"))
- (org-roam-db-autosync-mode)
- )
-
-(use-package org-roam-ui
- :ensure t
- )
+ :custom
+ (org-roam-directory (file-truename "~/org-files/roam"))
+ :config
+ (org-roam-db-autosync-mode))
diff --git a/.emacs.d/init.org b/.emacs.d/init.org
new file mode 100644
index 0000000..b7514b7
--- /dev/null
+++ b/.emacs.d/init.org
@@ -0,0 +1,160 @@
+#+startup: content indent
+
+This file is my emacs config, written as an org file. To export it,
+run ~M-x org-babel-tangle~.
+* Initial stuff
+#+begin_src emacs-lisp :tangle "init.el"
+ ; -*- lexical-binding: t; -*-
+
+ ; NOTE: This file is automatically generated from init.org. Changes
+ ; should go there, not here.
+#+end_src
+* Put all the customisation stuff in its own file
+When new packages are installed, or settings are changed in the
+customisation interface, emacs automatically saves this
+information. By default, it is put into the init file, but this is
+noisy, and I prefer it to be in another file.
+** Set the custom file
+#+begin_src emacs-lisp :tangle "init.el"
+ (setq custom-file (locate-user-emacs-file "custom.el"))
+#+end_src
+** Load the custom file's contents
+#+begin_src emacs-lisp :tangle "init.el"
+ (load custom-file t)
+#+end_src
+* Setup package archive
+Some packages I use come from melpa.
+#+begin_src emacs-lisp :tangle "init.el"
+ (require 'package)
+ (package-initialize)
+ (add-to-list 'package-archives
+ '("melpa" . "https://melpa.org/packages/") t)
+#+end_src
+* Configure use-package
+Tell use-package to assume ~:defer t~.
+#+begin_src emacs-lisp :tangle "init.el"
+ (setq use-package-always-defer t)
+#+end_src
+Tell it to assume ~:ensure t~ as well.
+#+begin_src emacs-lisp :tangle init.el
+ (require 'use-package-ensure)
+ (setq use-package-always-ensure t)
+#+end_src
+* Basic configuration
+#+begin_src emacs-lisp :tangle "init.el" :noweb yes
+ (use-package emacs
+ :demand t
+ :custom
+ <<basic-custom>>
+ :config
+ <<basic-config>>
+ )
+#+end_src
+** Startup
+Remove the splash screen
+#+begin_src emacs-lisp :noweb-ref basic-custom
+ (inhibit-splash-screen t)
+#+end_src
+Use a specific org file as the initial buffer.
+#+begin_src emacs-lisp :noweb-ref basic-custom
+ (initial-buffer-choice "~/org-files/startup.org")
+#+end_src
+** System-specific setup
+*** MacOS
+#+begin_src emacs-lisp :noweb-ref basic-config
+ (when (eq system-type 'darwin)
+ (setq mac-right-option-modifier 'none))
+#+end_src
+* Appearence configuration
+** Modus theme
+Load a nice looking theme.
+#+begin_src emacs-lisp :tangle "init.el"
+ (use-package modus-themes
+ :demand t
+ :custom
+ (modus-themes-mixed-fonts t)
+ (modus-themes-variable-pitch-ui t)
+ (modus-themes-disable-other-themes t)
+ :config
+ (modus-themes-load-theme 'modus-operandi-tinted))
+#+end_src
+** Default fonts
+#+begin_src emacs-lisp :noweb-ref basic-config
+ (set-face-attribute 'default nil :family "Iosevka" :height 140)
+ (set-face-attribute 'fixed-pitch nil :family "Iosevka Extended")
+ (set-face-attribute 'fixed-pitch-serif nil :family "Iosevka Slab Extended")
+ (set-face-attribute 'variable-pitch nil :family "Iosevka Etoile")
+#+end_src
+** Disable UI elements
+Remove the menu bar
+#+begin_src emacs-lisp :noweb-ref basic-config
+ (menu-bar-mode -1)
+#+end_src
+Remove the scroll bars
+#+begin_src emacs-lisp :noweb-ref basic-config
+ (scroll-bar-mode -1)
+#+end_src
+Remove the tool bar
+#+begin_src emacs-lisp :noweb-ref basic-config
+ (tool-bar-mode -1)
+#+end_src
+* Minibuffer
+Customisation of defaults.
+#+begin_src emacs-lisp :noweb-ref basic-custom
+ (completion-eager-display t)
+ (completion-eager-update t)
+ (completion-show-help nil)
+ (completion-show-inline-help nil)
+ (completions-detailed t)
+ (completions-group t)
+ (completions-max-height 10)
+ (completions-sort 'historical)
+ (minibuffer-completion-auto-choose t)
+ (read-buffer-completion-ignore-case t)
+ (read-file-name-completion-ignore-case t)
+#+end_src
+Enable electric mode by default.
+#+begin_src emacs-lisp :noweb-ref basic-config
+ (minibuffer-electric-default-mode)
+#+end_src
+* Magit
+#+begin_src emacs-lisp :tangle "init.el"
+ (use-package magit)
+#+end_src
+* Ghostel (terminal)
+#+begin_src emacs-lisp :tangle "init.el"
+ (use-package ghostel)
+#+end_src
+* Mediawiki
+#+begin_src emacs-lisp :tangle "init.el"
+ (use-package mediawiki
+ :custom
+ (mediawiki-site-defaut "dyalog")
+ :config
+ (add-to-list 'mediawiki-site-alist
+ '("dyalog" "https://wiki.bramley.dyalog.com" "peterm" nil ""
+ :description "Dyalog internal wiki" :first-page "User:Peterm")))
+#+end_src
+* Project
+#+begin_src emacs-lisp :tangle "init.el"
+ (use-package project
+ :custom
+ (project-mode-line t))
+#+end_src
+* Org mode and associated packages
+** Base org package
+#+begin_src emacs-lisp :tangle "init.el"
+ (use-package org
+ :bind
+ (("C-c l" . org-store-link)
+ ("C-c a" . org-agenda)
+ ("C-c c" . org-capture)))
+#+end_src
+** Org roam
+#+begin_src emacs-lisp :tangle "init.el"
+ (use-package org-roam
+ :custom
+ (org-roam-directory (file-truename "~/org-files/roam"))
+ :config
+ (org-roam-db-autosync-mode))
+#+end_src