Remove .emacs.d/init.el

Add 50_tangle_emacs_config.sh
This commit is contained in:
Anthony Rodriguez 2024-07-04 14:39:27 +02:00
parent dc99696800
commit 408a844b06
2 changed files with 9 additions and 13 deletions

View file

@ -1,13 +0,0 @@
;; Paths to config.org and the tangled init.el
(defvar org-config-file (expand-file-name "config.org" user-emacs-directory))
(defvar tangled-init-file (expand-file-name "init.el" user-emacs-directory))
;; Function to tangle the org file
(defun tangle-org-config ()
(require 'org)
(org-babel-tangle-file org-config-file)
(load tangled-init-file))
;; Check if config.org is newer than init.el and tangle if necessary
(when (file-newer-than-file-p org-config-file tangled-init-file)
(tangle-org-config))

View file

@ -0,0 +1,9 @@
#!/bin/sh
ORG_FILE="{{ joinPath .chezmoi.sourceDir "private_dot_emacs.d/config.org" }}"
TANGLED_FILE="$HOME/.emacs.d/init.el"
mkdir -p "$(dirname "$TANGLED_FILE")"
emacs --batch -l org \
--eval "(org-babel-tangle-file \"$ORG_FILE\" \"$TANGLED_FILE\" \"emacs-lisp\")"