all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dale Snell <ddsnell@frontier.com>
To: help-gnu-emacs@gnu.org
Subject: Re: make buffer be c++ mode?
Date: Sat, 23 May 2015 18:20:36 -0700	[thread overview]
Message-ID: <20150523182036.481b3264@zothique.localdomain> (raw)
In-Reply-To: <CAMJ-YiSzJjOBwUfWvCrexzihW5zV8qJyKzKPyi4Ss8u1PR1dGg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1424 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  parent reply	other threads:[~2015-05-24  1:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-23 21:30 make buffer be c++ mode? Jai Dayal
2015-05-23 22:14 ` John Mastro
2015-05-24  1:20 ` Dale Snell [this message]
     [not found] <mailman.3550.1432416681.904.help-gnu-emacs@gnu.org>
2015-05-23 23:27 ` Emanuel Berg
2015-05-24  8:49   ` tomas

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=20150523182036.481b3264@zothique.localdomain \
    --to=ddsnell@frontier.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.