emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109236: * lisp/progmodes/python.el (


From: Fabián Ezequiel Gallina
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109236: * lisp/progmodes/python.el (python-mode-map): Added keybinding for
Date: Fri, 27 Jul 2012 09:38:19 -0300
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109236
committer: Fabián Ezequiel Gallina <address@hidden>
branch nick: trunk
timestamp: Fri 2012-07-27 09:38:19 -0300
message:
  * lisp/progmodes/python.el (python-mode-map): Added keybinding for
  run-python.
  (python-shell-make-comint): Fix pop-to-buffer call.
  (run-python): Autoload.  New arg SHOW.
  (python-shell-get-or-create-process): Do not pop python process
  buffer.
modified:
  lisp/ChangeLog
  lisp/progmodes/python.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-07-27 11:10:53 +0000
+++ b/lisp/ChangeLog    2012-07-27 12:38:19 +0000
@@ -1,3 +1,12 @@
+2012-07-27  Fabián Ezequiel Gallina  <address@hidden>
+
+       * progmodes/python.el (python-mode-map): Added keybinding for
+       run-python.
+       (python-shell-make-comint): Fix pop-to-buffer call.
+       (run-python): Autoload.  New arg SHOW.
+       (python-shell-get-or-create-process): Do not pop python process
+       buffer.
+
 2012-07-27  Michael Albinus  <address@hidden>
 
        * notifications.el (notifications-on-action-signal)

=== modified file 'lisp/progmodes/python.el'
--- a/lisp/progmodes/python.el  2012-07-19 00:55:55 +0000
+++ b/lisp/progmodes/python.el  2012-07-27 12:38:19 +0000
@@ -250,6 +250,7 @@
     (define-key map "\C-c\C-tt" 'python-skeleton-try)
     (define-key map "\C-c\C-tw" 'python-skeleton-while)
     ;; Shell interaction
+    (define-key map "\C-c\C-p" 'run-python)
     (define-key map "\C-c\C-s" 'python-shell-send-string)
     (define-key map "\C-c\C-r" 'python-shell-send-region)
     (define-key map "\C-\M-x" 'python-shell-send-defun)
@@ -1571,30 +1572,33 @@
           (with-current-buffer buffer
             (inferior-python-mode)
             (python-util-clone-local-variables current-buffer))))
-      (when pop
-        (pop-to-buffer proc-buffer-name))
+      (and pop (pop-to-buffer proc-buffer-name t))
       proc-buffer-name)))
 
-(defun run-python (dedicated cmd)
+;;;###autoload
+(defun run-python (cmd &optional dedicated show)
   "Run an inferior Python process.
 Input and output via buffer named after
 `python-shell-buffer-name'.  If there is a process already
 running in that buffer, just switch to it.
-With argument, allows you to define DEDICATED, so a dedicated
-process for the current buffer is open, and define CMD so you can
-edit the command used to call the interpreter (default is value
-of `python-shell-interpreter' and arguments defined in
-`python-shell-interpreter-args').  Runs the hook
-`inferior-python-mode-hook' (after the `comint-mode-hook' is
-run).
-\(Type \\[describe-mode] in the process buffer for a list of commands.)"
+
+With argument, allows you to define CMD so you can edit the
+command used to call the interpreter and define DEDICATED, so a
+dedicated process for the current buffer is open.  When numeric
+prefix arg is other than 0 or 4 do not SHOW.
+
+Runs the hook `inferior-python-mode-hook' (after the
+`comint-mode-hook' is run).  \(Type \\[describe-mode] in the
+process buffer for a list of commands.)"
   (interactive
    (if current-prefix-arg
        (list
+        (read-string "Run Python: " (python-shell-parse-command))
         (y-or-n-p "Make dedicated process? ")
-        (read-string "Run Python: " (python-shell-parse-command)))
-     (list nil (python-shell-parse-command))))
-  (python-shell-make-comint cmd (python-shell-get-process-name dedicated))
+        (= (prefix-numeric-value current-prefix-arg) 4))
+     (list (python-shell-parse-command) nil t)))
+  (python-shell-make-comint
+   cmd (python-shell-get-process-name dedicated) show)
   dedicated)
 
 (defun run-python-internal ()
@@ -1611,7 +1615,6 @@
 `inferior-python-mode-hook' (after the `comint-mode-hook' is
 run).  \(Type \\[describe-mode] in the process buffer for a list
 of commands.)"
-  (interactive)
   (set-process-query-on-exit-flag
    (get-buffer-process
     (python-shell-make-comint
@@ -1638,7 +1641,7 @@
          (global-proc-buffer-name (format "*%s*" global-proc-name))
          (dedicated-running (comint-check-proc dedicated-proc-buffer-name))
          (global-running (comint-check-proc global-proc-buffer-name))
-         (current-prefix-arg 4))
+         (current-prefix-arg 16))
     (when (and (not dedicated-running) (not global-running))
       (if (call-interactively 'run-python)
           (setq dedicated-running t)


reply via email to

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