emacs with python mode

Barry A. Warsaw bwarsaw at cnri.reston.va.us
Thu Aug 26 17:30:07 EDT 1999


>>>>> "GWG" == Gerhard W Gruber <g.gruber at xsoft.co.at> writes:

    GWG> I'm using Xemacs 21.0 Beta (August 1998) on Win32 and it
    GWG> works quite fine (is there a newer version out there?).

XEmacs 21.1.6 is the latest release I believe; it's what I use on
Solaris, but I haven't upgraded my Windows version in a while, so I'm
not sure if there's an installer for this version.  I'm sure you can
find a 21.1.something lying around, and I'd definitely recommend
upgrading.

You should also be using the latest python-mode.el, version 3.105.  I
don't think the XEmacs packages have been upgraded yet, but you can
download it from http://www.python.org/emacs/python-mode

    GWG> When I'm using Python emacs recognices the mode but it
    GWG> doesn't automatically activate syntax highlighting, even
    GWG> though I activated it in the preferences (same for C/C++ mode
    GWG> as well).

Hmm, maybe you haven't saved your options?  I don't use the menus at
all, but IIRC you want Options->Syntax Highlighting->Automatic and
then save your options.
    
    GWG> Also I was wondering what to do about the tabs.

Personally, I never use tabs anymore, just spaces.  The latest
python-mode tries to be smart about setting the important variables
based on whether the guessed indentation level is equal to a
tab-width.  See the variable py-smart-indentation.

The problem comes, as you've noticed, with files that have an
inconsistent mixture of tabs and spaces.  My recommendation then is to 
set your tab-width to 4, untabify the buffer (C-x h M-x untabify RET), 
then save and revisit the buffer (so tab-width goes back to 8 and
py-smart-indentation can do it's thing).
    
Hope that helps,
-Barry




More information about the Python-list mailing list