For my c (c++) files, I added this reference to a cc-mode to my .emacs file:
(setq c-default-style "stroustrup"
c-basic-offset 4)
I would like to use the same for a custom extension ".dec." I tried to naively adjust this SO question doing
(defun my-decaf-mode ()
(when (and (stringp buffer-file-name)
(string-match "\\.dec\\'" buffer-file-name))
(setq c-default-style "stroustrup")
(c-basic-offset 4)) )
(add-hook 'find-file-hook 'my-decaf-mode)
which didn't work (I wrote a few lines in C; the support I would get giving the file a .c extension was not there). I also tried the actual customization type as in
(setq c-default-style "stroustrup"
c-basic-offset 4)) )
How could I get this done?