Add an init.el to tangle config.org, rather then using extraOptions

Move rest of old init.el into new format
This commit is contained in:
Evie Litherland-Smith 2023-11-06 12:09:47 +00:00
parent 861260c98d
commit 6627407d19
4 changed files with 25 additions and 39 deletions

View file

@ -216,7 +216,7 @@
} }
rsync-local-config () { rsync-local-config () {
HOST=$1 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" SOURCE="${config.xdg.configHome}/$TARGET"
TMP_TARGET=/tmp/rsync-local-config TMP_TARGET=/tmp/rsync-local-config
TMP_SOURCE=$TMP_TARGET TMP_SOURCE=$TMP_TARGET

View file

@ -5,6 +5,27 @@
* Common defaults * 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 * Org-mode
For reference information, see [[https://orgmode.com][Org-mode website]] 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. For now I'll just copy all config into this file, to confirm that it works properly.
Will reorganise into separate sections later 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 ** TODO Defaults
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;;; Code: ;;; Code:

View file

@ -2,16 +2,13 @@
{ {
xdg.configFile = { xdg.configFile = {
"emacs/init.el".source = ./init.el;
"emacs/config.org".source = ./config.org; "emacs/config.org".source = ./config.org;
"emacs/snippets".source = ./snippets; "emacs/snippets".source = ./snippets;
}; };
programs.emacs = { programs.emacs = {
enable = true; enable = true;
package = pkgs.emacs29-pgtk; package = pkgs.emacs29-pgtk;
extraConfig = ''
(package-initialize)
(org-babel-load-file (locate-user-emacs-file "config.org"))
'';
extraPackages = epkgs: extraPackages = epkgs:
with epkgs; [ with epkgs; [
# completion-packages # completion-packages

2
home/emacs/init.el Normal file
View file

@ -0,0 +1,2 @@
(package-initialize)
(org-babel-load-file (locate-user-emacs-file "config.org"))