all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: <tomas@tuxteam.de>
To: Emanuel Berg <embe8573@student.uu.se>
Cc: help-gnu-emacs@gnu.org
Subject: Re: make buffer be c++ mode?
Date: Sun, 24 May 2015 10:49:55 +0200	[thread overview]
Message-ID: <20150524084955.GA25139@tuxteam.de> (raw)
In-Reply-To: <87bnhazxgd.fsf@debian.uxu>

-----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	other threads:[~2015-05-24  8:49 UTC|newest]

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

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=20150524084955.GA25139@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=embe8573@student.uu.se \
    --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.