From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mike H Newsgroups: gmane.emacs.help Subject: Re: How to associate more than two file-types as C code, code included Date: Tue, 4 Dec 2007 09:27:45 -0800 (PST) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=EUC-KR Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1196790146 11351 80.91.229.12 (4 Dec 2007 17:42:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Dec 2007 17:42:26 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 04 18:42:32 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Izbmy-0000RJ-5J for geh-help-gnu-emacs@m.gmane.org; Tue, 04 Dec 2007 18:42:32 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Izbmh-0005sO-MX for geh-help-gnu-emacs@m.gmane.org; Tue, 04 Dec 2007 12:42:15 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!s12g2000prg.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 36 Original-NNTP-Posting-Host: 128.61.82.20 Original-X-Trace: posting.google.com 1196789265 3413 127.0.0.1 (4 Dec 2007 17:27:45 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 4 Dec 2007 17:27:45 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s12g2000prg.googlegroups.com; posting-host=128.61.82.20; posting-account=X0wLfwoAAACMUj0bN175vFl3ydbOJBp5 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; InfoPath.1),gzip(gfe),gzip(gfe) Content-Disposition: inline Original-Xref: shelby.stanford.edu gnu.emacs.help:154393 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:49820 Archived-At: On 12=BF=F93=C0=CF, =BF=C0=C8=C46=BD=C356=BA=D0, "Lennart Borgman (gmail)" wrote: > 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.- =B5=FB=BF=C2 =C5=D8=BD=BA=C6=AE =BC=FB=B1=E2=B1=E2 - > > - =B5=FB=BF=C2 =C5=D8=BD=BA=C6=AE =BA=B8=B1=E2 - Thanks!