I changed two days ago to Emacs 23, which lately gave me a lot of headache, especially, as I have two Python versions installed, the older 2.7 and 3. As I generally want to start the python 3 interpreter, it would be nice if I could tell Emacs in some way to use python 3 instead of 2.7.
Besides, I could not find a module which helps to highlight python3 syntax. I am currently using python-mode.el for highlighting.
Also, if somebody had a good tip for which module would be best to show the pydoc, I would be very thankful.
Thanks in advance!
If you're using python-mode.el
, you can specify the binary to be executed as an inferior process by setting the py-python-command
variable, i.e.:
(setq py-python-command "python3")
Naturally, you'll need to provide the name of the binary as it exists on your system in place of "python3"
, if it differs. In python.el
, the analogous variable to set is python-python-command
.
As far as using pydoc
, there are a few possibilities. First, you can simply execute help()
inside the Python inferior process. If you do choose that option, you might find it useful to add the following code to your .emacs
file:
(setenv "PAGER" "cat")
This is necessary because interactive pagers (e.g., less
, more
, most
, etc.) don't work particularly well inside inferior process buffers. Second, you can install a Texinfo package containing the documentation and use Emacs's info
browser (q.v., Python Programming in Emacs). Finally, if you opt to use python.el
, it includes an interactive function called python-describe-symbol
that can lookup pydoc
help on demand (and I suspect python-mode.el
should have something similar). If you search around a bit, I'm sure you can find other methods and/or third-party packages as well.