Show More
@@ -172,62 +172,12 b' used in your :file:`.emacs` file to enable the server:' | |||||
172 | Thanks to the work of Alexander Schmolck and Prabhu Ramachandran, |
|
172 | Thanks to the work of Alexander Schmolck and Prabhu Ramachandran, | |
173 | currently (X)Emacs and IPython get along very well in other ways. |
|
173 | currently (X)Emacs and IPython get along very well in other ways. | |
174 |
|
174 | |||
175 | .. note:: |
|
175 | With (X)EMacs >= 24, You can enable IPython in python-mode with: | |
176 |
|
||||
177 | You will need to use a recent enough version of :file:`python-mode.el`, |
|
|||
178 | along with the file :file:`ipython.el`. You can check that the version you |
|
|||
179 | have of :file:`python-mode.el` is new enough by either looking at the |
|
|||
180 | revision number in the file itself, or asking for it in (X)Emacs via ``M-x |
|
|||
181 | py-version``. Versions 4.68 and newer contain the necessary fixes for |
|
|||
182 | proper IPython support. |
|
|||
183 |
|
||||
184 | The file :file:`ipython.el` is included with the IPython distribution, in the |
|
|||
185 | directory :file:`docs/emacs`. Once you put these files in your Emacs path, all |
|
|||
186 | you need in your :file:`.emacs` file is: |
|
|||
187 |
|
176 | |||
188 | .. code-block:: common-lisp |
|
177 | .. code-block:: common-lisp | |
189 |
|
178 | |||
190 |
(require ' |
|
179 | (require 'python) | |
191 |
|
180 | (setq python-shell-interpreter "ipython") | ||
192 | This should give you full support for executing code snippets via |
|
|||
193 | IPython, opening IPython as your Python shell via ``C-c !``, etc. |
|
|||
194 |
|
||||
195 | You can customize the arguments passed to the IPython instance at startup by |
|
|||
196 | setting the ``py-python-command-args`` variable. For example, to start always |
|
|||
197 | with ``matplotlib`` integration and hardcoded light-background colors, you can use: |
|
|||
198 |
|
||||
199 | .. code-block:: common-lisp |
|
|||
200 |
|
||||
201 | (setq py-python-command-args '("--matplotlib" "--colors" "LightBG")) |
|
|||
202 |
|
||||
203 | If you happen to get garbage instead of colored prompts as described in |
|
|||
204 | the previous section, you may need to set also in your :file:`.emacs` file: |
|
|||
205 |
|
||||
206 | .. code-block:: common-lisp |
|
|||
207 |
|
||||
208 | (setq ansi-color-for-comint-mode t) |
|
|||
209 |
|
||||
210 | Notes on emacs support: |
|
|||
211 |
|
||||
212 | .. This looks hopelessly out of date - can someone update it? |
|
|||
213 |
|
||||
214 | * There is one caveat you should be aware of: you must start the IPython shell |
|
|||
215 | before attempting to execute any code regions via ``C-c |``. Simply type |
|
|||
216 | ``C-c !`` to start IPython before passing any code regions to the |
|
|||
217 | interpreter, and you shouldn't experience any problems. This is due to a bug |
|
|||
218 | in Python itself, which has been fixed for Python 2.3, but exists as of |
|
|||
219 | Python 2.2.2 (reported as SF bug [ 737947 ]). |
|
|||
220 |
|
||||
221 | * The (X)Emacs support is maintained by Alexander Schmolck, so all |
|
|||
222 | comments/requests should be directed to him through the IPython mailing |
|
|||
223 | lists. |
|
|||
224 |
|
||||
225 | * This code is still somewhat experimental so it's a bit rough around the |
|
|||
226 | edges (although in practice, it works quite well). |
|
|||
227 |
|
||||
228 | * Be aware that if you customized ``py-python-command`` previously, this value |
|
|||
229 | will override what :file:`ipython.el` does (because loading the customization |
|
|||
230 | variables comes later). |
|
|||
231 |
|
|
181 | ||
232 | .. _`(X)Emacs`: http://www.gnu.org/software/emacs/ |
|
182 | .. _`(X)Emacs`: http://www.gnu.org/software/emacs/ | |
233 | .. _TextMate: http://macromates.com/ |
|
183 | .. _TextMate: http://macromates.com/ |
General Comments 0
You need to be logged in to leave comments.
Login now