From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: make buffer be c++ mode? Date: Sun, 24 May 2015 10:49:55 +0200 Message-ID: <20150524084955.GA25139@tuxteam.de> References: <87bnhazxgd.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; x-action=pgp-signed X-Trace: ger.gmane.org 1432457429 30514 80.91.229.3 (24 May 2015 08:50:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 24 May 2015 08:50:29 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Emanuel Berg Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 24 10:50:24 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YwRbz-0006oF-PF for geh-help-gnu-emacs@m.gmane.org; Sun, 24 May 2015 10:50:23 +0200 Original-Received: from localhost ([::1]:39402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwRby-0006sg-SF for geh-help-gnu-emacs@m.gmane.org; Sun, 24 May 2015 04:50:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwRbk-0006sZ-ON for help-gnu-emacs@gnu.org; Sun, 24 May 2015 04:50:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YwRbf-0000xI-KI for help-gnu-emacs@gnu.org; Sun, 24 May 2015 04:50:08 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]:43366 helo=tomasium.tuxteam.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwRbf-0000gm-E4 for help-gnu-emacs@gnu.org; Sun, 24 May 2015 04:50:03 -0400 Original-Received: from tomas by tomasium.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1YwRbX-0006ZI-H8; Sun, 24 May 2015 10:49:55 +0200 In-Reply-To: <87bnhazxgd.fsf@debian.uxu> User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 5.199.139.25 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:104542 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sun, May 24, 2015 at 01:27:30AM +0200, Emanuel Berg wrote: > Jai Dayal writes: > > > I have a file that I've opened with a .cu extension. > > It's C++ code written for Cuda. How do I force Emacs > > to display the buffer as if it were C mode? I just > > want to do it just for this buffer. > > If you want this for this particular file and none > other, do like this: > > (setq magic-mode-alist '(("/\\* cpp \\*/" . c++-mode))) > > Then write > > /* cpp */ > > first line in your .cu file. Good idea -- I'd tend to go with Dale's approach in the same thread, because it's more "standard" ("principle of least astonishment"). The -*- mode:foo -*- "cookie" at the start of the file (or a corresponding block at the end) are "the usual way" of achieving this. > If you want this for any file with a .cu extension, > you can do it like this - here I paste my code, you > insert your data (.cu and c++-mode) the same way: Yep, this would be the more "permanent" solutions. - -- t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlVhkLMACgkQBcgs9XrR2kZWxQCeJVrAHNlBb++9RC9XVKpztZWa OpkAnis5orLGalUm6FOtLx+cISWv1ORM =uypC -----END PGP SIGNATURE-----