[Org files] remove python code for tangling, updated shebang

This commit removes all python source blocks that were previously used
to generate code. Consequently, the commands for tangling my org files
in the bootstrap script were updated.

[Bootstrap] A shebang header has been added to the org file, removing
the necessity of the shebang code block and manually setting
permissions for the script each time it is tangled.
This commit is contained in:
Lucien Cartier-Tilet 2020-09-03 12:15:16 +02:00
parent d34d4b0550
commit b50b403f41
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
4 changed files with 64 additions and 76 deletions

View File

@ -1,6 +1,4 @@
#!/usr/bin/fish #!/usr/bin/fish
# -*- mode: fish -*-
yadm decrypt yadm decrypt
set keyboardconf \ set keyboardconf \
@ -124,67 +122,56 @@ printf "\n# Tangling org files #################################################
printf '\n\n==== Tangling awesome.org\n\n' && \ printf '\n\n==== Tangling awesome.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/awesome.org")' --eval '(org-babel-tangle-file "~/org/config/awesome.org")'
printf '\n\n==== Tangling bin.org\n\n' && \ printf '\n\n==== Tangling bin.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/bin.org")' --eval '(org-babel-tangle-file "~/org/config/bin.org")'
printf '\n\n==== Tangling fish.org\n\n' && \ printf '\n\n==== Tangling fish.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/fish.org")' --eval '(org-babel-tangle-file "~/org/config/fish.org")'
printf '\n\n==== Tangling i3.org\n\n' && \ printf '\n\n==== Tangling i3.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/i3.org")' --eval '(org-babel-tangle-file "~/org/config/i3.org")'
printf '\n\n==== Tangling index.org\n\n' && \ printf '\n\n==== Tangling index.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/index.org")' --eval '(org-babel-tangle-file "~/org/config/index.org")'
printf '\n\n==== Tangling nano.org\n\n' && \ printf '\n\n==== Tangling nano.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/nano.org")' --eval '(org-babel-tangle-file "~/org/config/nano.org")'
printf '\n\n==== Tangling picom.org\n\n' && \ printf '\n\n==== Tangling picom.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/picom.org")' --eval '(org-babel-tangle-file "~/org/config/picom.org")'
printf '\n\n==== Tangling polybar.org\n\n' && \ printf '\n\n==== Tangling polybar.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/polybar.org")' --eval '(org-babel-tangle-file "~/org/config/polybar.org")'
printf '\n\n==== Tangling rustfmt.org\n\n' && \ printf '\n\n==== Tangling rustfmt.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/rustfmt.org")' --eval '(org-babel-tangle-file "~/org/config/rustfmt.org")'
printf '\n\n==== Tangling spacemacs.org\n\n' && \ printf '\n\n==== Tangling spacemacs.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/spacemacs.org")' --eval '(org-babel-tangle-file "~/org/config/spacemacs.org")'
printf '\n\n==== Tangling tmux.org\n\n' && \ printf '\n\n==== Tangling tmux.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/tmux.org")' --eval '(org-babel-tangle-file "~/org/config/tmux.org")'
find ~/.local/bin -type f -exec chmod +x {} + find ~/.local/bin -type f -exec chmod +x {} +

View File

@ -85,8 +85,7 @@
* Execute bootstrap * Execute bootstrap
:PROPERTIES: :PROPERTIES:
:HEADER-ARGS: :tangle ~/.config/yadm/bootstrap :HEADER-ARGS: :tangle ~/.config/yadm/bootstrap :shebang "#!/usr/bin/fish"
:HEADER-ARGS:python: :tangle no
:CUSTOM_ID: Execute_bootstrap-e37054ef :CUSTOM_ID: Execute_bootstrap-e37054ef
:END: :END:
=yadm= comes with a very handy feature: its bootstrap script. It can be =yadm= comes with a very handy feature: its bootstrap script. It can be
@ -97,12 +96,6 @@
yadm clone https://github.com/phundrak/dotfiles yadm clone https://github.com/phundrak/dotfiles
#+END_SRC #+END_SRC
Notice these two header files, we can see this is a fish script, hence why we
need fish (which is my daily shell anyway).
#+BEGIN_SRC fish
#!/usr/bin/fish
# -*- mode: fish -*-
#+END_SRC
Lets take a look at what it does. Lets take a look at what it does.
** Decrypt private yadm files ** Decrypt private yadm files
@ -343,60 +336,66 @@
(format "printf '\\n\\n==== Tangling %s\\n\\n' && \\\n" x) (format "printf '\\n\\n==== Tangling %s\\n\\n' && \\\n" x)
(concat "emacs -q --batch --eval '(require \\'ob-tangle)' \\\n" (concat "emacs -q --batch --eval '(require \\'ob-tangle)' \\\n"
"--eval '(setq org-confirm-babel-evaluate nil)' \\\n" "--eval '(setq org-confirm-babel-evaluate nil)' \\\n"
"--eval '(org-babel-do-load-languages \\'org-babel-load-languages \\'((python . t)))' \\\n"
(format "--eval '(org-babel-tangle-file \"~/org/config/%s\")'\n" x)))) (format "--eval '(org-babel-tangle-file \"~/org/config/%s\")'\n" x))))
files files
"\n") "\n")
#+END_SRC #+END_SRC
#+RESULTS[5a74a8854c2ed55bea68930073468d18d04bea08]: generate-tangle #+RESULTS[1c025aa6fca0a3251b995f0eaf6fa866cb2a8497]: generate-tangle
#+begin_example #+begin_example
printf '\n\n==== Tangling awesome.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-tangle-file "~/org/config/awesome.org")'
printf '\n\n==== Tangling bin.org\n\n' && \ printf '\n\n==== Tangling bin.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/bin.org")' --eval '(org-babel-tangle-file "~/org/config/bin.org")'
printf '\n\n==== Tangling fish.org\n\n' && \ printf '\n\n==== Tangling fish.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/fish.org")' --eval '(org-babel-tangle-file "~/org/config/fish.org")'
printf '\n\n==== Tangling i3.org\n\n' && \ printf '\n\n==== Tangling i3.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/i3.org")' --eval '(org-babel-tangle-file "~/org/config/i3.org")'
printf '\n\n==== Tangling index.org\n\n' && \ printf '\n\n==== Tangling index.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/index.org")' --eval '(org-babel-tangle-file "~/org/config/index.org")'
printf '\n\n==== Tangling nano.org\n\n' && \ printf '\n\n==== Tangling nano.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/nano.org")' --eval '(org-babel-tangle-file "~/org/config/nano.org")'
printf '\n\n==== Tangling picom.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-tangle-file "~/org/config/picom.org")'
printf '\n\n==== Tangling polybar.org\n\n' && \ printf '\n\n==== Tangling polybar.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/polybar.org")' --eval '(org-babel-tangle-file "~/org/config/polybar.org")'
printf '\n\n==== Tangling rustfmt.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-tangle-file "~/org/config/rustfmt.org")'
printf '\n\n==== Tangling spacemacs.org\n\n' && \ printf '\n\n==== Tangling spacemacs.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/spacemacs.org")' --eval '(org-babel-tangle-file "~/org/config/spacemacs.org")'
printf '\n\n==== Tangling tmux.org\n\n' && \ printf '\n\n==== Tangling tmux.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(setq org-confirm-babel-evaluate nil)' \ --eval '(setq org-confirm-babel-evaluate nil)' \
--eval '(org-babel-do-load-languages \'org-babel-load-languages \'((python . t)))' \
--eval '(org-babel-tangle-file "~/org/config/tmux.org")' --eval '(org-babel-tangle-file "~/org/config/tmux.org")'
#+end_example #+end_example

View File

@ -5,9 +5,8 @@
#+HTML_HEAD_EXTRA: <meta property="og:title" content="Phundrak's polybar config" /> #+HTML_HEAD_EXTRA: <meta property="og:title" content="Phundrak's polybar config" />
#+HTML_HEAD_EXTRA: <meta property="og:description" content="Description of the polybar config file of Phundrak" /> #+HTML_HEAD_EXTRA: <meta property="og:description" content="Description of the polybar config file of Phundrak" />
#+PROPERTY: header-args :exports none #+PROPERTY: header-args :exports none
#+PROPERTY: header-args:python :results output
#+PROPERTY: header-args:emacs-lisp :tangle no :exports none #+PROPERTY: header-args:emacs-lisp :tangle no :exports none
#+PROPERTY: header-args:conf-windows :tangle ~/.config/polybar/config :noweb yes :exports code #+PROPERTY: header-args:conf-windows :tangle ~/.config/polybar/config :noweb yes :exports code :mkdirp yes
* Presentation * Presentation
:PROPERTIES: :PROPERTIES:
@ -238,23 +237,32 @@
| Siji | Siji:pixelsize=8 | 0 | Symbol display | | Siji | Siji:pixelsize=8 | 0 | Symbol display |
| Default font | fixed:pixelsize=8 | 0 | Fallback font | | Default font | fixed:pixelsize=8 | 0 | Fallback font |
#+NAME: font-config #+NAME: font-ws-config
#+BEGIN_SRC python :var table=fonts-polybar :cache yes #+HEADER: :var text="font"
for i in range(0, len(table)): #+BEGIN_SRC emacs-lisp :var table=fonts-polybar :cache yes
print("font-{0} = {1};{2}".format(i, table[i][1], table[i][2])) (setq counter 0)
(mapconcat (lambda (font)
(setq counter (+ 1 counter))
(format "%s-%d = %s;%s"
text
(- counter 1)
(nth 1 font)
(nth 2 font)))
table
"\n")
#+END_SRC #+END_SRC
#+RESULTS[a055f871fdabec995b015a8f083a77b0096a9c7f]: font-config #+RESULTS[567cfb5e5a0bdfb0eca90846c8292b7d3fd585ea]: font-ws-config
: font-0 = Fira Sans Book:style=Book:pixelsize=10;1 : font-0 = Fira Sans Book:style=Book:pixelsize=10;1
: font-1 = IPAMincho:style=regular:pixelsize=6;0 : font-1 = IPAMincho:style=regular:pixelsize=6;0
: font-2 = unifont:fontformat=truetype:size=6:antialias=false;0 : font-2 = unifont:fontformat=truetype:size=6:antialias=false;0
: font-3 = NotoEmoji:scale=12:style=Book;0 : font-3 = NotoEmoji:style=Book:scale=16;0
: font-4 = Siji:pixelsize=8;0 : font-4 = Siji:pixelsize=8;0
: font-5 = fixed:pixelsize=8;0 : font-5 = fixed:pixelsize=8;0
Heres the font configuration: Heres the font configuration:
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
<<font-config()>> <<font-ws-config(text="font",table=fonts-polybar)>>
#+END_SRC #+END_SRC
Note that only Fira Sans get a small offset due to the size of the font and Note that only Fira Sans get a small offset due to the size of the font and
@ -270,20 +278,35 @@
workspace indicator for i3. In the middle, well get the title of the workspace indicator for i3. In the middle, well get the title of the
focused window, and to the left well have the date and time. focused window, and to the left well have the date and time.
#+NAME: modules-generate #+NAME: modules-generate
#+BEGIN_SRC python :var table=[] :results value :cache yes #+BEGIN_SRC emacs-lisp :var table=top-modules :results value :cache yes
left = 'modules-left = ' (setq right '()
center = 'modules-center = ' center '()
right = 'modules-right = ' left '())
for line in table: (dolist (module table)
if line[1] == 'left': (let* ((module-name (nth 0 module))
left += line[0] + ' ' (module-layout (nth 1 module)))
elif line[1] == 'center': (message "%S" module-layout)
center += line[0] + ' ' (add-to-list (cond
else: ((string= "left" module-layout) 'left)
right += line[0] + ' ' ((string= "center" module-layout) 'center)
return left + '\n' + center + '\n' + right (t 'right))
module-name)))
(concat (concat "modules-left = "
(mapconcat #'identity left " ")
"\n")
(concat "modules-center = "
(mapconcat #'identity center " ")
"\n")
(concat "modules-right = "
(mapconcat #'identity right " ")
"\n"))
#+END_SRC #+END_SRC
#+RESULTS[90b932dc0fd32501e1513f14059b92de09a7b59e]: modules-generate
: modules-left = i3
: modules-center = xwindow
: modules-right = date
Here is the list of modules used: Here is the list of modules used:
#+NAME: top-modules #+NAME: top-modules
| Module name | Position | Brief description | | Module name | Position | Brief description |
@ -369,7 +392,7 @@
on, see [[#Declaration_of_the_bars-Top_bar_declaration-Fonts_and_locale-70a25466][Fonts and locale]] of the top bar. on, see [[#Declaration_of_the_bars-Top_bar_declaration-Fonts_and_locale-70a25466][Fonts and locale]] of the top bar.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
<<locale-bar>> <<locale-bar>>
<<font-config()>> <<font-ws-config(text="font",table=fonts-polybar)>>
#+END_SRC #+END_SRC
*** Modules *** Modules
@ -873,29 +896,9 @@
| 9 | 九 | | 9 | 九 |
| 0 | 十 | | 0 | 十 |
#+NAME: generate-ws-names
#+BEGIN_SRC python :var names=ws-names :exports none :cache yes
for i in range(0, len(names)):
print('ws-icon-{0} = {1};{2}'.format(i, names[i][0], names[i][1]))
#+END_SRC
#+RESULTS[e4cec50affbfc3c284504f1a0f3b6a8d78197c5d]: generate-ws-names
#+begin_example
ws-icon-0 = 1;一
ws-icon-1 = 2;二
ws-icon-2 = 3;三
ws-icon-3 = 4;四
ws-icon-4 = 5;五
ws-icon-5 = 6;六
ws-icon-6 = 7;七
ws-icon-7 = 8;八
ws-icon-8 = 9;九
ws-icon-9 = 0;十
#+end_example
Here are the corresponding configuration lines: Here are the corresponding configuration lines:
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
<<generate-ws-names()>> <<font-ws-config(text="ws",table=ws-names)>>
#+END_SRC #+END_SRC
In case we create a workspace which isnt named from ~0~ to ~9~, I want it In case we create a workspace which isnt named from ~0~ to ~9~, I want it

View File

@ -2825,8 +2825,7 @@
#+END_SRC #+END_SRC
Now, all keybindings that will be defined can be invoked in Normal-mode with Now, all keybindings that will be defined can be invoked in Normal-mode with
the src_emacs-lisp[:exports results]{(princ dotspacemacs-leader-key)} key the ~SPC~ key followed by the sequence assigned to each keybinding.
followed by the sequence assigned to each keybinding.
Before some more specialized categories, I have two commands which dont fit Before some more specialized categories, I have two commands which dont fit
into any other category that I sometime use. The first one is a fix for the into any other category that I sometime use. The first one is a fix for the