Show More
@@ -17,7 +17,8 b'' | |||||
17 | ;; can be used to convert bits of a ipython session into something that can be |
|
17 | ;; can be used to convert bits of a ipython session into something that can be | |
18 | ;; used for doctests. To install, put this file somewhere in your emacs |
|
18 | ;; used for doctests. To install, put this file somewhere in your emacs | |
19 | ;; `load-path' [1] and add the following line to your ~/.emacs file (the first |
|
19 | ;; `load-path' [1] and add the following line to your ~/.emacs file (the first | |
20 |
;; line only needed if the default (``"ipython"``) is wrong |
|
20 | ;; line only needed if the default (``"ipython"``) is wrong or ipython is not | |
|
21 | ;; in your `exec-path'):: | |||
21 | ;; |
|
22 | ;; | |
22 | ;; (setq ipython-command "/SOME-PATH/ipython") |
|
23 | ;; (setq ipython-command "/SOME-PATH/ipython") | |
23 | ;; (require 'ipython) |
|
24 | ;; (require 'ipython) | |
@@ -36,7 +37,7 b'' | |||||
36 | ;; always in ``pylab`` mode with hardcoded light-background colors, you can |
|
37 | ;; always in ``pylab`` mode with hardcoded light-background colors, you can | |
37 | ;; use:: |
|
38 | ;; use:: | |
38 | ;; |
|
39 | ;; | |
39 | ;; (setq py-python-command-args '("--pylab" "--colors=LightBG")) |
|
40 | ;; (setq-default py-python-command-args '("--pylab" "--colors=LightBG")) | |
40 | ;; |
|
41 | ;; | |
41 | ;; |
|
42 | ;; | |
42 | ;; NOTE: This mode is currently somewhat alpha and although I hope that it |
|
43 | ;; NOTE: This mode is currently somewhat alpha and although I hope that it | |
@@ -132,6 +133,12 b'' | |||||
132 | (require 'shell) |
|
133 | (require 'shell) | |
133 | (require 'executable) |
|
134 | (require 'executable) | |
134 | (require 'ansi-color) |
|
135 | (require 'ansi-color) | |
|
136 | ;; XXX load python-mode, so that we can screw around with its variables | |||
|
137 | ;; this has the disadvantage that python-mode is loaded even if no | |||
|
138 | ;; python-file is ever edited etc. but it means that `py-shell' works | |||
|
139 | ;; without loading a python-file first. Obviously screwing around with | |||
|
140 | ;; python-mode's variables like this is a mess, but well. | |||
|
141 | (require 'python-mode) | |||
135 |
|
142 | |||
136 | (defcustom ipython-command "ipython" |
|
143 | (defcustom ipython-command "ipython" | |
137 | "*Shell command used to start ipython." |
|
144 | "*Shell command used to start ipython." | |
@@ -164,12 +171,8 b' the second for a \'normal\' command, and the third for a multiline command.")' | |||||
164 | (if (not (executable-find ipython-command)) |
|
171 | (if (not (executable-find ipython-command)) | |
165 | (message (format "Can't find executable %s - ipython.el *NOT* activated!!!" |
|
172 | (message (format "Can't find executable %s - ipython.el *NOT* activated!!!" | |
166 | ipython-command)) |
|
173 | ipython-command)) | |
167 | ;; XXX load python-mode, so that we can screw around with its variables |
|
174 | ;; change the default value of py-shell-name to ipython | |
168 | ;; this has the disadvantage that python-mode is loaded even if no |
|
175 | (setq-default py-shell-name ipython-command) | |
169 | ;; python-file is ever edited etc. but it means that `py-shell' works |
|
|||
170 | ;; without loading a python-file first. Obviously screwing around with |
|
|||
171 | ;; python-mode's variables like this is a mess, but well. |
|
|||
172 | (require 'python-mode) |
|
|||
173 | ;; turn on ansi colors for ipython and activate completion |
|
176 | ;; turn on ansi colors for ipython and activate completion | |
174 | (defun ipython-shell-hook () |
|
177 | (defun ipython-shell-hook () | |
175 | ;; the following is to synchronize dir-changes |
|
178 | ;; the following is to synchronize dir-changes | |
@@ -220,15 +223,16 b' the second for a \'normal\' command, and the third for a multiline command.")' | |||||
220 | (unless (delq nil |
|
223 | (unless (delq nil | |
221 | (mapcar (lambda (x) (eq (string-match "^--colors=*" x) 0)) |
|
224 | (mapcar (lambda (x) (eq (string-match "^--colors=*" x) 0)) | |
222 | py-python-command-args)) |
|
225 | py-python-command-args)) | |
223 | (push (format "--colors=%s" |
|
226 | (setq-default py-python-command-args | |
224 | (cond |
|
227 | (cons (format "--colors=%s" | |
225 | ((eq frame-background-mode 'dark) |
|
228 | (cond | |
226 | "Linux") |
|
229 | ((eq frame-background-mode 'dark) | |
227 | ((eq frame-background-mode 'light) |
|
230 | "Linux") | |
228 | "LightBG") |
|
231 | ((eq frame-background-mode 'light) | |
229 | (t ; default (backg-mode isn't always set by XEmacs) |
|
232 | "LightBG") | |
230 | "LightBG"))) |
|
233 | (t ; default (backg-mode isn't always set by XEmacs) | |
231 | py-python-command-args)) |
|
234 | "LightBG"))) | |
|
235 | py-python-command-args))) | |||
232 | (when (boundp 'py-python-command) |
|
236 | (when (boundp 'py-python-command) | |
233 | (unless (equal ipython-backup-of-py-python-command py-python-command) |
|
237 | (unless (equal ipython-backup-of-py-python-command py-python-command) | |
234 | (setq ipython-backup-of-py-python-command py-python-command))) |
|
238 | (setq ipython-backup-of-py-python-command py-python-command))) |
General Comments 0
You need to be logged in to leave comments.
Login now