bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#48609: Eglot and tab-always-indent conflict in python-mode


From: João Távora
Subject: bug#48609: Eglot and tab-always-indent conflict in python-mode
Date: Sun, 23 May 2021 22:38:52 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

João Távora <joaotavora@gmail.com> writes:

> Doug Davis <ddavis@ddavis.io> writes:
>
>> Hi João & Pankaj,
>>
>> João Távora <joaotavora@gmail.com> writes:
>>
>>> Pankaj Jangid <pankaj@codeisgreat.org> writes:
>>>
>>>> If ‘eglot’ is running and ‘tab-always-indent’ is set to ’complete. Then
>>>> in python-mode, TAB doesn’t cycle point column positions. For example,
>>>> in the following code if you are at end of line 2 and then you press RET
>>>> then TAB doesn’t move the point to left margin. Without ‘eglot’ this
>>>> works fine.
>>>>
>>>> #+begin_src python
>>>> def greet(s):
>>>>     print(f"Hello {s}!")
>>>> #+end_src
>>>
>>> Hello Pankaj,
>>>
>>> I cannot reproduce this.  Here's what I ran:
>>>
>>>   $ emacs --version | head -1
>>>   GNU Emacs 26.3
>>>   $ emacs -Q -f package-initialize -L ~/path/to/eglot/eglot -l eglot \
>>>     ~/path/to/a/python/file.py -f eglot
>>
>> Just driving by, hopefully this is helpful; it looks like company may be
>> the missing ingredient.
>
> No, it wasn't, but indeed, there was a missing ingredient.  I had
> forgotten to set tab-always-indent to 'complete.
>
> With this recipe, I can reproduce the bug:
>
>    $ emacs -Q -f package-initialize -L ~/path/to/eglot/eglot -l eglot  \
>      ~/path/to/a/python/file.py                                        \
>      --eval '(setq tab-always-indent (quote complete))' -f eglot
>
> Don't know what's up, though.  Going to have a better look.

I see what's up.  When Eglot is turned on, having tab-always-indent set
to 'complete means that the first TAB press after pressing RET will
actually try to complete things.

When Eglot is active, the completion system can find a large number of
completions available for that empty line.  Since you have selected
tab-always-indent to be 'complete, Eglot will request and present those
completions in the *Completions* buffer.

The only way to cancel that operation is by C-g or clicking somewhere
else.  This in turn makes it so that the "last" command issued isn't
indent-for-tab-command anymore, and so there aren't two
indent-for-tab-command commands in a row.  And that is the criteria
consulted by python.el's indentation function to decide to cycle the
indentation.

So I'm not sure what needs to be fixed here, if anything, or how you
would like this to behave.

João.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]