Since my last post, I was thinking about remodeling a dotfiles.org to a setup.org.

This new orgmode is used to apply Literate Programming and get:

All important information about this setup.org:

Applying Literate Programming Use Emacs + Orgmode babel to convert source code blocks into files with tangle is something very easy.

Bellow an example to create the file: $HOME/.gitconfig with a core and user sections:

* git
*** .gitconfig
	:PROPERTIES:
	:tangle:   ~/.gitconfig
	:END:
**** Core
	 #+begin_src conf
	   [core]
	   excludesfile = ~/.gitignore
	   editor = "vim"
	   autocrlf = input
	   filemode = false
	   pager = less -r
	 #+end_src
**** User
	 My personal information and GPG key for signing commits.
	 #+begin_src conf
	   [user]
	   name = Lenilson Jose Dias
	   email = lenilson@gmail.com
	   signingkey = 5074D5CF
	 #+end_src

It’s possible to create shell scripts too:

** Setup emacs
   :PROPERTIES:
   :tangle:   ~/bin/setup-emacs
   :mkdirp:   yes
   :shebang:  "#!/usr/bin/env csh"
   :END: ~$HOME/bin/setup-emacs~ for now clone an Emacs git repository...
   #+begin_src sh
	 rm -rf ~/.emacs.d
	 git clone https://github.com/0x7cc/.emacs.d ~/.emacs.d
   #+end_src

This source code block will create a `csh` shell script `$HOME/bin/setup-emacs`.

It’s possible create files in a different file-mode too:

*** msmtp
	:PROPERTIES:
	:tangle:   ~/.msmtprc
	:tangle-mode: (identity #o600)
	:END:

	 [[http://msmtp.sourceforge.net/][msmtp]] is a SMTP client. From [[http://jonmorehouse.tumblr.com/post/100650456885/yosemite-mutt][here]]:

	 #+begin_src conf
	  # Set default values for all following accounts.
	  defaults
	  auth           on
	  tls            on
	  tls_trust_file /etc/ssl/certs/ca-certificates.crt
	  logfile        ~/.msmtp.log

	  # Gmail
	  account        personal_email
	  host           smtp.gmail.com
	  port           587
	  from           lenilson@gmail.com
	  user           lenilson@gmail.com
	  password

	  account default : personal_email
	 #+end_src

Here with :tangle-mode: (identity #o600) will create $HOME/.msmtprc with 600 permission mode.

The section Purpose has some inspiration references like this video from @howardabrams.

For this project I am using a Makefile to set up everything, but you can only call:

emacs --batch --eval "(require 'org)(require 'ob-tangle)" --eval '(org-babel-tangle-file "<path to>/setup.org")'