From 408a844b06f236b3a3d2d4f6d2ff619809b10c5f Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Thu, 4 Jul 2024 14:39:27 +0200 Subject: [PATCH] Remove .emacs.d/init.el Add 50_tangle_emacs_config.sh --- private_dot_emacs.d/init.el | 13 ------------- run_onchange_50_tangle_emacs_config.sh.tmpl | 9 +++++++++ 2 files changed, 9 insertions(+), 13 deletions(-) delete mode 100644 private_dot_emacs.d/init.el create mode 100644 run_onchange_50_tangle_emacs_config.sh.tmpl diff --git a/private_dot_emacs.d/init.el b/private_dot_emacs.d/init.el deleted file mode 100644 index 40c4d75..0000000 --- a/private_dot_emacs.d/init.el +++ /dev/null @@ -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)) diff --git a/run_onchange_50_tangle_emacs_config.sh.tmpl b/run_onchange_50_tangle_emacs_config.sh.tmpl new file mode 100644 index 0000000..d7ebc63 --- /dev/null +++ b/run_onchange_50_tangle_emacs_config.sh.tmpl @@ -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\")"