Mercurial > dotfiles
diff .elisp/settings/40.modes.el @ 353:95621f473f7e
c-mode: detect when I'm editing a .c file from hg and set style appropriately
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Wed, 05 Nov 2014 12:53:02 -0500 |
parents | 0a593d2c0595 |
children | 5843408c9a38 |
line wrap: on
line diff
--- a/.elisp/settings/40.modes.el +++ b/.elisp/settings/40.modes.el @@ -19,6 +19,16 @@ point." (add-hook 'sh-mode-hook 'af-tab-fix) (add-hook 'emacs-lisp-mode-hook 'af-tab-fix) +(defun af-c-mode-hook () + (interactive) + (if (string-match "mercurial/" buffer-file-name) + (progn + (message "looks like an hg c file, using kernel style") + (c-set-style "linux") + (setq indent-tabs-mode t) + (setq whitespace-style (remove 'indentation (remove 'tabs whitespace-style)))))) +(add-hook 'c-mode-common-hook 'af-c-mode-hook) + ;; disable whitespace cleanup in modes sensitive to whitespace (defun af-no-clean-whitespace () (interactive)