summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1996-04-08 23:05:56 (GMT)
committerBarry Warsaw <barry@python.org>1996-04-08 23:05:56 (GMT)
commitf2389a0b24554a4be2d2f29157af3b1625135894 (patch)
tree0120505a665f9b0c5ffabd82691b662d37527103 /Misc
parent43ecf8ee5854d457fbd3412bd80e85ea32bac39d (diff)
downloadcpython-f2389a0b24554a4be2d2f29157af3b1625135894.zip
cpython-f2389a0b24554a4be2d2f29157af3b1625135894.tar.gz
cpython-f2389a0b24554a4be2d2f29157af3b1625135894.tar.bz2
(py-indent-right, py-outdent-left): fixed placement of point after
adjustments.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/python-mode.el38
1 files changed, 22 insertions, 16 deletions
diff --git a/Misc/python-mode.el b/Misc/python-mode.el
index b40a587..8e4e199 100644
--- a/Misc/python-mode.el
+++ b/Misc/python-mode.el
@@ -507,13 +507,15 @@ current line."
(if m
(list (min p m) (max p m) arg)
(list p m arg))))
- (let ((pos (- (point-max) (point)))
- (end (save-excursion
- (goto-char (or end (1+ start)))
- (and (not (bolp))
- (forward-line 1))
- (set-marker (make-marker) (point))))
- col want indent)
+ (let* ((dir (= (point) start))
+ (pos (if dir (point)
+ (- (point-max) (point))))
+ (end (save-excursion
+ (goto-char (or end (1+ start)))
+ (and (not (bolp))
+ (forward-line 1))
+ (set-marker (make-marker) (point))))
+ col want indent)
(goto-char start)
(beginning-of-line)
(unwind-protect
@@ -528,7 +530,8 @@ current line."
(indent-to (+ col want))))
(forward-line 1))
(set-marker end nil))
- (goto-char (- (point-max) pos))
+ (goto-char (if dir pos
+ (- (point-max) pos)))
(py-keep-region-active)))
(defun py-outdent-left (start end arg)
@@ -543,13 +546,15 @@ the current line."
(if m
(list (min p m) (max p m) arg)
(list p m arg))))
- (let ((pos (- (point-max) (point)))
- (end (save-excursion
- (goto-char (or end (1+ start)))
- (and (not (bolp))
- (forward-line 1))
- (set-marker (make-marker) (point))))
- col want)
+ (let* ((dir (= (point) start))
+ (pos (if dir (point)
+ (- (point-max) (point))))
+ (end (save-excursion
+ (goto-char (or end (1+ start)))
+ (and (not (bolp))
+ (forward-line 1))
+ (set-marker (make-marker) (point))))
+ col want)
(goto-char start)
(beginning-of-line)
(unwind-protect
@@ -563,7 +568,8 @@ the current line."
(indent-to (- col want))))
(forward-line 1))
(set-marker end nil))
- (goto-char (- (point-max) pos))
+ (goto-char (if dir pos
+ (- (point-max) pos)))
(py-keep-region-active)))