0

I updated recently my version of python-mode.el. Since then pressing at end of lines tries completion instead of indentation and pops up a buffer of suggestion. I would rather have only indentation. I use something else for completion. How can this be achieved?

By the way, auto indentation grew /less/ smart with the update. What possibly have I broken?

M. Toya
  • 615
  • 8
  • 24
  • I tried f1 k but did not find out what to do. Feel free to add support to your comment if you have something particular in mind. – M. Toya Jan 09 '15 at 08:31
  • `f1 k TAB` should definitely help, since it will tell you the command name that is being executed and the map in which it is defined. So far, I don't even know if it's `auto-complete` or `company-mode` or whatever. `f1 k` *always* works. – abo-abo Jan 09 '15 at 08:54
  • In this case it is a little more intricate because several modules use tab (at least yasnippet, auto-complete, python-mode). I am looking for what changed in version 6 of python mode compared to version 5 that cause the overall behaviour to changed. – M. Toya Jan 09 '15 at 08:59

2 Answers2

1

You didn't tell which python-mode. Also assume it's about TAB-key.

WRT python-mode.el comment out the present key-setting and write the desired one.

Like that:

;; (define-key map (kbd "TAB") 'py-indent-or-complete)
(define-key map (kbd "TAB") 'py-indent-line)
Andreas Röhler
  • 4,804
  • 14
  • 18
  • I was reluctant to edit the mode file if some option were present but I must admit this is simple and efficient. Thanks. – M. Toya Jan 09 '15 at 09:13
  • @AlfredM. Glad being helpful. In related cases people may consider to file a feature request at https://launchpad.net/python-mode – Andreas Röhler Jan 09 '15 at 09:52
1

You shouldn't need to modify the mode file itself to make this happen. You should be able to do it via python-mode-hook. This works for me (in my ~/.emacs):

(add-hook 'python-mode-hook
          (define-key python-mode-map (kbd "TAB") 'py-indent-line))
gimboland
  • 1,926
  • 2
  • 19
  • 28