5

When I run IPython inside emacs in textmode (i.e. inside a terminal), I don't get any tab completion. Rather than given tab completion it jumps four spaces.

When I run emacs in normal GUI mode there is fine tab completion.

Is there a way to fix that for text mode?

I'm using Linux Mint 15, Emacs 24.3 and IPython 1.1.0

4
  • Are you getting proper python syntax highlighting in the terminal? If not, emacs may be failing to detect this is a python file. If systax highlighting is correct, what is the output of C-h k TAB (basically, what the key is bound to) Commented Nov 14, 2013 at 8:55
  • Also, look in the Messages buffer for any error o warning you are not getting in GUI mode Commented Nov 14, 2013 at 9:36
  • thanks for the replies. I did the C-h k TAB. In text mode I got: TAB runs the command indent-for-tab-command, which is an interactive and in GUI mode i got: <tab> runs the command python-shell-completion-complete-or-indent, which is an interactive compiled Lisp function in python.el'.` I guess that is the reason for the different behaviour. Commented Nov 14, 2013 at 10:25
  • Are you sure you run the same Emacs in the GUI and in the terminal cases? Maybe your $PATH setting is not the same? Commented Nov 14, 2013 at 20:15

3 Answers 3

1

Try this:

(eval-after-load "python"
  '(define-key inferior-python-mode-map "\t" 'python-shell-completion-complete-or-indent)

If this works for you, you may have a misconfiguration problem that is preventing python mode to load correctly in your setup.

Sign up to request clarification or add additional context in comments.

4 Comments

that does work. But it returns an error on startup: Symbol's value as variable is void: python-shell-completion-complete-or-indent
@dYz IMO define needs a quote: '(define-key, so it's not evaluated when reading. BTW current python.el does set TAB this way, maybe just upgrade.
Fixed as per @AndreasRöhler comment
Thanks!, that helped. It seems that I have the python.el from Emacs 24.2 and not the 24.3.
1

I recently encountered the same problem and after some search I found that this problem is caused by the difference between <tab> and TAB. The Emacs wiki has a page describes the difference: http://www.emacswiki.org/emacs/TabKey .

In my python.el, the python-shell-completion-complete-or-indent is bind to <tab> which works fine for GUI but not for CLI. Change the binding to TAB will fix this problem.

Comments

0

Start IPython not from pure shell, but from a python-mode.

I.e. M-x run-python RET with shipped python.el, having customized python-shell-interpreter accordingly.

Resp. M-x IPython RET with python-mode.el

2 Comments

That is how I start IPython in Emacs. I'm using the python.el that comes with Emacs.
@dYz Okay, seeing the key just isn't set by default they way you need it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.