[Python-checkins] CVS: python/dist/src/Misc python-mode.el,NONE,4.0
Wed, 11 Apr 2001 13:23:26 -0700
Update of /cvsroot/python/python/dist/src/Misc
In directory usw-pr-cvs1:/tmp/cvs-serv6004
Bumping to version 4.0 since we now support only XEmacs 21.1 and Emacs
20.7, although not all of the compatibility code for older Emacsen has
been removed. Specifically, the old "make sure we have a current
custom.el library" stuff is removed, as is the hack-around for an
NTEmacs 19.34.6 make-temp-name bug.
Updated much of the Commentary section in the initial comments.
Much more importantly, I've integrated Ken Manheimer's pdbtrack stuff,
which is way cool. When enabled (as by default), this turns on the
overlay arrow when pdb is entered, either in the shell buffer or in
the *Python* buffer. Specifically:
(py-mode-map): Added C-c C-d to toggle pdb tracking.
(py-pdbtrack-do-tracking-p): New user customizable variable to control
whether overlay arrow tracking is enabled or not. This variable is
buffer local and is turned on by default.
(py-pdbtrack-minor-mode-string): The string that's added to the minor
mode alist when actually doing pdb overlay arrow tracking. User
turn-off-pdbtrack): New commands to control pdb tracking.
(py-pdbtrack-is-tracking-p): Helper variable used to control the
display of py-pdbtrack-minor-mode-string. Set to true when the
overlay arrow is enabled, and false when it's disabled.
py-pdbtrack-track-range): Inherited from pdbtrack.el and renamed.
(py-pdbtrack-overlay-arrow, py-pdbtrack-track-stack-file): New
functions which actually do the tracking.
(py-shell): Add py-pdbtrack-track-stack-file to
Finally, add py-pdbtrack-track-stack-file to
comint-output-filter-functions at the file level. This and the
py-shell addition should ensure that pdb tracking is installed
regardless of the order of operation.
Also, add py-pdbtrack-minor-mode-string to minor-mode-alist.
--- NEW FILE: python-mode.el ---
;;; python-mode.el --- Major mode for editing Python programs
;; Copyright (C) 1992,1993,1994 Tim Peters
;; Author: 1995-2001 Barry A. Warsaw
;; 1992-1994 Tim Peters
;; Maintainer: email@example.com
;; Created: Feb 1992
;; Keywords: python languages oop
(defconst py-version "$Revision: 4.0 $"
"`python-mode' version number.")
;; This software is provided as-is, without express or implied
;; warranty. Permission to use, copy, modify, distribute or sell this
;; software, without fee, for any purpose and by any individual or
;; organization, is hereby granted, provided that the above copyright
;; notice and this paragraph appear in all copies.
[...3200 lines suppressed...]
(defun py-kill-emacs-hook ()
"Delete files in `py-file-queue'.
These are Python temporary files awaiting execution."
(mapcar #'(lambda (filename)
(py-safe (delete-file filename)))
;; arrange to kill temp files when Emacs exists
(add-hook 'kill-emacs-hook 'py-kill-emacs-hook)
(add-hook 'comint-output-filter-functions 'py-pdbtrack-track-stack-file)
;; Add a designator to the minor mode strings
(or (assq 'py-pdbtrack-minor-mode-string minor-mode-alist)
(push '(py-pdbtrack-is-tracking-p py-pdbtrack-minor-mode-string)
;;; python-mode.el ends here