From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Deniz Dogan Newsgroups: gmane.emacs.devel Subject: Re: Patch to optionally show Python process buffer after C-c C-c Date: Sun, 17 Jun 2012 22:31:31 +0200 Message-ID: <4FDE3EA3.50304@dogan.se> References: <4FDDD5BB.9070909@dogan.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040704020607060705050100" X-Trace: dough.gmane.org 1339965123 27638 80.91.229.3 (17 Jun 2012 20:32:03 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 17 Jun 2012 20:32:03 +0000 (UTC) Cc: emacs-devel@gnu.org To: Glenn Morris Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 17 22:32:03 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SgM8g-0000Jn-3M for ged-emacs-devel@m.gmane.org; Sun, 17 Jun 2012 22:32:02 +0200 Original-Received: from localhost ([::1]:38341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgM8g-0001IV-2f for ged-emacs-devel@m.gmane.org; Sun, 17 Jun 2012 16:32:02 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgM8c-0001Hj-MQ for emacs-devel@gnu.org; Sun, 17 Jun 2012 16:31:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SgM8a-0001Zf-Tf for emacs-devel@gnu.org; Sun, 17 Jun 2012 16:31:58 -0400 Original-Received: from mxf1.bahnhof.se ([213.80.101.25]:53897) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgM8a-0001ZM-Mx; Sun, 17 Jun 2012 16:31:56 -0400 Original-Received: from localhost (mxf1.local [127.0.0.1]) by mxf1-reinject (Postfix) with ESMTP id 2F0091E30F0; Sun, 17 Jun 2012 22:31:55 +0200 (CEST) X-Virus-Scanned: by amavisd-new using ClamAV at bahnhof.se (MXF1) Original-Received: from mxf1.bahnhof.se ([127.0.0.1]) by localhost (mxf1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YOiwRW6Rklb9; Sun, 17 Jun 2012 22:31:53 +0200 (CEST) Original-Received: from [192.168.1.4] (h-149-227.a336.priv.bahnhof.se [37.123.149.227]) by mxf1.bahnhof.se (Postfix) with ESMTP id 2B2AC1E30C5; Sun, 17 Jun 2012 22:31:53 +0200 (CEST) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 213.80.101.25 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:150979 Archived-At: This is a multi-part message in MIME format. --------------040704020607060705050100 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2012-06-17 21:13,, Glenn Morris wrote: > Deniz Dogan wrote: > >> I got tired of repeatedly switching to the Python process buffer after >> using C-c C-c in python-mode, so here is a patch which gives users the >> option to do that automatically. >> >> Any comments? > > Your patch seems to be against the 24.1 version of python.el. I'm afraid > the trunk version is very different, so you will have to rework your > patch (it might not even be necessary any more). > Sorry about that. Here is a refined patch from the current trunk. --------------040704020607060705050100 Content-Type: text/plain; charset=windows-1252; name="new-python-patch.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="new-python-patch.diff" === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2012-06-17 08:53:31 +0000 +++ lisp/progmodes/python.el 2012-06-17 20:30:39 +0000 @@ -1328,6 +1328,15 @@ :type '(alist string) :group 'python) +(defcustom python-show-process-buffer-on-send nil + "Whether or not to show the Python process buffer after sending +a region to the Python process." + :type '(choice (const :tag "No" nil) + (const :tag "In current window" current) + (const :tag "In another window" other)) + :group 'python + :version "24.1") + (defun python-shell-get-process-name (dedicated) "Calculate the appropriate process name for inferior Python process. If DEDICATED is t and the variable `buffer-file-name' is non-nil @@ -1592,7 +1601,11 @@ (comint-send-string process string) (when (or (not (string-match "\n$" string)) (string-match "\n[ \t].*\n?$" string)) - (comint-send-string process "\n"))))) + (comint-send-string process "\n"))) + (cond ((eq python-show-process-buffer-on-send 'other) + (switch-to-buffer-other-window (current-buffer))) + ((eq python-show-process-buffer-on-send 'current) + (switch-to-buffer (current-buffer)))))) (defun python-shell-send-string-no-output (string &optional process msg) "Send STRING to PROCESS and inhibit output. --------------040704020607060705050100--