emacs hangs when typing # in a new file with no lines
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-mode.el |
Fix Released
|
High
|
Andreas Roehler |
Bug Description
When editing a new python file with no lines or the last line beginning with #
and when typing a # in the same block of comments or shebangs that spans until the end of the file emacs will hang. The problem is in the py-end-of expression code in the commet section:
L3631-3633
and possibly lines
L3475-3477
where an endless loop is entered since the (forward-line 1) doesn't move to a newline but only to the end of the line. There is no test on the return value of forward-line however even if there was no irregularity would be reported since the documentations states that moving to the end of the last line of a file actually returns a normal return value as if the operation succeeded.
I think a possible solution would be to make a control statement if the line has actually changed and otherwise exit with a catch-throw statement. I am attaching a patch. Please double-check as I am no lisp programmer.
Changed in python-mode: | |
assignee: | nobody → Andreas Roehler (a-roehler) |
Changed in python-mode: | |
importance: | Undecided → High |
status: | New → In Progress |
milestone: | none → 6.1 |
Changed in python-mode: | |
status: | In Progress → Fix Committed |
Changed in python-mode: | |
status: | Fix Committed → Fix Released |
Hi Gennady,
the lines you implemented your catch-throw are indeed the lines the bug resides.
Even if I don't take your code precisely, please feel encouraged to send patches and code that way.
Also let's discuss occasionally what to do and why.
In the precise case I think forms which move cursor should return position or nil if end-of-buffer reached.
That's pretty simple and thought for simplicity. Other arguments might be valid though.
Fix should will be checked in soon.
Thanks again,
Andreas