gnu-emacs-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python 3 support in python.el


From: Dave Love
Subject: Python 3 support in python.el
Date: Sun, 11 Oct 2009 14:44:40 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11)

I don't seem to have advertised the python.el support for Python 3 I did
some time ago, but the previous implementation with separate major modes
for the language versions turned out to be unfortunate.  In this version
the major mode is always `python-mode', but you can still use
`python-2-mode' and `python-3-mode' in file-local variables.  The
support for the inferior shell works with version 2 or 3 interpreters.

It's often said, without good justification I've heard, that this is
somehow bad compared with the old python-mode.el.  I'll try to address
reports of actual bugs or missing features that aren't inappropriate to
include, as discussed in the commentary.

An Emacs 21 version is at http://www.loveshack.ukfsn.org/emacs/python-21.el.

Attachment: python.el.gz
Description: GNU Zip compressed data

Attachment: emacs.py
Description: Text Data

                                                                -*-text-*-
* Revision 1.29 (emacs.py 1.17, python-21.el 1.77)

  * Change the mechanism for Python2/Python3:  `python-2-mode' and
    `python-3-mode' are no longer proper major modes, but just invoke
    `python-mode' with `python-default-version' bound appropriately.
    Thus you can use, say, python-3-mode in file-local variables, but
    `major-mode' is always `python-mode' to avoid breaking things
    which test `major-mode'.

  * Bug fixes:

    * Allow trailing comments on outline headings.
    * `python-load-file' produces a stack trace with the file name.

* Revision 1.25 (emacs.py 1.16, python-21.el 1.73)

  * Fix hideshow to work with the new major modes, and make it
    consistent with outlining.

* Revision 1.24 (emacs.py 1.16, python-21.el 1.72)

  * Flymake support (via `python-check-command').

  * Bug/infelicity fixes:

    * Error with backslash-continued line inside parens.
    * Allow "else" after "finally".
    * Set `comment-start-skip', `local-abbrev-table'.
    * Allow non-ASCII ids with Eldoc.
    * `python-process-kill-without-query' allows silent killing of
      inferior process.
    * Avoid possible bad indentation of try block clauses.

* Revision 1.18 (emacs.py 1.16, python-21.el 1.66)

  * Support for Python 3:

    * New modes, `python-3-mode' and `python-2-mode'.  `python-mode'
      changed just to invoke the one determined by
      `python-default-version'.
    * emacs.py should work with python 2.3 up.  (Only 2.5 and 3.0
      tested.)

  * Bug fixes:

    * Completion works again in python 2.4 up.
    * `python-beginning-of-block' moves to the beginning properly when
      point is in the first statement of an outer block.
    * `python-mark-block' is more sensible because of the above.
    * `python-mark-block' doesn't push marks or deactivate the region
      if it doesn't find a block.
    * `indent-tabs-mode' is now normally nil -- Python 3 objects to
      typical mixed tab/space indentation otherwise.  The indentation
      isn't guessed if it's set file-locally.
    * Avoid error in `python-find-function'.
    * Try harder to find Info files for info-look.
    * Customizing `python-python-command' updates things which depend
      on it.
    * Fix Imenu finding nested definitions.
    * Fix python-beginning-of-defun with nested definitions.

  * Other changes
  
    * Imenu generation is sanitized:  class names are indicated by a
      suffix, not a prefix; sorting is sorted; the default
      `imenu-sort-function' gives an overall order of module variables,
      class definitions, and function definitions.
    * In Emacs 21, bind C-M-h and C-x n d usefully to work around
      problems with normal bindings.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]