0

I am not getting indentation or colors when I open a cpp/h file with my emacs/xemacs installation on windows. Could you please advise what I need to do in my settings file to make this happen? Thanks

user236215
  • 7,278
  • 23
  • 59
  • 87

2 Answers2

1

It's the auto-mode-alist variable that stores the modes that should be invoked in relation with the file extension. This variable is configured by default to associate c++-mode to cpp files.

See the content of auto-mode-alist by doing a C-h v auto-mode-alist RET.

You could also try to define the association by yourself like this :

(setq auto-mode-alist
      (append '(("\\.\\(CC?\\|HH?\\)\\'" . c++-mode)
        ("\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\'" . c++-mode)
        ("\\.\\(cc\\|hh\\)\\'" . c++-mode)
        ) auto-mode-alist ))

Also note that .h files are by default considered C files, not C++.

Jérôme Radix
  • 10,285
  • 4
  • 34
  • 40
0

Do your files have a cpp or c extension?

Please have a look at emacs faq

Déjà vu
  • 28,223
  • 6
  • 72
  • 100