[OS X Emacs] Re: Tab & Formatting Magic In Settings - How To Stop It?
Erik L. Arneson
dybbuk at lnouv.com
Mon Sep 27 08:58:11 EDT 2010
On Sun, 26 Sep 2010, Greg Fotiades wrote:
> I want my tabs such as this:
> - Tab key always inserts a tab (expanded to 3 spaces) - ALWAYS - even
> if it doesn't "think" I want a tab there.
So you actually want it to insert three spaces, not a tab character.
You want this:
(setq indent-tabs-mode nil
c-basic-offset 3)
You can probably use M-x customize-variable for both of those.
> - When I hit enter, it goes to the same column this line started,
> ie. if I'm col 12, I type a function, hit enter, I'd like to be at
> col 12 again, and if I keep hitting enter, it keeps spacing to col
> 12.
Oh yeah, I used to use that. It was handy! A quick Google search turns
up this:
(add-hook 'c-mode-common-hook '(lambda ()
(local-set-key (kbd "RET") 'newline-and-indent)))
But I'm not sure that will do exactly as you'd like. Experiment with it
and see.
> The problems I'm experiencing are that
> A) Even though my tabs are set to 3 and it should be expanding them
> to spaces (I like spaces, they're portable, tabs are not), every time
> I hit tab, it only indents 2 spaces - I can't find the number "2"
> anywhere in the "C" programming language part of the settings,
> either. I don't know where it's getting that from.
The `c-basic-offset' above should fix this, I hope.
> B) I'm guessing this is a side effect of the above, but is there any
> way I can make it STOP shifting things to where it "thinks" I want
> them. I make my case statements a certain way, I'd like the editor to
> respect that to some degree - it doesn't - at all, it moves the line
> to where it thinks it should be once I hit enter (for example if I'm
> at 12 col and typing a function, I hit enter, and it slides back to 10
> col for some reason once I hit enter, and I have to move up a line and
> throw in two more spaces).
I think you will find that the c-mode family of code is vast and has a
*huge* number of variables to control indentation. You may find it
annoying at first, but probably what you want to do is look at this:
M-x customize-group RET c RET
I see a bunch of other settings in there that might be of use to you,
but there's also a bunch of preset indentation styles for a wide variety
of common code formatting schemes.
Note that c-mode is used to control C, C++, Java, Perl, PHP, and pretty
much anything with even a remotely C-like syntax.
Emacs in general has a huge learning curve; just stick with it.
Eventually you will love it so much that you'll want to do everything
with it. (Once you load Gnus for the first time, it's all over!)
--
Erik Arneson <dybbuk at LNouv.com>
GPG Key ID : 1024D/62DA1D25 BitCoin : 1LqvuGUqJ4ZUSoE7YE9ngETjwp4yZ2uSdP
Office : +1.541.291.9776 Skype : callto://pymander
http://www.leisurenouveau.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 193 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/macosx-emacs/attachments/20100927/c38c2693/attachment.asc>
More information about the MacOSX-Emacs
mailing list