This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Java SE 8 Programmer II Exam Study Guide and have Kathy Sierra, Bert Bates, & Elizabeth Robson on-line!
See this thread for details.
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

emacs and annoying tab characters  RSS feed

 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, it's not the tab characters that annoy me. It's emacs behavior of mixing tabs and spaces in indentation. I often use emacs for coding but I'm really annoyed that it mixes tabs and spaces. Does anyone happen to know what I need to do to make emacs use only one or the other? Preferrably, I would like to use all spaces for indentation.

Thanks in advance!

Layne
 
Saloon Keeper
Posts: 19267
85
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, this is Emacs. It knows BETTER than you do! [TM]

Memory's a little fuzzy, but I think Meta+x "untabify" or something like that will get rid of the tabs. Do this:

Press ESC (Meta)
Press x (down there on the bottom row )
When the prompt appears down below the status line, type "untab" and press the tab key and it will look for possible completions. Hopefully there's only one, but at least that should give a hint. Actually, I think it may be "untabify-buffer". There may also be an untabify-region that you'd use to untabify a "highlighted" section of the buffer.

Press Enter to execute the command.
 
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your ~/.emacs file, put



This tells emacs to use all spaces instead of tabs, except in Makefiles, which need tabs to work correctly. If you never edit Makefiles, you could leave off everything but the first line.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all the suggestions. I'll try them out when I get home tonight.

Layne
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!