1

How can I get into the C++mode automatically when open .h files?

I uses emacs23.2 in fedura6.

I open .cpp file use C-x C-f xxx.h .

Cœur
  • 37,241
  • 25
  • 195
  • 267
1.618
  • 847
  • 2
  • 11
  • 19

2 Answers2

3
(setq auto-mode-alist (cons '("\\.h$" . c++-mode) auto-mode-alist))
Trey Jackson
  • 73,529
  • 11
  • 197
  • 229
3

probably this will be better aesthetically?

(add-to-list 'auto-mode-alist (cons "\\.h\\'" 'c++-mode))
suvayu
  • 4,271
  • 2
  • 29
  • 35