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: Dale Snell
Subject: Re: make buffer be c++ mode?
Date: Sat, 23 May 2015 18:20:36 -0700

On Sat, 23 May 2015 17:30:57 -0400, in message
CAMJ-YiSzJjOBwUfWvCrexzihW5zV8qJyKzKPyi4Ss8u1PR1dGg@mail.gmail.com, Jai
Dayal wrote:

> Hi,
> 
> 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.
> 
> Thanks


For one-off editing of just one file, John's suggestion is fine.
If you're going to be editing .cu files on more than an occasional
basis, something along the line of Emanuel's suggestion is a good
idea.

On the third hand, if you're going to be editing this one
file once in a while, stick a file-local variable in it.  You can
do this one of two ways.  One: make the following the first line
of your program:

    // -*- mode: c++; -*-

Other settings can be added, thus:

    // -*- mode: c++; fill-column: 72; <and so on...> -*-

(The "-*-" strings are required for this method.)

Two: stick it at the end of the file, thusly:

    // Local variables:
    // mode: c++
    // <another setting, if you want>
    // <yet another setting>
    // End:

Note that in all cases, the local variable statements are entered
as comments, so that the compiler won't see them.

Hope this helps, and have fun!

--Dale

-- 
In Xanadu did Kubla Khan a stately pleasure dome decree
But only if the NFL to a franchise would agree.

Attachment: pgp3sfYydpL9r.pgp
Description: OpenPGP digital signature


reply via email to

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