|
|
|
|
@ -5,6 +5,27 @@ |
|
|
|
|
#+HUGO_SECTION: zshrc |
|
|
|
|
#+OPTIONS: creator:t toc:nil |
|
|
|
|
|
|
|
|
|
* Setup org-babel |
|
|
|
|
This helper function checks the tags of the current headline and |
|
|
|
|
returns a list of corresponding filenames. For instance if the tags |
|
|
|
|
are daily and pi, the function returns '(".zshrc" ".zshrc.pi") |
|
|
|
|
|
|
|
|
|
#+name:def-tag |
|
|
|
|
#+begin_src emacs-lisp :results output silent |
|
|
|
|
(setq tag-to-filenames-alist '(("daily" . ".zshrc") |
|
|
|
|
("blender" . ".zshrc.blender") |
|
|
|
|
("pi" . ".zshrc.pi") |
|
|
|
|
("android" . ".zshrc.android") |
|
|
|
|
("mips" . ".zshrc.mips"))) |
|
|
|
|
(defun org-tags-to-filenames () |
|
|
|
|
(let ((tags (car (last (org-heading-components))))) |
|
|
|
|
(when (stringp tags) |
|
|
|
|
(remove nil (mapcar |
|
|
|
|
(lambda (tag) |
|
|
|
|
(cdr (assoc tag tag-to-filenames-alist))) |
|
|
|
|
(org-split-string tags ":")))))) |
|
|
|
|
#+end_src |
|
|
|
|
|
|
|
|
|
* zshrc :@zsh: |
|
|
|
|
All posts in here will have the category set to /zsh/. |
|
|
|
|
** zshrc |
|
|
|
|
@ -14,6 +35,13 @@ All posts in here will have the category set to /zsh/. |
|
|
|
|
:EXPORT_HUGO_MENU: :menu "main" |
|
|
|
|
:header-args: :tangle (org-tags-to-filenames) |
|
|
|
|
:END: |
|
|
|
|
|
|
|
|
|
# Note that one would have to export only this subtree, otherwise it |
|
|
|
|
# is not going to work… This would need to be investigated |
|
|
|
|
|
|
|
|
|
# also, we need to ensure that the hugo thingie is called upon |
|
|
|
|
# export. how to do that? |
|
|
|
|
|
|
|
|
|
This is my ~.zshrc~; it will be used in many environments: |
|
|
|
|
- daily driver (gentoo box with kde) |
|
|
|
|
- blender box (gentoo box with no gui) |
|
|
|
|
@ -23,43 +51,20 @@ This is my ~.zshrc~; it will be used in many environments: |
|
|
|
|
|
|
|
|
|
Each environment has slightly different setups, which will be tangled |
|
|
|
|
to different files according to the function `org-tags-to-filenames', |
|
|
|
|
which checks the tags of the current headline and returns a list of |
|
|
|
|
corresponding filenames. For instance if the tags are daily and pi, |
|
|
|
|
the function returns '(".zshrc" ".zshrc.pi") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#+name:def-tag |
|
|
|
|
#+begin_src emacs-lisp :results output silent |
|
|
|
|
(setq tag-to-filenames-alist '(("daily" . ".zshrc") |
|
|
|
|
("blender" . ".zshrc.blender") |
|
|
|
|
("pi" . ".zshrc.pi") |
|
|
|
|
("android" . ".zshrc.android") |
|
|
|
|
("mips" . ".zshrc.mips"))) |
|
|
|
|
(defun org-tags-to-filenames () |
|
|
|
|
(let ((tags (car (last (org-heading-components))))) |
|
|
|
|
(when (stringp tags) |
|
|
|
|
(remove nil (mapcar |
|
|
|
|
(lambda (tag) |
|
|
|
|
(cdr (assoc tag tag-to-filenames-alist))) |
|
|
|
|
(org-split-string tags ":")))))) |
|
|
|
|
#+end_src |
|
|
|
|
|
|
|
|
|
defined in the previous section. |
|
|
|
|
|
|
|
|
|
*** Include :daily:pi:android: |
|
|
|
|
|
|
|
|
|
First, include a script that sets a number of confidential data (e.g. API keys and such) |
|
|
|
|
#+BEGIN_SRC sh |
|
|
|
|
#+begin_src sh |
|
|
|
|
source ~/.config/confidential.sh |
|
|
|
|
# This defines a number of env variables: |
|
|
|
|
# ANDROID_A3=xxxx |
|
|
|
|
# ANDROID_BLU=xxx |
|
|
|
|
# ANDROID_IP=xxx.xxx.xxx.xxx |
|
|
|
|
# ifttt_apikey=xyz |
|
|
|
|
#+end_src |
|
|
|
|
Then, add helper directory to fpath |
|
|
|
|
#+begin_src sh |
|
|
|
|
fpath=(~/clones/zshrc/ $fpath) |
|
|
|
|
|
|
|
|
|
#+end_src |
|
|
|
|
*** KDE helpers :daily: |
|
|
|
|
|
|
|
|
|
|