python-components-mode.el messes up with cursor position

Asked by av

I am getting crazy with this!
After upgrading python-mode.el this summer (cannot remember which exact version) this strange behaviour happens: when I am writing in a python-mode buffer, the cursor sometimes jumps to the start of the line (and I keep on writing there or the autocompletion gets activated).

By looking at the *Messages* buffer I see this message each time this happens:

python-mode loaded from: python-components-mode.el

but I do not appear to have python-componenets-mode.el anywhere.
I've tried to upgrade python-mode.el from list-packages but this behaviour still persists.
Any suggestion/idea/help?

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
python-mode.el Edit question
Assignee:
No assignee Edit question
Solved by:
av
Solved:
Last query:
Last reply:
Revision history for this message
Andreas Roehler (a-roehler) said :
#1

On 27.11.2016 13:33, av wrote:
> New question #404431 on python-mode.el:
> https://answers.launchpad.net/python-mode/+question/404431
>
> I am getting crazy with this!
> After upgrading python-mode.el this summer (cannot remember which exact version) this strange behaviour happens: when I am writing in a python-mode buffer, the cursor sometimes jumps to the start of the line (and I keep on writing there or the autocompletion gets activated).
>
> By looking at the *Messages* buffer I see this message each time this happens:
>
> python-mode loaded from: python-components-mode.el
>
> but I do not appear to have python-componenets-mode.el anywhere.
> I've tried to upgrade python-mode.el from list-packages but this behaviour still persists.
> Any suggestion/idea/help?
>
> Thanks
>

That message might be wrongly sent from python-mode.el
M-x locate RET my-file RET
might tell the location.

Here melpa installs into ~/emacs.d, maybe have a look there.

HTH,
Andreas

Revision history for this message
av (arranger1044) said :
#2

This is the content of my folder ~/emacs.d/elpa/python-mode-20161124.930/:
    - python-mode.el
    - python-mode-autoloads.el
    - python-mode-pkg.el
    - completion/
        - pycomplete.el
        - pycomplete.py

what am I missing?

Revision history for this message
Andreas Roehler (a-roehler) said :
#3

On 27.11.2016 14:33, av wrote:
> Question #404431 on python-mode.el changed:
> https://answers.launchpad.net/python-mode/+question/404431
>
> av posted a new comment:
> This is the content of my folder ~/emacs.d/elpa/python-mode-20161124.930/:
> - python-mode.el
> - python-mode-autoloads.el
> - python-mode-pkg.el
> - completion/
> - pycomplete.el
> - pycomplete.py
>
> what am I missing?
>

This indicates a rather recent python-mode.el Still encountering the bug?

Revision history for this message
av (arranger1044) said :
#4

Yes, I still have this (apparently) random behavior of the cursor jumping (and this message string appearing).
Can the bug ticket you open solve this issue along the wrong message?

Revision history for this message
Andreas Roehler (a-roehler) said :
#5

On 27.11.2016 16:57, av wrote:
> Question #404431 on python-mode.el changed:
> https://answers.launchpad.net/python-mode/+question/404431
>
> av posted a new comment:
> Yes, I still have this (apparently) random behavior of the cursor jumping
Please open a bug report giving some example, which triggers the bug.

> (and this message string appearing).

This would mean, you installed the components-branch before loading
python-mode.el, resp. the components-branch is in use.

Opened #1645108 for this messaging.

  Please check you init-file to avoid loading the devel-branch, load
python-mode.el

> Can the bug ticket you open solve this issue along the wrong message?
>

Revision history for this message
av (arranger1044) said :
#6

I haven't installed the devel-branch at all (always used list-packages), plus my init file seems not to contain anything about python-components. Which string shall I look for?

I will try to open a bug report later, however it would be just something like:
-- Try to open a .py file with python-mode and write on a line the string """this is """ and the cursor gets in first position. --

I suspect there must be some interaction with auto completion?

Revision history for this message
Andreas Roehler (a-roehler) said :
#7

On 27.11.2016 21:13, av wrote:
> Question #404431 on python-mode.el changed:
> https://answers.launchpad.net/python-mode/+question/404431
>
> av posted a new comment:
> I haven't installed the devel-branch at all (always used list-packages),
> plus my init file seems not to contain anything about python-components.
> Which string shall I look for?
>
> I will try to open a bug report later, however it would be just something like:
> -- Try to open a .py file with python-mode and write on a line the string """this is """ and the cursor gets in first position. --
>
> I suspect there must be some interaction with auto completion?

Please start from emacs -Q, loading only python-mode.el and try again.

Revision history for this message
av (arranger1044) said :
#8

I started emacs with -Q and loaded a python file with C-x-f (it started in the normal python major mode "Python") then with M-x typed python-mode. As a message I see again 'python-mode loaded from: python-components-mode.el', however the major mode does not seem to change. I say this because it is still written "Python", whereas it should be written "Py" (plus, no functions like 'py-up' are available from M-x).

What am I doing wrong? Thanks for the help thus far

Revision history for this message
Andreas Roehler (a-roehler) said :
#9

On 28.11.2016 10:52, av wrote:
> Question #404431 on python-mode.el changed:
> https://answers.launchpad.net/python-mode/+question/404431
>
> av posted a new comment:
> I started emacs with -Q and loaded a python file

Please don't load a python file, evaluate the python-mode.el first.
Otherwise --as you noticed-- the built-in python.el provides the mode.

Maybe put a (load "my/Path-to-python-mode.el/python-mode.el") in your
init-file - before other python-stuff gets loaded.

Revision history for this message
av (arranger1044) said :
#10

I see, thank you. By doing so the problem seems not to happen (no message, no cursor moving) so I suppose that the issue comes from some weird interaction between python-mode and other python specific issues.
The only way to get it now seems to be a thorough test by removing/adding each single line : )
Thanks again for your help Andreas, if I found this interaction, I will post it here later

Revision history for this message
av (arranger1044) said :
#11

Ok, I found the culprit: it seems that the package auto-indent-mode is responsible for the interaction.
I ended the unwanted behavior by commenting:

;; (require 'auto-indent-mode)
;; (auto-indent-global-mode)

Thanks again Andreas