summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfpi2020-04-05 19:59:31 +0200
committerfpi2020-04-05 20:54:24 +0200
commit20402088679d2fd52052dad73b15739f178d5819 (patch)
tree6260e3a520a3765a29f127edea4f338198e24afc
parentAdd script to (re-)tangle all files (diff)
Add script to create all symlinks
-rw-r--r--README.org37
1 files changed, 35 insertions, 2 deletions
diff --git a/README.org b/README.org
index 3355f7d..477de5f 100644
--- a/README.org
+++ b/README.org
@@ -7,8 +7,8 @@ and symlinked to the appropriate directories.
blocks make tangling take several seconds and ~org-babel-load-file~ in
~init.el~ tangles the init org file on each emacs start anyway.
-For now the symlinks need to be created by manually running the
-appropriate src block in each configuration file.
+The symlinks can be created by manually running the appropriate src
+block in each configuration file. For an automated solution see below.
** Git Setup
Every program's configuration lives in its own branch. All branches
@@ -57,6 +57,39 @@ emacs --batch --eval="\
(mapc 'org-babel-tangle-file (split-string \"$(ls *.org *.org.gpg)\"))))"
#+end_src
+** Creating symlinks
+Each config files contains a source block which creates symlinks of
+the tangled configurations to their respective target locations. These
+blocks all have the ~:tangle tangle/symlink.sh~ and ~:shebang
+#!/bin/bash~ header arguments. The symlinks are created with ~ln -siv~
+to list created symlinks (~-v~) and to ask when overwriting existing
+files (~-i~). To always replace all symlinks you can pipe ~yes~ into
+the ~ln -siv~ calls: ~yes | tangle/link.sh~. Make sure to run it from
+the dotfiles directory.
+
+As the symlink shell source blocks are scattered in all configuration
+files, all files are collected together using cat and then all blocks
+with the correct ~:tangle~ target are tangled. Unfortunately there is
+no function to directly only tangle blocks with a certain target, so
+this is not straightforward.
+#+begin_src shell :shebang "#!/bin/bash" :tangle tangle/link.sh
+catFile="concat.org"
+symlinkFile="tangle/symlink.sh"
+
+cat <(cat *.org) <(ls *.org.gpg | xargs gpg --decrypt) > $catFile
+
+emacs --batch --eval="\
+ (progn (require 'org)
+ (let ((org-confirm-babel-evaluate nil))
+ (find-file \"$catFile\")
+ (search-forward \":tangle $symlinkFile\")
+ (org-babel-tangle '(16))))"
+
+rm $catFile
+
+$symlinkFile
+#+end_src
+
* Window manager
I use [[https://github.com/ch11ng/exwm][exwm]] and [[https://awesomewm.org/][awesome]] as my window managers. When doing a lot of
coding and similar stuff I tend to use exwm as I will spend most of my