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

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

Re: a beginner's emacs troubles


From: Alan Mackenzie
Subject: Re: a beginner's emacs troubles
Date: Wed, 1 Aug 2007 08:59:07 +0000
User-agent: Mutt/1.5.9i

On Wed, Aug 01, 2007 at 01:41:35AM -0000, f33ldead@gmail.com wrote:
> On Aug 1, 1:45 am, "Drew Adams" <drew.ad...@oracle.com> wrote:

> > See user option `backward-delete-char-untabify-method'.

> OK, my final tab setting in my .emacs is as follows:

> (setq c-tab-always-indent nil)
> (global-set-key (kbd "TAB") 'self-insert-command)
> (setq-default tab-width 8
>               standard-indent 8
>               indent-tabs-mode t)
> (setq backward-delete-char-untabify-method nil)

> Now, in c-mode, in a function, I press tab, and it inserts a tab. I
> start typing "exec", it's still fine, then as I open a paranthesis to
> write the function call, everything's ruined again!

This is called "electric indentation", and you can switch it off by C-c
C-l, but you have to do this in each buffer separately.  To switch it off
by default, put this fairly early on in your emacs:

    (setq-default c-electric-flag nil)

You would have seen this in the CC Mode manual if you'd've read the page
"Getting Started" ;-).  Please spend a couple of hours browsing through
this manual.  It was extensively revised for Emacs 22.1.  Read the
earlier pages, and have a quick flick through the "FAQ" near the end.

> > Just a suggestion: It's your understanding of TAB in Emacs that you
> > need to improve, if you want to be able to use Emacs to your
> > advantage. ;-)

> Well, it's a habit of 10 years by now. It's not easy to change habits
> easily ;) What I expect is simply the behavior of nano; I'm shocked
> that it's such a struggle to achieve it in emacs.

Good!  If you're shocked, it shows that your prejudices, preconceptions
and so on are being questioned.  That's to say, you're getting a chance
to learn, to grow, to broaden your horizons, become a more mature, better
balanced person.  ;-)  If, after trying Emacs out for long enough (at
least a few weeks), you still can't get along with Emacs's <TAB>, then
it's probably not the right editor for you, and there's nothing wrong
with that.

Emacs is a supremely easy and productive tool to use.  However, it's an
utter bastard to learn.  We've all had to go through this process.

The thinking behind indentation being done by the <TAB> key, or when you
type a paren, is that it saves you time.  Typing lots of spaces at the
beginning of lines is BORING and TEDIOUS and distracts you from the real
business of writing your program.  Lining up your text correctly is also
BORING and TEDIOUS.  That's what your computer's there to do!

Right at the moment, you feel that you're out of control, and the text is
jumping about all over the place, and you can't even insert a simple tab
character, and you're probably screeming with rage and frustration.  So,
remap <TAB> to insert a tab, switch off the electricity and so on.  But
as soon as you feel you've got some semblance of control back, you should
gradually experiment with these features, switching them back on one by
one.  Spend some days and weeks playing with CC Mode's configuration
(hint: read the CC Mode manual - it has a page "Sample .emacs file" to
help you ;-).

Remember that Emacs's features weren't put in to confound new users; they
have been refined over over twenty years by the same people who actually
use them, to be as efficient and productive as possible, and some of
these people are amongst the smartest on the planet.

Once you've got used to it, you'll never ever want to use nano again,
just as a car driver wouldn't want to go back to using a child's pedal
car.

-- 
Alan Mackenzie (Ittersbach, Germany).




reply via email to

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