# HG changeset patch # User Oleksandr Gavenko # Date 1287666339 -10800 # Node ID c3390bcde24690bdc20b41c3ae6fa68c5a819f01 # Parent 1848e3b1fc00ecbfeacc656ce26abaefe06c6ee9 C and C++ both use .h extension for headers. By default this file opened in c-mode. Check headers for C++ keywords to enable c++-mode. diff -r 1848e3b1fc00 -r c3390bcde246 .emacs-my --- a/.emacs-my Tue Oct 12 15:05:33 2010 +0300 +++ b/.emacs-my Thu Oct 21 16:05:39 2010 +0300 @@ -980,6 +980,18 @@ (add-to-list 'auto-mode-alist '("\\.js$" . js-mode)) +(defun my-c++-header-file-p () + "Return non-nil, if in a C++ header." + (and (string-match "\\.h$" + (or (buffer-file-name) + (buffer-name))) + (save-excursion + (re-search-forward "\\_" nil t)))) + +(add-to-list 'magic-mode-alist + '(my-c++-header-file-p . c++-mode)) + + (setq-default comment-style (quote indent)) (setq-default comment-column 44) (setq-default comment-fill-column my-fill-column)