elpy and evil-mode do not react on TAB

Sanel Zukan sanelz at gmail.com
Tue Nov 3 12:44:12 CET 2020


Hi,

OK, after reminding myself how python-mode works (I probably get used to
that behavior, and I'm not frequent python user), this *is* expected
behavior.

In python-mode, when you start typing, hitting TAB will not do anything,
presumably preventing you from accidental TAB inserts which will trigger
errors in python interpreter. However, if you want to insert TAB
forcefully see [1]. E.g. setting "(setq tab-always-indent nil)" will
force TAB to be inserted, but will also adjust other indentation.

However, if you want vi-like TAB behavior with evil-mode, python and
without too much of TAB science, set this in your init file:

 (define-key evil-insert-state-map (kbd "TAB") 'tab-to-tab-stop)

If you are keen to look further for customization, check [2].

[1] https://www.gnu.org/software/emacs/manual/html_node/elisp/Mode_002dSpecific-Indent.html
[2] https://dougie.io/emacs/indentation/

Best,
Sanel

c.buhtz at posteo.jp writes:
> Dear Sanel,
>
> thank you for your reply.
>
> Am 02.11.2020 23:32 schrieb Sanel Zukan:
>> Have you tried running it without evil-mode ("emacs -Q")
>
> Did you mean "-q"? I tried both but nothing changed in the behavior.
>
> To keep sure I deinstalled emacs. It means I purged (and autoremove) 
> every installed package with "emacs" in its name and verified this of 
> course. I also did "rm -rf" on "/.emacs.d" - "~/.emacs" did not exist.
> OK, emacs is gone now from the system.
>
> Installed it again with "apt install emacs" - without elpy and evil.
>
> Starting with "emacs foo" (mode: Fundamental) -> TAB does work.
> Starting with "emacs foo.py" (mode: Python ElDoc) -> TAB does not work.
>
> OK, installed evil only via "apt install elpa-evil". Actiavted evil in 
> the "~/.emacs.d/init.el" with this two lines:
>      (require 'evil)
>      (evil-mode 1)
>
> Starting with "emacs foo" (mode: Fundamental Undo-Tree) -> TAB does work 
> in evil-mode ("<Z>") and standard-emacs-mode ("<E>").
> Starting with "emacs foo.py" (mode: Python Undo-Tree ElDoc) -> TAB does 
> not work in Z- or E-mode.
>
> I will stop here and do not install elpa-elpy also. Because it would 
> make the situation to complexe.
> First I would like to find out (and how to find out) why TAB does not 
> work in standard emacs-python-mode?
>
>
> _______________________________________________
> implementations-list mailing list
> implementations-list at lists.ourproject.org
> https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list




More information about the implementations-list mailing list