help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs . How can I associate *.cu files as cc mode as a default ?


From: Gordon Beaton
Subject: Re: Emacs . How can I associate *.cu files as cc mode as a default ?
Date: 19 Sep 2007 06:24:39 GMT
User-agent: slrn/0.9.8.1pl1 (Linux)

On 19 Sep 2007 00:28:09 GMT, Tyler Smith wrote:
> This function will do that:
>
> (defun my-find-file-hook()
>   (let ((fn (buffer-file-name)))
>     (when (string-match "\\.cu$" fn)
>       (cc-mode))))
>
> You have to tell Emacs to run this function every time you open a new
> file, so you add the hook:
>
> (add-hook 'find-file-hooks 'my-find-file-hook)


No need for the function. Just add the extension to auto-mode-alist:

      (add-to-list 'auto-mode-alist '("\\.cu$" . c-mode))

/gordon

--


reply via email to

[Prev in Thread] Current Thread [Next in Thread]