From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Benjamin Rutt Newsgroups: gmane.emacs.devel Subject: bug fix to python.el when pressing C-c C-z Date: Thu, 18 Nov 2004 16:24:50 -0500 Message-ID: <87fz36svdp.fsf@penguin.brutt.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1100813221 22295 80.91.229.6 (18 Nov 2004 21:27:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 18 Nov 2004 21:27:01 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 18 22:26:55 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CUtnr-0006dH-00 for ; Thu, 18 Nov 2004 22:26:55 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CUtwi-0001zk-IH for ged-emacs-devel@m.gmane.org; Thu, 18 Nov 2004 16:36:04 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CUtvC-0001G4-CI for emacs-devel@gnu.org; Thu, 18 Nov 2004 16:34:30 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CUtvB-0001Ff-Gf for emacs-devel@gnu.org; Thu, 18 Nov 2004 16:34:29 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CUtvB-0001FQ-9V for emacs-devel@gnu.org; Thu, 18 Nov 2004 16:34:29 -0500 Original-Received: from [80.91.229.2] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CUtlz-0004qW-Bs for emacs-devel@gnu.org; Thu, 18 Nov 2004 16:24:59 -0500 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1CUtly-0004ja-00 for ; Thu, 18 Nov 2004 22:24:58 +0100 Original-Received: from dhcp065-025-157-254.columbus.rr.com ([65.25.157.254]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 18 Nov 2004 22:24:58 +0100 Original-Received: from rutt.4+news by dhcp065-025-157-254.columbus.rr.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 18 Nov 2004 22:24:58 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-To: emacs-devel@gnu.org Original-Lines: 40 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: dhcp065-025-157-254.columbus.rr.com Mail-Copies-To: nobody User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:RIfF+9EpnpCOld/1/kOracIf3I8= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:30046 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:30046 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 (push-mark) (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