2011-11-26 11 views

答えて

3

新しいPythonシェルを開く前に、元のpythonシェルの名前を変更する必要があります。 M - xrename-bufferを使用してください。

+0

シンプルで甘い – hatmatrix

3

バッファの名前を変更することはできませんが、run-pythonの3番目のパラメータを使用できます。

M - (run-python nil nil t)RET

現在のバッファに切り替えるには結合が 本当に便利ではありませんので、あなたが

(defun my-run-python (&optional new) 
    (interactive "P") 
    (if new 
    (run-python nil nil new) 
    (pop-to-buffer (process-buffer (python-proc)) t))) 

(define-key python-mode-map (kbd "C-c C-z") 'my-run-python) 

より便利なものにそれをリバウンドができ、使用C - cC - 現在のPythonインタプリタに を切り替えるZC - UC - CC - Z 新鮮なPythonインタプリタに切り替えます。

+0

ありがとうございました。これは、loveshackのpythonを使っている点を除いて素晴らしいです。私は 'python-mode'を使っています。私はある時点で切り替えたいと思っていましたが、今は 'iPython'を使っています。これは' python-mode'としか互換性がないようです。 – hatmatrix

0

PythonのバッファごとにPythonシェルを有する、python.el介しpython-modeを使用して、デフォルトです。

しかし、複数のPythonバッファが同じPythonシェルを共有する場合は、このデフォルトの動作を変更することができます。そのためには、まずPythonのバッファを開いた後、次のコマンドを入力します。文書化されて

M-x python-set-proc 

を...:

後に続いて
Set the default value of `python-buffer' to correspond to this buffer. 
If the current buffer has a local value of `python-buffer', set the 
default (global) value to that. The associated Python process is the 
one that gets input from C-c C-r et al when used in a buffer that 
doesn't have a local value of `python-buffer'. 

、新しいPythonのバッファは独自のシェルを使用する場合は、次のように入力します

M-x set-variable python-buffer [RET] nil [RET] 

そうしてから、新しいPythonのバッファを開いた後、新しいPythonシェルはpython-switch-to-pythonまたはC-c C-zを入力した後、そのバッファのために作成されます。

関連する問題