py-shift-{left,right} fail if mark is not active
Bug #1662341 reported by
Barry Warsaw
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-mode.el |
Fix Committed
|
Undecided
|
Andreas Roehler |
Bug Description
Sample code:
def foo(x):
if x == 1:
return 0
Put point on the line with `return 0` and hit either C-c C-r (py-shift-right) or C-c C-l (py-shift-left). The line will not be reindented and you get an error that says "The mark is not active now". Make the mark active and both functions work.
The functions should not be dependent on whether the mark is active or not. If it's not active, then the functions should just shift the current line right or left as appropriate.
Changed in python-mode: | |
assignee: | nobody → Andreas Roehler (a-roehler) |
Changed in python-mode: | |
status: | New → Fix Committed |
To post a comment you must log in.
Can't reproduce so far.
However, WRT unexpected region-shift where no mark was set,
the reason might be a previous yank, which does push-mark:
Lately someone wanted to shift a region also without transient-mark-mode
So I replaced (use-region-p) by
(and (mark) (not (eq (mark) (point))))
That might result in unexpected region-shifts maybe.
Solution would be to return to previous behavior as default, but have a boolean
py-shift- requires- transient- mark-mode- p
Have some idea what happened:
Lately enabled to shift a region also without transient-mark-mode
(use-region-p) was replaced by
(and (mark) (not (eq (mark) (point))))
That might result in unexpected region-shifts maybe.
Solution would be to return to previous behavior as default, but have a boolean
py-shift- requires- transient- mark-mode- p
default t, where nil would permit region without TMM