[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug fix to python.el when pressing C-c C-z

From: Benjamin Rutt
Subject: bug fix to python.el when pressing C-c C-z
Date: Thu, 18 Nov 2004 16:24:50 -0500
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

I don't like it when I am editing python in a recently started emacs
and I want to press C-c C-z to show my current python buffer, and I
haven't done M-x run-python yet, and I get an error:

Wrong type argument: stringp, nil 

Since `(get-buffer python-buffer)' from the code below can't be
evaluated yet, as `python-buffer' is nil.

This bugfix/enhancement starts up python if it isn't started already
via run-python and fixes this bug.  Anyone care to review and commit
this if it seems OK?  Thanks,

Benjamin Rutt

--- python.el.orig      2004-11-18 14:24:10.000000000 -0500
+++ python.el   2004-11-18 14:25:07.000000000 -0500
@@ -1235,15 +1235,14 @@
   "Switch to the Python process buffer.
 With prefix arg, position cursor at end of buffer."
   (interactive "P")
-  (if (get-buffer python-buffer)
-      (pop-to-buffer python-buffer)
-    (error "No current process buffer.  See variable `python-buffer'"))
+  (when (or (not python-buffer)
+           (not (get-buffer python-buffer)))
+    (run-python nil t))
+  (pop-to-buffer python-buffer)
   (when eob-p
     (goto-char (point-max))))
-(add-to-list 'debug-ignored-errors "^No current process buffer.")
 (defun python-send-region-and-go (start end)
   "Send the region to the inferior Python process.
 Then switch to the process buffer."

Benjamin Rutt

reply via email to

[Prev in Thread] Current Thread [Next in Thread]