Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
cb42456f
Commit
cb42456f
authored
May 17, 2012
by
Fabián Ezequiel Gallina
Committed by
Fabián Ezequiel Gallina
May 17, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't deactivate mark after indenting commands
parent
76eefb1f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
30 deletions
+33
-30
lisp/progmodes/python.el
lisp/progmodes/python.el
+33
-30
No files found.
lisp/progmodes/python.el
View file @
cb42456f
...
@@ -720,24 +720,25 @@ point is not in between the indentation."
...
@@ -720,24 +720,25 @@ point is not in between the indentation."
"Indent a python region automagically.
"Indent a python region automagically.
Called from a program, START and END specify the region to indent."
Called from a program, START and END specify the region to indent."
(
save-excursion
(
let
((
deactivate-mark
nil
))
(
goto-char
end
)
(
save-excursion
(
setq
end
(
point-marker
))
(
goto-char
end
)
(
goto-char
start
)
(
setq
end
(
point-marker
))
(
or
(
bolp
)
(
forward-line
1
))
(
goto-char
start
)
(
while
(
<
(
point
)
end
)
(
or
(
bolp
)
(
forward-line
1
))
(
or
(
and
(
bolp
)
(
eolp
))
(
while
(
<
(
point
)
end
)
(
let
(
word
)
(
or
(
and
(
bolp
)
(
eolp
))
(
forward-line
-1
)
(
let
(
word
)
(
back-to-indentation
)
(
forward-line
-1
)
(
setq
word
(
current-word
))
(
back-to-indentation
)
(
forward-line
1
)
(
setq
word
(
current-word
))
(
when
word
(
forward-line
1
)
(
beginning-of-line
)
(
when
word
(
delete-horizontal-space
)
(
beginning-of-line
)
(
indent-to
(
python-indent-calculate-indentation
)))))
(
delete-horizontal-space
)
(
forward-line
1
))
(
indent-to
(
python-indent-calculate-indentation
)))))
(
move-marker
end
nil
)))
(
forward-line
1
))
(
move-marker
end
nil
))))
(
defun
python-indent-shift-left
(
start
end
&optional
count
)
(
defun
python-indent-shift-left
(
start
end
&optional
count
)
"Shift lines contained in region START END by COUNT columns to the left.
"Shift lines contained in region START END by COUNT columns to the left.
...
@@ -758,14 +759,15 @@ than COUNT columns."
...
@@ -758,14 +759,15 @@ than COUNT columns."
(
setq
count
(
prefix-numeric-value
count
))
(
setq
count
(
prefix-numeric-value
count
))
(
setq
count
python-indent-offset
))
(
setq
count
python-indent-offset
))
(
when
(
>
count
0
)
(
when
(
>
count
0
)
(
save-excursion
(
let
((
deactivate-mark
nil
))
(
goto-char
start
)
(
save-excursion
(
while
(
<
(
point
)
end
)
(
goto-char
start
)
(
if
(
and
(
<
(
current-indentation
)
count
)
(
while
(
<
(
point
)
end
)
(
not
(
looking-at
"[ \t]*$"
)))
(
if
(
and
(
<
(
current-indentation
)
count
)
(
error
"Can't shift all lines enough"
))
(
not
(
looking-at
"[ \t]*$"
)))
(
forward-line
))
(
error
"Can't shift all lines enough"
))
(
indent-rigidly
start
end
(
-
count
)))))
(
forward-line
))
(
indent-rigidly
start
end
(
-
count
))))))
(
add-to-list
'debug-ignored-errors
"^Can't shift all lines enough"
)
(
add-to-list
'debug-ignored-errors
"^Can't shift all lines enough"
)
...
@@ -782,10 +784,11 @@ lie."
...
@@ -782,10 +784,11 @@ lie."
(
if
mark-active
(
if
mark-active
(
list
(
region-beginning
)
(
region-end
)
current-prefix-arg
)
(
list
(
region-beginning
)
(
region-end
)
current-prefix-arg
)
(
list
(
line-beginning-position
)
(
line-end-position
)
current-prefix-arg
)))
(
list
(
line-beginning-position
)
(
line-end-position
)
current-prefix-arg
)))
(
if
count
(
let
((
deactivate-mark
nil
))
(
setq
count
(
prefix-numeric-value
count
))
(
if
count
(
setq
count
python-indent-offset
))
(
setq
count
(
prefix-numeric-value
count
))
(
indent-rigidly
start
end
count
))
(
setq
count
python-indent-offset
))
(
indent-rigidly
start
end
count
)))
;; Directly from Dave Love's python.el
;; Directly from Dave Love's python.el
(
defun
python-indent-electric-colon
(
arg
)
(
defun
python-indent-electric-colon
(
arg
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment