diff options
author | Fabián Ezequiel Gallina <fgallina@gnu.org> | 2012-07-27 09:38:19 -0300 |
---|---|---|
committer | Fabián Ezequiel Gallina <fgallina@gnu.org> | 2012-07-27 09:38:19 -0300 |
commit | a90dfb95112ebff530ec5c7167c1402b10c2e49b (patch) | |
tree | ed9838599c8c7c83a30ff389c693c178c0f9a39c /lisp/progmodes/python.el | |
parent | 1e4be88cc192114695362edcffb7e31efe871983 (diff) | |
download | emacs-a90dfb95112ebff530ec5c7167c1402b10c2e49b.tar.gz |
* 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.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r-- | lisp/progmodes/python.el | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 132951aedc8..ab364a5318a 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -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 @@ non-nil the buffer is shown." (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 @@ with user shells. 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) (set-process-query-on-exit-flag (get-buffer-process (python-shell-make-comint @@ -1638,7 +1641,7 @@ of commands.)" (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) |