# HG changeset patch # User Augie Fackler # Date 1415209982 18000 # Node ID 95621f473f7e6cdc0de1ac7e60ee0cfac81a81d5 # Parent 3111d61151be1cc2a82d63fc29905f96f95c70ec c-mode: detect when I'm editing a .c file from hg and set style appropriately diff --git a/.elisp/settings/40.modes.el b/.elisp/settings/40.modes.el --- 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)