39
39
(setq py-shells '("python" "python2" "python2.7" "python3" "python3.2" "ipython" "jython"))
41
(defun py-provide-installed-shells-commands (&optional force)
41
(defun py-provide-installed-shells-commands ()
42
42
"Reads py-shells, provides commands opening these shell. "
44
(let ((force (eq 4 (prefix-numeric-value force)))
45
(temp-buffer "*Python Shell Install Buffer*")
48
(dolist (ele py-shells)
49
(unless (commandp (car (read-from-string ele)))
52
(set-buffer (get-buffer-create temp-buffer))
54
;; (insert ";; Commands calling installed python shells generated by python-mode's python-mode-shell-install.el.
55
;; Install these commands, to get it loaded next time python-mode starts.
56
;; Copying it onto the end of python-mode-shell-install.el should do it. ")
58
(dolist (ele py-shells)
61
(insert (concat "(defun " ele " (&optional argprompt)
63
(if (string= "ipython" ele)
65
(insert (capitalize ele)))
66
(insert (concat " interpreter in another window.
67
With optional \\\\[universal-argument] user is prompted
68
for options to pass to the "))
69
(if (string= "ipython" ele)
71
(insert (capitalize ele)))
72
(insert (concat " interpreter. \"
74
(let ((py-shell-name \"" ele "\"))
75
(local-unset-key [tab])
76
(define-key py-shell-map [tab] 'py-shell-complete)
77
(py-shell argprompt)))\n\n")))
78
(unless (commandp (car (read-from-string ele)))
79
(insert (concat "(defun " ele " (&optional argprompt)
81
(if (string= "ipython" ele)
83
(insert (capitalize ele)))
84
(insert (concat " interpreter in another window.
85
With optional \\\\[universal-argument] user is prompted
86
for options to pass to the "))
87
(if (string= "ipython" ele)
89
(insert (capitalize ele)))
90
(insert (concat " interpreter. \"
92
(let ((py-shell-name \"" ele "\"))
93
(local-unset-key [tab])
94
(define-key py-shell-map [tab] 'py-shell-complete)
95
(py-shell argprompt)))\n\n")))))))
44
(let ((temp-buffer "*Python Shell Install Buffer*"))
45
(set-buffer (get-buffer-create temp-buffer))
47
(insert ";;; Python named shells")
49
(dolist (ele py-shells)
50
(insert (concat "(defun " ele " (&optional argprompt)
52
(if (string= "ipython" ele)
54
(insert (capitalize ele)))
55
(insert (concat " interpreter in another window.
56
With optional \\\\[universal-argument] user is prompted
57
for options to pass to the "))
58
(if (string= "ipython" ele)
60
(insert (capitalize ele)))
61
(insert (concat " interpreter. \"
63
(py-set-shell-completion-environment)
64
(py-shell argprompt nil \"" ele "\"))\n\n")))
65
(insert ";; dedicated\n")
66
(dolist (ele py-shells)
67
(insert (concat "(defun " ele "-dedicated (&optional argprompt)
69
(if (string= "ipython" ele)
71
(insert (capitalize ele)))
72
(insert (concat " dedicated interpreter in another window.
73
With optional \\\\[universal-argument] user is prompted
74
for options to pass to the "))
75
(if (string= "ipython" ele)
77
(insert (capitalize ele)))
78
(insert (concat " interpreter. \"
80
(py-set-shell-completion-environment)
81
(py-shell argprompt t \"" ele "\"))\n\n"))))
97
83
(switch-to-buffer (current-buffer)))