Use column view (C-c C-x C-c
) to edit the settings file. Once done,
use org-babel-tangle
(C-c C-v t
) to install to you init file. You
can quit column view by putting point in any cell and pressing ‘q’
The machine name can be retrieved by running eval-expression
(M-:
)
and calling (system-name). You can also set the system name using the
environment variable “SYSTEM_NAME” outside of emacs.
By default, the output file is user-init-file
.
IMPORTANT Editing a cell and leaving it blank is not the same as deleting a property, it will leave an empty string which will break inheritance. Use the custom ‘d’ key binding defined in the utils headline to delete a cell while in column view.
This block determines how all proceeding src blocks will tangle
(defun determine-tangle-at-point-from-machine-name ()
"Compare the current system name to the space-separated list of
machine names in the property 'TANGLE_MACHINES'. Return
'OUTPUT_FILE' if defined or `user-init-file' otherwise. If running
in quiet mode, you will be prompted for the init file."
(unless user-init-file
(interactive)
(setq user-init-file
(read-file-name "User init file: " "~/" nil nil ".emacs")))
(let ((machines (split-string
(or (org-entry-get (point) "TANGLE_MACHINES" t t)
"")))
(allowed-machines (list "*"
(system-name)
(getenv "SYSTEM_NAME")))
(output-file (or (org-entry-get (point) "OUTPUT_FILE" t t)
user-init-file)))
(if (and machines (seq-intersection machines allowed-machines))
output-file
"no")))
<<bootstrap()>>
(require 'org)
(require 'org-colview)
(defun org-columns-destroy-at-point ()
"Delete the property at point while in column view"
(interactive)
(let ((prop (get-char-property (point)
'org-columns-key)))
(org-entry-delete (point) prop)
(org-columns-redo)))
(org-defkey org-columns-map "d" 'org-columns-destroy-at-point)
(server-start)