 (defconst py-blank-or-comment-re "[ \t]*\\($\\|#\\)"
   "Regexp matching blank or comment lines.")
 
+(defconst py-outdent-re
+  (concat "\\(" (mapconcat 'identity
+			   '("else:"
+			     "except\\s +.*:"
+			     "finally:"
+			     "elif\\s +.*:")
+			   "\\|")
+	  "\\)")
+  "Regexp matching clauses to be outdented one level.")
 
  

;;         1992-1994 Tim Peters <tim@ksr.com>
;; Maintainer:    bwarsaw@cnri.reston.va.us
;; Created:       Feb 1992
;; Version:       2.7
;; Last Modified: 1995/03/10 15:58:16
;; Keywords: python editing language major-mode

;; This software is provided as-is, without express or implied



;; electric characters
(defun py-electric-colon (arg)
  "Insert a colon.
In certain cases the line is outdented appropriately.  If a numeric
argument is provided, that many colons are inserted non-electrically."
  (interactive "P")
  (self-insert-command (prefix-numeric-value arg))
  (let (this-indent)
    (if (and (not arg)
	     (save-excursion
	       (back-to-indentation)
	       (looking-at py-outdent-re))
	     (= (setq this-indent (py-compute-indentation))
		(save-excursion
		  (forward-line -1)
		  (py-compute-indentation)))
	     )
	(save-excursion
	  (beginning-of-line)
	  (delete-horizontal-space)
	  (indent-to (- this-indent py-indent-offset)))
      )))


;;; Functions that execute Python commands in a subprocess
(defun py-shell ()
  "Start an interactive Python interpreter in another window.
