Skip to content

Instantly share code, notes, and snippets.

@rickhull
Last active January 27, 2016 09:33
Show Gist options
  • Save rickhull/7797042 to your computer and use it in GitHub Desktop.
Save rickhull/7797042 to your computer and use it in GitHub Desktop.
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; use setq-default so modes that want tabs can enable this
(setq-default indent-tabs-mode nil)
(defun rick-sh-mode ()
"2 space indent"
(interactive)
(setq sh-basic-offset 2
sh-indentation 2))
(add-hook 'sh-mode-hook 'rick-sh-mode)
(defun rick-sh-mode-indent ()
(setq sh-basic-offset 2
sh-indentation 2)
(indent-region (point-min) (point-max) nil)
(save-buffer)
)
rick@tao:~$ emacs -batch tmp.sh -l ~/.emacs -f rick-sh-mode-indent
# works
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment