Python Mode Extensions

Registered by Andreas Roehler

Let's check this:

[Python-mode] My Extensions to python-mode.el
Don Rozenberg rozen at mcn.org
Thu Jun 9 00:43:28 CEST 2005

Hi,

I am a little slow; I just saw a reference to the python-mode project.
i would like to make you aware of my extensions to python-mode.el

I have had some issues with the way python-mode launches python programs
and have written an extension to python mode with which I am a bit more
comfortable. Unfortunately, I am not skilled with emacs-lisp so I
welcome suggestions for improvement.

My extensions are avail via http://page.sourceforge.net.

Here is a copy of the description of the extensions which can be found
at sourceforge -
http://page.sourceforge.net/py-mode-ext.html

-----------------

      Extensions to python-mode in emacs

I really like to run and debugging python programs from inside of emacs
but I have wanted to see a couple of additional features added to
python-mode.el This applies to executing the program as well as running
with a symbolic debugger.

    * I want to be able to conveniently supply arguments to the program
      under test.

    * There are times when I forget to save the buffers that I am
      editing, so I would like to have emacs inquire if I want them
      saved and respond to my reply.

    * Frequently, my programs involve more than one module and here
      python-mode foils me because it saves the current buffer as a
      temporary file in a temporary directory with a manufactured,
      unique name. There is no way that another module of the program
      will be found. I therefore want any changed modules saved and want
      to be able to specify the main module to be entered.

    * Again, many of my programs involve multiple modules and the one I
      am editing may not be the one I want as the initial module of the
      program. So I want to be able to specify the initial program.

    * I would like to have history capability to remember initial
      modules and argument lists used in the Emacs session.

    * Since python-mode allows me to execute a program with a simple key
      sequence, I then want to execute the program with the python
      debugger as easily.

    * I am a fan of PyChecker, so I want to be able to easily run that
      program from Emacs and be able to jump to source lines
      corresponding to PyChecker messages.

py-mode-ext.el <cid:part1.00080003.04020102 at mcn.org> is a short bit of
emacs lisp which I assert accomplishes the above. I am new to writing
elisp so I welcome comments and suggestions.

To use these extensions, py-mode-ext.el is placed in my emacs load path.
I have the following code in my .emacs.

(add-hook 'python-mode-hook
          '(lambda ()
          (define-key py-mode-map "\C-c\C-c" 'py-execute-prog)
          (define-key py-mode-map "\C-c\C-g" 'py-call-pdb)
          (define-key py-mode-map "\C-c\C-w" 'pychecker)))
(load "py-mode-ext.el")

When the user presses one of the above key sequences for py-execute-prog
or py-call-pdb, he will first be asked for the initial module.

   1. It first reads from the mini-buffer the name of the initial file
      to be executed by the interpreter. If no history exists, then the
      file behind the current buffer is suggested. The user may then
      substitute any file he wishes as the initial file to be executed
      by the interpreter. It will be save in a history list.

   2. Next, it reads from the mini-buffer the argument string to be
      passed to the program being interpreted. Again, if there is a
      history of arguments, the most recent will be selected. The user
      may over ride the suggestion. The argument string passed to the
      program will be saved in a history list.

   3. It next saves all the modified buffers based on a query.

   4. Finally, it invokes python on the initial file or it invokes pdb
      on the initial file.

If there is a history item for initial modules that will be suggested
otherwise the file corresponding to the current buffer is suggested.
Change the item if desired and then hit return. The next question to be
asked is the argument list for the execution. Again, if there is a
history then the most recent argument list will be selected. If you want
to change it, go ahead and then hit return. At that point execution or
the debugger is initiated.

When the user initiates the command for pychecker, it will check whether
any buffers have been changed and ask whether you want any of those
saved. Then it will run PyChecker against the file behind the current
buffer.

PAGE Home <cid:part2.07030000.07040509 at mcn.org>

-------------------

PAGE is my sourceforge project to develop a drag-and-drop GUI generator
for Python.

--
Don Rozenberg
707-882-3601
don.rozenberg at gmail.com

-----------------

Blueprint information

Status:
Not started
Approver:
None
Priority:
Medium
Drafter:
None
Direction:
Needs approval
Assignee:
Andreas Roehler
Definition:
Drafting
Series goal:
Accepted for trunk
Implementation:
Unknown
Milestone target:
milestone icon 6.2.1

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.