README.org
. It’s saved automatically on each save.
Define a function that disables export of a code block if the conftype property
does not match a certain value. the idea is that the conftype
property is set
at top level (after pulling to a new device) and it is then respected by the
tangle process.
(defun my-tangle-if-property-in-tags (property-name)
"Create :tangle argument based on a local property value.
Check if the conftype property matches a tag at the current postition.
The tags are searched recursively, so it's recommended to tag
the last subheading level. If it matches return the property
value of the TANGLE_FILE_NAME or ('yes' by default)
if not return 'no'."
(if (member (+org-get-global-property property-name) (org-get-tags))
(let ((positive-return (org-entry-get nil "TANGLE_FILE_NAME" t)))
(if positive-return positive-return "yes"))
"no")
)
(my-tangle-if-property-in-tags "conftype")
#** making files executable
Org tangle will export files each time with standard permissions.
In order to make them executable after tangling I need to add the :shebang
#!/bin/bash
header argument.
this is important for sharing!!!
Org-crypt
allows to in document encrypt the content of headings. These headings
can just be tagged with :crypt:
and they will be encrypted on every safe.
Unfortunately one of the pre-tangle-hooks
save the buffer before tangling. Thus
org will miss code blocks in encrypted headings. Luckily I am not the first one
who got to this problem and there is a solution: Org crypt and tangling source blocks - Where parallels cross
I now just need to call org-decrypt-entries
and then tangle the file.
(replace-regexp-in-string "\\./\\w+/" "" (org-entry-get nil "TANGLE_FILE_NAME" t))
(print (format "The %s configuration goes into ~%s~." (org-get-heading) <<getTangleFileName>>))