Mercurial > hg > xemacs-beta
diff lisp/modes/python-mode.el @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | 441bb1e64a06 |
children | 0d2f883870bc |
line wrap: on
line diff
--- a/lisp/modes/python-mode.el Mon Aug 13 09:00:04 2007 +0200 +++ b/lisp/modes/python-mode.el Mon Aug 13 09:02:59 2007 +0200 @@ -2,12 +2,12 @@ ;; Copyright (C) 1992,1993,1994 Tim Peters -;; Author: 1995-1997 Barry A. Warsaw +;; Author: 1995-1996 Barry A. Warsaw ;; 1992-1994 Tim Peters ;; Maintainer: python-mode@python.org ;; Created: Feb 1992 -;; Version: 2.90 -;; Last Modified: 1997/02/24 03:37:22 +;; Version: 2.83 +;; Last Modified: 1996/10/23 20:44:59 ;; Keywords: python languages oop ;; This software is provided as-is, without express or implied @@ -208,7 +208,7 @@ displayed in the echo area, and if `py-beep-if-tab-change' is non-nil the Emacs bell is also rung as a warning.") -(defvar python-font-lock-keywords +(defconst python-font-lock-keywords (let* ((keywords '("and" "break" "class" "continue" "def" "del" "elif" "else:" "except" "except:" "exec" @@ -234,8 +234,6 @@ 1 font-lock-function-name-face) )) "Additional expressions to highlight in Python mode.") -(put 'python-mode 'font-lock-defaults '(python-font-lock-keywords)) - (defvar imenu-example--python-show-method-args-p nil "*Controls echoing of arguments of functions & methods in the imenu buffer. @@ -277,9 +275,6 @@ (and (fboundp 'make-obsolete-variable) (make-obsolete-variable 'py-mode-hook 'python-mode-hook)) -(defvar py-delete-function 'backward-delete-char-untabify - "*Function called by `py-delete-char' when deleting characters.") - (defvar py-mode-map () "Keymap used in `python-mode' buffers.") @@ -412,26 +407,6 @@ If you change this, you probably have to change `py-current-defun' as well. This is only used by `py-current-defun' to find the name for add-log.el.") -;; As of 30-Jan-1997, Emacs 19.34 works but XEmacs 19.15b90 and -;; previous does not. It is suspected that Emacsen before 19.34 are -;; also broken. -(defvar py-parse-partial-sexp-works-p - (let ((buf (get-buffer-create " ---*---pps---*---")) - state status) - (save-excursion - (set-buffer buf) - (erase-buffer) - (insert "(line1\n line2)\nline3") - (lisp-mode) - (goto-char (point-min)) - (setq state (parse-partial-sexp (point) (save-excursion - (forward-line 1) - (point)))) - (parse-partial-sexp (point) (point-max) 0 nil state) - (setq status (not (= (point) (point-max)))) - (kill-buffer buf) - status)) - "Does `parse-partial-sexp' work in this Emacs?") ;; Menu definitions, only relevent if you have the easymenu.el package @@ -449,8 +424,8 @@ (easy-menu-define py-menu py-mode-map "Python Mode menu" '("Python" - ["Comment Out Region" py-comment-region (mark)] - ["Uncomment Region" (py-comment-region (point) (mark) '(4)) (mark)] + ["Comment Out Region" comment-region (mark)] + ["Uncomment Region" (comment-region (point) (mark) '(4)) (mark)] "-" ["Mark current block" py-mark-block t] ["Mark current def" mark-python-def-or-class t] @@ -707,7 +682,6 @@ (make-local-variable 'paragraph-start) (make-local-variable 'require-final-newline) (make-local-variable 'comment-start) - (make-local-variable 'comment-end) (make-local-variable 'comment-start-skip) (make-local-variable 'comment-column) (make-local-variable 'indent-region-function) @@ -718,11 +692,11 @@ (setq major-mode 'python-mode mode-name "Python" local-abbrev-table python-mode-abbrev-table + font-lock-defaults '(python-font-lock-keywords) paragraph-separate "^[ \t]*$" paragraph-start "^[ \t]*$" require-final-newline t comment-start "# " - comment-end "" comment-start-skip "# *" comment-column 40 indent-region-function 'py-indent-region @@ -1016,10 +990,7 @@ ;; Functions for Python style indentation (defun py-delete-char (count) "Reduce indentation or delete character. - If point is at the leftmost column, deletes the preceding newline. -Deletion is performed by calling the function in `py-delete-function' -with a single argument (the number of characters to delete). Else if point is at the leftmost non-blank character of a line that is neither a continuation line nor a non-indenting comment line, or if @@ -1038,7 +1009,7 @@ (py-continuation-line-p) (not py-honor-comment-indentation) (looking-at "#[^ \t\n]")) ; non-indenting # - (funcall py-delete-function count) + (backward-delete-char-untabify count) ;; else indent the same as the colon line that opened the block ;; force non-blank so py-goto-block-up doesn't ignore it @@ -2224,9 +2195,9 @@ (if (and (not (zerop (car state))) (not (eobp))) (progn - (parse-partial-sexp (point) (point-max) - (if py-parse-partial-sexp-works-p - 0 (- 0 (car state))) + ;; BUG ALERT: I could swear, from reading the docs, that + ;; the 3rd argument should be plain 0 + (parse-partial-sexp (point) (point-max) (- 0 (car state)) nil state) (forward-line 1)))))) @@ -2390,15 +2361,6 @@ (set-buffer cbuf)) (sit-for 0)) -;; older Emacsen don't have this function -(if (not (fboundp 'match-string)) - (defun match-string (n) - (let ((beg (match-beginning n)) - (end (match-end n))) - (if (and beg end) - (buffer-substring beg end) - nil)))) - (defun py-current-defun () ;; tell add-log.el how to find the current function/method/variable (save-excursion @@ -2412,7 +2374,7 @@ nil))) -(defconst py-version "2.90" +(defconst py-version "2.83" "`python-mode' version number.") (defconst py-help-address "python-mode@python.org" "Address accepting submission of bug reports.")