2011-11-26 13 views

risposta

3

È necessario rinominare la shell Python originale prima di aprirne una nuova. Utilizzare M - xrename-buffer.

+0

semplice e dolce – hatmatrix

3

Rinominare il buffer non funziona per me, ma è possibile utilizzare il terzo parametro di run-python.

M - :(run-python nil nil t)RET

Dal momento che il legame per passare alla buffer corrente non è davvero utile è possibile rimbalzo in qualcosa di più utile

(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) 

E utilizzare C - cC - z per passare per l'interprete python corrente e C - uC - cC - z per passare a un interprete python fresca.

+0

Grazie. Questo è grandioso eccetto che con loveshack python e sto usando 'python-mode'. Volevo passare a un certo punto, ma ora sto usando 'iPython', che sembra compatibile solo con' python-mode'. – hatmatrix

0

Quando si utilizza python-mode via python.el, avente uno shell Python per Python tampone è il valore predefinito.

Tuttavia, è possibile modificare questo comportamento predefinito se invece si desidera che più buffer Python condividano la stessa shell Python. Per fare ciò, dopo l'apertura del primo buffer Python, immettere:

M-x python-set-proc 

... che è documentata:

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'. 

Poi, più tardi, se si vuole un nuovo buffer Python usi il proprio guscio, immettere:

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

dopo questo modo e poi aprire un nuovo buffer pitone, una nuova shell Python sarà creato per quel buffer dopo aver inserito python-switch-to-python o C-c C-z.

Problemi correlati