all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: Mike H <hspnew@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: How to associate more than two file-types as C code, code included
Date: Tue, 04 Dec 2007 00:56:54 +0100	[thread overview]
Message-ID: <475497C6.1010707@gmail.com> (raw)
In-Reply-To: <c05308e4-16cc-41fd-960e-c9055cc63ea0@x69g2000hsx.googlegroups.com>

Mike H wrote:
> I want the files .cu and .txx to be recognized as C files..
> One block of the following codes works separately, but when I put them
> together.. it doesn't work.
> 
> How should I do it ?
> 
> when ((string-match "\\.cu$" fn) || (string-match "\\.txx$" fn))
> 
> will something like above work? i tried, and it doesn't...
> 
> Thanks..
> 
> 
> (defun my-find-file-hook()
>   (let ((fn (buffer-file-name)))
>     (when (string-match "\\.cu$" fn)
>       (c-mode))))
> (add-hook 'find-file-hooks 'my-find-file-hook)
> 
> (defun my-find-file-hook()
>   (let ((fn (buffer-file-name)))
>     (when (string-match "\\.txx$" fn)
>       (c-mode))))
> (add-hook 'find-file-hooks 'my-find-file-hook)


A much more easy way to do it is to use auto-mode-alist, do

   M-x (info "(emacs) Choosing Modes") RET

in Emacs for info.

  reply	other threads:[~2007-12-03 23:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-03 22:50 How to associate more than two file-types as C code, code included Mike H
2007-12-03 23:56 ` Lennart Borgman (gmail) [this message]
2007-12-04 12:59 ` Peter Dyballa
     [not found] ` <mailman.4464.1196726225.18990.help-gnu-emacs@gnu.org>
2007-12-04 17:27   ` Mike H
     [not found] ` <mailman.4488.1196773183.18990.help-gnu-emacs@gnu.org>
2007-12-04 17:27   ` Mike H

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=475497C6.1010707@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=hspnew@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.