Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am using Emacs for Python developement. My team is using Tab indentation, so I must do the same. The problem is that I can't figure out how to make python-mode use tabs instead of spaces. I want Emacs to automatically indent my line to the correct level when I press Ctrl-j.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You'll want to add the following to your .emacs file:

(add-hook 'python-mode-hook
  (lambda () (setq indent-tabs-mode t))
share|improve this answer
2  
It worked! Thanks! –  Cristi Mocanu Mar 18 '13 at 20:36
    
I'm a spoiled vim user, so I really don't know. What does the '-character do/mean? I find it rather odd to see an odd number of those in one statement ... –  Bananguin Mar 18 '13 at 20:55
    
@user1129682 quotation, see gnu.org/software/emacs/manual/html_node/elisp/Quoting.html –  Ulrich Dangel Mar 18 '13 at 21:04
    
@user1129682, emacs is mostly written in LISP, and the above is a LISP statement adding a function to python-mode-hook, a list of functions to run when starting to edit Python code. What the apostrophe does is to tell LISP that python-mode-hook is the variable to modify, not its name. –  vonbrand Mar 19 '13 at 17:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.