I my last post, I tried to describe how to get rid of tabs in Python mode, and managed to not get it quite right. The previous command, python-guess-indent, really only turns off the indent guessing, but doesn't actually remove the tabs. It just happens that tabs are only used for every other indentation level. I had only tested the first level and missed that the tabs are still inserted later in.
So, to get rid of all tabs all the time, add the line (setq-default indent-tabs-mode nil) to your .emacs file. This turns off the replacement of spaces with tabs globally. Hooray! tabs are gone.
Showing posts with label python. Show all posts
Showing posts with label python. Show all posts
Monday, December 04, 2006
Friday, December 01, 2006
Emacs Tip: Troublesome Tabs in Python Mode
The Python mode in Emacs 22 (using python.el, not the python-mode.el from XEmacs) has a nice feature of deducing the spacing style based on the spacing and tabs that already exist in the file. Most of the time, it works really well, but, it does make getting rid of large tabs difficult. So, if you're having problems getting rid of tabs, simply toggle the indent guessing mode with the command python-guess-indent and just use the default Python mode settings for indentation.
Thursday, November 30, 2006
Python Tip: Make Python & Emacs Play Nice on Windows
I've discovered that making Python 2.4.4 work well under Emacs 22 on Windows has a few speed bumps. I'm not sure if these problems apply to other combinations of versions, but they may. Here's a list of things I had to do to make for a happy working environment.
To Run Python in Emacs
To Run Python in Emacs
- Install the ctypes package.
- Install the pyreadlines package. The binary installer worked well.
- Use C-c C-c to run the python code loaded in the current buffer
- Download the pychecker package
- Decompress it and go to the extracted folder in a Command Prompt
- In that folder, run the command python setup.py install
- Use C-c C-v to run the python code loaded in the current buffer with pychecker
- It seems that the debugger (pdb) is set up differently with Python 2.4.4 under Windows than other configurations. Consequently, Emacs' calls to pdb are all wrong.
- When the Python interpreter is loaded into Emacs, it appears to be in a text-only mode. Running programs with graphics does not seem to work.
Subscribe to:
Posts (Atom)