From 6627407d1917c4f328a232757fbb592d5c7e1ae3 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Mon, 6 Nov 2023 12:09:47 +0000 Subject: [PATCH] Add an init.el to tangle config.org, rather then using extraOptions Move rest of old init.el into new format --- home/default.nix | 2 +- home/emacs/config.org | 55 ++++++++++++++++-------------------------- home/emacs/default.nix | 5 +--- home/emacs/init.el | 2 ++ 4 files changed, 25 insertions(+), 39 deletions(-) create mode 100644 home/emacs/init.el diff --git a/home/default.nix b/home/default.nix index 5191cd59..f8ce2ac5 100644 --- a/home/default.nix +++ b/home/default.nix @@ -216,7 +216,7 @@ } rsync-local-config () { HOST=$1 - for TARGET in bat git emacs/config.org emacs/snippets starship.toml; do + for TARGET in bat git emacs/init.el emacs/config.org emacs/snippets starship.toml; do SOURCE="${config.xdg.configHome}/$TARGET" TMP_TARGET=/tmp/rsync-local-config TMP_SOURCE=$TMP_TARGET diff --git a/home/emacs/config.org b/home/emacs/config.org index 160397d1..9cce17b6 100644 --- a/home/emacs/config.org +++ b/home/emacs/config.org @@ -5,6 +5,27 @@ * Common defaults +#+BEGIN_SRC emacs-lisp :results output silent + (setq user-full-name "Evie Litherland-Smith" + user-mail-address "evie@xenia.me.uk") + (setq custom-file (locate-user-emacs-file "custom.el")) + (set-default-coding-systems 'utf-8) + (set-terminal-coding-system 'utf-8) + (set-keyboard-coding-system 'utf-8) +#+END_SRC + +** package-archive with priorities +#+begin_src emacs-lisp :results output silent + (when (require 'package nil :noerror) + (add-to-list 'package-archives '("stable" . "https://stable.melpa.org/packages/")) + (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) + + (setq package-archive-priorities '(("gnu" . 99) + ("nongnu" . 80) + ("stable" . 70) + ("melpa" . 0)))) +#+end_src + * Org-mode For reference information, see [[https://orgmode.com][Org-mode website]] @@ -99,40 +120,6 @@ For reference information, see [[https://orgmode.com][Org-mode website]] For now I'll just copy all config into this file, to confirm that it works properly. Will reorganise into separate sections later -** TODO Init.el -#+BEGIN_SRC emacs-lisp - ;;; Initial phase. - - ;; Load the custom file if it exists. Among other settings, this will - ;; have the list `package-selected-packages', so we need to load that - ;; before adding more packages. The value of the `custom-file' - ;; variable must be set appropriately, by default the value is nil. - ;; This can be done here, or in the early-init.el file. - (setq custom-file (locate-user-emacs-file "custom.el")) - (when (and custom-file (file-exists-p custom-file)) - (load custom-file nil 'nomessage)) - - ;; Setup package-archives and priorities - (when (require 'package nil :noerror) - (add-to-list 'package-archives '("stable" . "https://stable.melpa.org/packages/")) - (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) - - (setq package-archive-priorities '(("gnu" . 99) - ("nongnu" . 80) - ("stable" . 70) - ("melpa" . 0)))) - - ;;; Configuration phase - - (setq user-full-name "Evie Litherland-Smith" - user-mail-address "evie@xenia.me.uk") - - ;; Set default coding system (especially for Windows) - (set-default-coding-systems 'utf-8) - (set-terminal-coding-system 'utf-8) - (set-keyboard-coding-system 'utf-8) -#+END_SRC - ** TODO Defaults #+BEGIN_SRC emacs-lisp ;;; Code: diff --git a/home/emacs/default.nix b/home/emacs/default.nix index 6bae5dba..3bc5a989 100644 --- a/home/emacs/default.nix +++ b/home/emacs/default.nix @@ -2,16 +2,13 @@ { xdg.configFile = { + "emacs/init.el".source = ./init.el; "emacs/config.org".source = ./config.org; "emacs/snippets".source = ./snippets; }; programs.emacs = { enable = true; package = pkgs.emacs29-pgtk; - extraConfig = '' - (package-initialize) - (org-babel-load-file (locate-user-emacs-file "config.org")) - ''; extraPackages = epkgs: with epkgs; [ # completion-packages diff --git a/home/emacs/init.el b/home/emacs/init.el new file mode 100644 index 00000000..f2238936 --- /dev/null +++ b/home/emacs/init.el @@ -0,0 +1,2 @@ +(package-initialize) +(org-babel-load-file (locate-user-emacs-file "config.org"))