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

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

Re: emacs new user.


From: Colin S. Miller
Subject: Re: emacs new user.
Date: Tue, 25 Sep 2007 22:52:10 +0100
User-agent: Icedove 1.5.0.12 (X11/20070607)

Moofar wrote:
Your responses have been very welcome. Just knowing that there is an active
forum on the internet makes a huge difference. I have been reading the help
files and I know I just need to keep on reading and learning.
I do have one question that would just be very helpful to get me started. I
am working on a file in C, xxx.c and the auto indentation feature is not
working or not turned on. The c mode is enabled and other functions are
working. I'm reading about the c mode options and options in general through
in the documentation to figure it out, but an easy answer would be a huge
help.

Moofar,

Adding this to your .emacs file might help

(add-hook 'c-mode-common-hook '(lambda ()
                                 (c-set-style "whitesmith")
                                 (turn-on-auto-fill)
                                 (turn-on-font-lock)
                                 (setq fill-column 77)
                                 (setq indent-tabs-mode nil)
                                 (flyspell-prog-mode)
                                ))


This changes c-mode to
1) Whitesmith indent style; this has the curly brackets on their own line,
and lined-up with the preceding control block, indent is the default of 4 
characters.

2) Autoindent is enabled; the next line will default to the correct indentation 
when you press enter.
3) Syntax highlighting is enabled
4) Code auto-wraps to the next line at 77 characters
5) Spaces are used instead of tab characters for indenting
6) Spell checking is enabled (if ispell/aspell is installed; it will be on unix 
systems but not MS-Windows systems)


This is for XEmacs; it should work on GNU Emacs, but I can't guarantee this.

HTH,
Colin S. Miller

--
Replace the obvious in my email address with the first three letters of the 
hostname to reply.


reply via email to

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