changeset 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 3111d61151be
children 3d46ce32c14e
files .elisp/settings/40.modes.el
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
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)