From dd3d51e750cf019f1c6907a7220eb5e30a6dbdd3 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 16 Apr 2016 21:30:27 -0400 Subject: [PATCH] C++: detect c++ .h header files --- modules/module-cc.el | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/modules/module-cc.el b/modules/module-cc.el index 4877d6acc..e5f9ade51 100644 --- a/modules/module-cc.el +++ b/modules/module-cc.el @@ -59,12 +59,18 @@ ad-do-it)))) (progn ;; Obj-C - (add-to-list 'magic-mode-alist - `(,(lambda () - (and (string= (file-name-extension buffer-file-name) "h") - (re-search-forward "@\\" - magic-mode-regexp-match-limit t))) - . objc-mode))) + (push `(,(lambda () + (and (f-ext? buffer-file-name "h") + (re-search-forward "@\\" + magic-mode-regexp-match-limit t))) + . objc-mode) + magic-mode-alist) + + (push `(,(lambda () + (and (f-ext? buffer-file-name "h") + (f-exists? (f-swap-ext buffer-file-name "cpp")))) + . c++-mode) + magic-mode-alist)) (use-package irony :config