 	    ))
       (set-buffer curbuf))))
 
+(defun py-postprocess-output-buffer (buf)
+  (save-excursion
+    (set-buffer buf)
+    (beginning-of-buffer)
+    (while (re-search-forward py-traceback-line-re nil t)
+      (let ((file (match-string 1))
+	    (line (string-to-int (match-string 2))))
+	(py-highlight-line (py-point 'bol) (py-point 'eol) file line))
+      )))
+
  
 ;;; Subprocess commands
+
+;; only used when (memq 'broken-temp-names py-emacs-features)
+(defvar py-serial-number 0)
+(defvar py-exception-buffer nil)
+(defconst py-output-buffer "*Python Output*")
 
 ;;;###autoload
 (defun py-shell ()

See the `\\[py-execute-region]' docs for an account of some subtleties."
  (interactive "P")
  (py-execute-region (point-min) (point-max) async))



  ;; to take explicit action.
  (and (boundp 'zmacs-region-stays)
       (setq zmacs-region-stays t)))

(defsubst py-point (position)
  ;; Returns the value of point at certain commonly referenced POSITIONs.
  ;; POSITION can be one of the following symbols:
  ;; 
  ;; bol  -- beginning of line
  ;; eol  -- end of line
  ;; bod  -- beginning of defun
  ;; boi  -- back to indentation
  ;; 
  ;; This function does not modify point or mark.
  (let ((here (point)))
    (cond
     ((eq position 'bol) (beginning-of-line))
     ((eq position 'eol) (end-of-line))
     ((eq position 'bod) (beginning-of-python-def-or-class))
     ((eq position 'bob) (beginning-of-buffer))
     ((eq position 'eob) (end-of-buffer))
     ((eq position 'boi) (back-to-indentation))
     (t (error "unknown buffer position requested: %s" position))
     )
    (prog1
	(point)
      (goto-char here))))

(defsubst py-highlight-line (from to file line)
  (cond
   ((fboundp 'make-extent)
    ;; XEmacs
    (let ((e (make-extent from to)))
      (set-extent-property e 'mouse-face 'highlight)
      (set-extent-property e 'py-exc-info (cons file line))
      (set-extent-property e 'keymap py-mode-output-map)))
   (t
    ;; Emacs -- Please port this!
    )
   ))


