GNU bug report logs -
#48609
Eglot and tab-always-indent conflict in python-mode
Previous Next
To reply to this bug, email your comments to 48609 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
joaotavora <at> gmail.com, bug-gnu-emacs <at> gnu.org
:
bug#48609
; Package
emacs
.
(Sun, 23 May 2021 14:56:05 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Pankaj Jangid <pankaj <at> codeisgreat.org>
:
New bug report received and forwarded. Copy sent to
joaotavora <at> gmail.com, bug-gnu-emacs <at> gnu.org
.
(Sun, 23 May 2021 14:56:05 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#48609
; Package
emacs
.
(Sun, 23 May 2021 20:42:02 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
Pankaj Jangid <pankaj <at> 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
This opens the file which has your example contents, and starts up
eglot. I move point to the end of line 2, press RET and press TAB
twice. Point is at the left margin.
Without Eglot, the result is exactly the same.
I would find it odd that Eglot messes with TAB behaviour, but I'm
waiting for a more complete reproduction recipe from your part so we can
understand what's going on.
João
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#48609
; Package
emacs
.
(Sun, 23 May 2021 21:03:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 48609 <at> debbugs.gnu.org (full text, mbox):
Hi João & Pankaj,
João Távora <joaotavora <at> gmail.com> writes:
> Pankaj Jangid <pankaj <at> 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. If I follow these steps but add:
`-L ~/path/to/company -l company`, run both
M-x company-mode
and
M-x eglot
with `tab-always-indent' set to 'complete I'm able to reproduce the
issue described by Pankaj. If I skip loading Eglot but only use company
the issue doesn't surface.
Cheers,
Doug
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#48609
; Package
emacs
.
(Sun, 23 May 2021 21:18:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 48609 <at> debbugs.gnu.org (full text, mbox):
Doug Davis <ddavis <at> ddavis.io> writes:
> Hi João & Pankaj,
>
> João Távora <joaotavora <at> gmail.com> writes:
>
>> Pankaj Jangid <pankaj <at> 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.
João
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#48609
; Package
emacs
.
(Sun, 23 May 2021 21:40:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 48609 <at> debbugs.gnu.org (full text, mbox):
João Távora <joaotavora <at> gmail.com> writes:
> Doug Davis <ddavis <at> ddavis.io> writes:
>
>> Hi João & Pankaj,
>>
>> João Távora <joaotavora <at> gmail.com> writes:
>>
>>> Pankaj Jangid <pankaj <at> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#48609
; Package
emacs
.
(Mon, 24 May 2021 08:19:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 48609 <at> debbugs.gnu.org (full text, mbox):
João Távora <joaotavora <at> gmail.com> writes:
> So I'm not sure what needs to be fixed here, if anything, or how you
> would like this to behave.
IMO works as described in the `tab-always-indent` docstring:
If ‘complete’, TAB first tries to indent the current line, and if the line
was already indented, then try to complete the thing at point.
One can reproduce this without Eglot:
1. emacs -Q
2. C-x C-f test.py
3. M-: (setq tab-always-indent 'complete)
4. C-c C-p
After step 4 the `python-completion-at-point` function starts producing
completions and each TAB key will lead to "No match" message.
Pankaj, take a look at the `tab-first-completion` variable.
--
Andrii
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#48609
; Package
emacs
.
(Tue, 25 May 2021 06:42:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 48609 <at> debbugs.gnu.org (full text, mbox):
Andrii Kolomoiets <andreyk.mad <at> gmail.com> writes:
> IMO works as described in the `tab-always-indent` docstring:
>
> If ‘complete’, TAB first tries to indent the current line, and if the line
> was already indented, then try to complete the thing at point.
Thanks for sharing this. I think I should have been more specific. The
bug is more related to python-mode then to ‘tab-always-indent’.
In ‘python’ buffers, TABs cycle position of point. But as described in
my original report and reproduced by João, bringing Eglot, inhibits this
behavior.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#48609
; Package
emacs
.
(Tue, 25 May 2021 06:48:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 48609 <at> debbugs.gnu.org (full text, mbox):
João Távora <joaotavora <at> gmail.com> writes:
> 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.
I think that the best place should be python.el then. A variable
‘python-completion-on-empty-line’ or some better name. I don’t know if
such a variable already exist or not. Need to check.
Since the point-position is cycled by python.el, that is the place where
it should be configured.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#48609
; Package
emacs
.
(Tue, 25 May 2021 09:34:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 48609 <at> debbugs.gnu.org (full text, mbox):
Pankaj Jangid <pankaj <at> codeisgreat.org> writes:
> Andrii Kolomoiets <andreyk.mad <at> gmail.com> writes:
>
>> IMO works as described in the `tab-always-indent` docstring:
>>
>> If ‘complete’, TAB first tries to indent the current line, and if the line
>> was already indented, then try to complete the thing at point.
>
> Thanks for sharing this. I think I should have been more specific. The
> bug is more related to python-mode then to ‘tab-always-indent’.
>
> In ‘python’ buffers, TABs cycle position of point. But as described in
> my original report and reproduced by João, bringing Eglot, inhibits this
> behavior.
Yes, but what actually happened is that the one of those tabs was
waiting for completions to come in, so the system was indeed behaving as
intended. It's just that when you don't have Eglot, you also don't have
completions.
João
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#48609
; Package
emacs
.
(Tue, 25 May 2021 09:37:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 48609 <at> debbugs.gnu.org (full text, mbox):
Pankaj Jangid <pankaj <at> codeisgreat.org> writes:
> João Távora <joaotavora <at> gmail.com> writes:
>
>> 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.
>
> I think that the best place should be python.el then. A variable
> ‘python-completion-on-empty-line’ or some better name. I don’t know if
> such a variable already exist or not. Need to check.
Yes, I agree, python.el. I wonder if instead of that variale the
cycling logic could be changed to account for this case where there may
be completions at point (Eglot is only one possible provider of such
completions, btw.)
João
Information forwarded
to
fgallina <at> gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#48609
; Package
emacs
.
(Tue, 25 May 2021 14:09:01 GMT)
Full text and
rfc822 format available.
Message #35 received at 48609 <at> debbugs.gnu.org (full text, mbox):
João Távora <joaotavora <at> gmail.com> writes:
>>> 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.
>>
>> I think that the best place should be python.el then. A variable
>> ‘python-completion-on-empty-line’ or some better name. I don’t know if
>> such a variable already exist or not. Need to check.
>
> Yes, I agree, python.el. I wonder if instead of that variale the
> cycling logic could be changed to account for this case where there may
> be completions at point (Eglot is only one possible provider of such
> completions, btw.)
CC’ing Fabián.
This bug report was last modified 4 years and 77 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.