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: Patch to optionally show Python process buffer after C-c C-c Date: Sun, 17 Jun 2012 15:03:55 +0200 Message-ID: <4FDDD5BB.9070909@dogan.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060203060103060502030605" X-Trace: dough.gmane.org 1339938269 8123 80.91.229.3 (17 Jun 2012 13:04:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 17 Jun 2012 13:04:29 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 17 15:04:28 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 1SgF9X-00044e-GJ for ged-emacs-devel@m.gmane.org; Sun, 17 Jun 2012 15:04:27 +0200 Original-Received: from localhost ([::1]:52082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgF9X-0008Dl-FC for ged-emacs-devel@m.gmane.org; Sun, 17 Jun 2012 09:04:27 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgF9T-0008DV-Ti for emacs-devel@gnu.org; Sun, 17 Jun 2012 09:04:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SgF9S-00088d-8P for emacs-devel@gnu.org; Sun, 17 Jun 2012 09:04:23 -0400 Original-Received: from mxf4.bahnhof.se ([213.80.101.28]:57334) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgF9S-00088Z-1D for emacs-devel@gnu.org; Sun, 17 Jun 2012 09:04:22 -0400 Original-Received: from localhost (mxf4.local [127.0.0.1]) by mxf4-reinject (Postfix) with ESMTP id BBF255F9975 for ; Sun, 17 Jun 2012 15:04:19 +0200 (CEST) X-Virus-Scanned: by amavisd-new using ClamAV at bahnhof.se (MXF2) Original-Received: from mxf4.bahnhof.se ([127.0.0.1]) by localhost (mxf4.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3eM+Vo8znDK0 for ; Sun, 17 Jun 2012 15:04:16 +0200 (CEST) Original-Received: from [192.168.1.4] (h-149-227.a336.priv.bahnhof.se [37.123.149.227]) by mxf4.bahnhof.se (Postfix) with ESMTP id C89EB5F988E for ; Sun, 17 Jun 2012 15:04:16 +0200 (CEST) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120604 Thunderbird/13.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 213.80.101.28 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:150977 Archived-At: This is a multi-part message in MIME format. --------------060203060103060502030605 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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? Deniz --------------060203060103060502030605 Content-Type: text/plain; charset=windows-1252; name="python-patch.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="python-patch.diff" === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2012-06-06 13:05:11 +0000 +++ lisp/progmodes/python.el 2012-06-17 13:00:00 +0000 @@ -541,6 +541,15 @@ :group 'python :version "24.1") +(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") + (defvar python-pdbtrack-is-tracking-p nil) (defconst python-pdbtrack-stack-entry-regexp @@ -1628,7 +1637,11 @@ ;; Tell compile.el to redirect error locations in file `f' to ;; positions past marker `orig-start'. It has to be done *after* ;; `python-send-command''s call to `compilation-forget-errors'. - (compilation-fake-loc orig-start f)))) + (compilation-fake-loc orig-start f) + (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-send-string (string) "Evaluate STRING in inferior Python process." --------------060203060103060502030605--