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

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

Re: tidy up code


From: nullius . filius
Subject: Re: tidy up code
Date: Fri, 21 Dec 2007 04:07:05 -0800 (PST)
User-agent: G2/1.0

X-no-archive: Yes

Umar Said wrote:

>
> Yes I'm new to Emacs and confused with it. [I'm try to format]
>
>    int main(void)
>    {
>      int a = 1;
>          if (a == 1)
>         cout << "true" << endl;
>              else
>                cout << "false" << endl;
>                return 0
>                     }
>
> I've also tried M-x indent-region and other indent command, but still no
> success.

You have to give a hint to emacs that you want to format a c++ file.
You do that by naming the file before you try and format it.

Go to the file menu and click on the menu item 'Visit new File' go to
the directory you want to save your file, and type in your file name
(test.cpp) and click the open button.

Now paste your code into emacs.

Once emacs has a hint on what type of file it is formatting, then
it can format it.


reply via email to

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