Mercurial > dotfiles
comparison .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 |
comparison
equal
deleted
inserted
replaced
352:3111d61151be | 353:95621f473f7e |
---|---|
16 (set-variable 'af-cleanup-whitespace t) | 16 (set-variable 'af-cleanup-whitespace t) |
17 (add-hook 'c-mode-hook 'af-tab-fix) | 17 (add-hook 'c-mode-hook 'af-tab-fix) |
18 (add-hook 'c++-mode-hook 'af-tab-fix) | 18 (add-hook 'c++-mode-hook 'af-tab-fix) |
19 (add-hook 'sh-mode-hook 'af-tab-fix) | 19 (add-hook 'sh-mode-hook 'af-tab-fix) |
20 (add-hook 'emacs-lisp-mode-hook 'af-tab-fix) | 20 (add-hook 'emacs-lisp-mode-hook 'af-tab-fix) |
21 | |
22 (defun af-c-mode-hook () | |
23 (interactive) | |
24 (if (string-match "mercurial/" buffer-file-name) | |
25 (progn | |
26 (message "looks like an hg c file, using kernel style") | |
27 (c-set-style "linux") | |
28 (setq indent-tabs-mode t) | |
29 (setq whitespace-style (remove 'indentation (remove 'tabs whitespace-style)))))) | |
30 (add-hook 'c-mode-common-hook 'af-c-mode-hook) | |
21 | 31 |
22 ;; disable whitespace cleanup in modes sensitive to whitespace | 32 ;; disable whitespace cleanup in modes sensitive to whitespace |
23 (defun af-no-clean-whitespace () | 33 (defun af-no-clean-whitespace () |
24 (interactive) | 34 (interactive) |
25 (make-variable-buffer-local 'af-cleanup-whitespace) | 35 (make-variable-buffer-local 'af-cleanup-whitespace) |