unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Patch to optionally show Python process buffer after C-c C-c
@ 2012-06-17 13:03 Deniz Dogan
  2012-06-17 19:13 ` Glenn Morris
  0 siblings, 1 reply; 10+ messages in thread
From: Deniz Dogan @ 2012-06-17 13:03 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 199 bytes --]

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

[-- Attachment #2: python-patch.diff --]
[-- Type: text/plain, Size: 1295 bytes --]

=== 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."

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-06-19  7:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-17 13:03 Patch to optionally show Python process buffer after C-c C-c Deniz Dogan
2012-06-17 19:13 ` Glenn Morris
2012-06-17 20:31   ` Deniz Dogan
2012-06-18 17:56     ` Glenn Morris
2012-06-18 18:03       ` Deniz Dogan
2012-06-18 18:20         ` Glenn Morris
     [not found]           ` <CABq4mQtPF8Sns2Pf0U8pw+oaJ9pnxser7-oiaCng8J3kTxHyiA@mail.gmail.com>
2012-06-18 21:32             ` Glenn Morris
2012-06-18 23:41               ` Glenn Morris
2012-06-19  2:13                 ` Glenn Morris
2012-06-19  7:44                   ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).