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

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

Re: make buffer be c++ mode?


From: tomas
Subject: Re: make buffer be c++ mode?
Date: Sun, 24 May 2015 10:49:55 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, May 24, 2015 at 01:27:30AM +0200, Emanuel Berg wrote:
> Jai Dayal <dayalsoap@gmail.com> 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-----



reply via email to

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