diff options
author | fpi | 2020-04-05 19:59:31 +0200 |
---|---|---|
committer | fpi | 2020-04-05 20:54:24 +0200 |
commit | 20402088679d2fd52052dad73b15739f178d5819 (patch) | |
tree | 6260e3a520a3765a29f127edea4f338198e24afc | |
parent | Add script to (re-)tangle all files (diff) |
Add script to create all symlinks
-rw-r--r-- | README.org | 37 |
1 files changed, 35 insertions, 2 deletions
@@ -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 |