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: Tyler Smith
Subject: Re: Emacs . How can I associate *.cu files as cc mode as a default ?
Date: 20 Sep 2007 23:17:12 GMT
User-agent: slrn/0.9.8.1pl1 (Debian)

On 2007-09-19, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> Reading the manual, I see that find-file-hooks is now obsolete - will
>> find-file-hook be obsolete also?
>
> No: find-file-hooks is obsolete only because it was renamed to find-file-hook.
>
>> What should I replace the following
>> code with:
>
>> (defun my-find-file-hook()
>>   (let ((fn (buffer-file-name)))
>>     (when (string-match "latex2rtf" fn)
>>       (set-variable 'tab-width 4))))
>> (add-hook 'find-file-hook 'my-find-file-hook)
>
> You can keep it as-is.  Although I'd use (setq tab-width 4) instead of
> set-variable (set-variable is meant for interactive use, not that it matters
> in this case).
>
> Actually I'd probably do it that way instead:
>
>    (defun my-latex2rtf-c-mode ()
>      (c-mode)
>      (setq tab-width 4))
>
>    (add-to-list 'auto-mode-alist
>                 '("/latex2rtf/.*\\.c\\'" . my-latex2rtf-c-mode))
>

Actually, that's closer to what I really want. Thanks for the
suggestion! And to Lowell for your help too.

Cheers,

Tyler



reply via email to

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