• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

emacs and annoying tab characters

 
Layne Lund
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
 
Tim Holloway
Saloon Keeper
Posts: 18304
56
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.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
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