diff options
| author | Fabián Ezequiel Gallina | 2012-05-17 00:03:04 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2012-05-17 00:03:04 -0300 |
| commit | cb42456fc6d08f5e9db5f8c33d1647b248eb79c5 (patch) | |
| tree | 5d6869ffe9b60eabe337a6e2bfdf7532ad2778cd /lisp/progmodes/python.el | |
| parent | 76eefb1fe574c776c21282691aacc6fea3475abe (diff) | |
| download | emacs-cb42456fc6d08f5e9db5f8c33d1647b248eb79c5.tar.gz emacs-cb42456fc6d08f5e9db5f8c33d1647b248eb79c5.zip | |
Don't deactivate mark after indenting commands
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 3863a9f851e..7da5599d6f0 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -720,24 +720,25 @@ point is not in between the indentation." | |||
| 720 | "Indent a python region automagically. | 720 | "Indent a python region automagically. |
| 721 | 721 | ||
| 722 | Called from a program, START and END specify the region to indent." | 722 | Called from a program, START and END specify the region to indent." |
| 723 | (save-excursion | 723 | (let ((deactivate-mark nil)) |
| 724 | (goto-char end) | 724 | (save-excursion |
| 725 | (setq end (point-marker)) | 725 | (goto-char end) |
| 726 | (goto-char start) | 726 | (setq end (point-marker)) |
| 727 | (or (bolp) (forward-line 1)) | 727 | (goto-char start) |
| 728 | (while (< (point) end) | 728 | (or (bolp) (forward-line 1)) |
| 729 | (or (and (bolp) (eolp)) | 729 | (while (< (point) end) |
| 730 | (let (word) | 730 | (or (and (bolp) (eolp)) |
| 731 | (forward-line -1) | 731 | (let (word) |
| 732 | (back-to-indentation) | 732 | (forward-line -1) |
| 733 | (setq word (current-word)) | 733 | (back-to-indentation) |
| 734 | (forward-line 1) | 734 | (setq word (current-word)) |
| 735 | (when word | 735 | (forward-line 1) |
| 736 | (beginning-of-line) | 736 | (when word |
| 737 | (delete-horizontal-space) | 737 | (beginning-of-line) |
| 738 | (indent-to (python-indent-calculate-indentation))))) | 738 | (delete-horizontal-space) |
| 739 | (forward-line 1)) | 739 | (indent-to (python-indent-calculate-indentation))))) |
| 740 | (move-marker end nil))) | 740 | (forward-line 1)) |
| 741 | (move-marker end nil)))) | ||
| 741 | 742 | ||
| 742 | (defun python-indent-shift-left (start end &optional count) | 743 | (defun python-indent-shift-left (start end &optional count) |
| 743 | "Shift lines contained in region START END by COUNT columns to the left. | 744 | "Shift lines contained in region START END by COUNT columns to the left. |
| @@ -758,14 +759,15 @@ than COUNT columns." | |||
| 758 | (setq count (prefix-numeric-value count)) | 759 | (setq count (prefix-numeric-value count)) |
| 759 | (setq count python-indent-offset)) | 760 | (setq count python-indent-offset)) |
| 760 | (when (> count 0) | 761 | (when (> count 0) |
| 761 | (save-excursion | 762 | (let ((deactivate-mark nil)) |
| 762 | (goto-char start) | 763 | (save-excursion |
| 763 | (while (< (point) end) | 764 | (goto-char start) |
| 764 | (if (and (< (current-indentation) count) | 765 | (while (< (point) end) |
| 765 | (not (looking-at "[ \t]*$"))) | 766 | (if (and (< (current-indentation) count) |
| 766 | (error "Can't shift all lines enough")) | 767 | (not (looking-at "[ \t]*$"))) |
| 767 | (forward-line)) | 768 | (error "Can't shift all lines enough")) |
| 768 | (indent-rigidly start end (- count))))) | 769 | (forward-line)) |
| 770 | (indent-rigidly start end (- count)))))) | ||
| 769 | 771 | ||
| 770 | (add-to-list 'debug-ignored-errors "^Can't shift all lines enough") | 772 | (add-to-list 'debug-ignored-errors "^Can't shift all lines enough") |
| 771 | 773 | ||
| @@ -782,10 +784,11 @@ lie." | |||
| 782 | (if mark-active | 784 | (if mark-active |
| 783 | (list (region-beginning) (region-end) current-prefix-arg) | 785 | (list (region-beginning) (region-end) current-prefix-arg) |
| 784 | (list (line-beginning-position) (line-end-position) current-prefix-arg))) | 786 | (list (line-beginning-position) (line-end-position) current-prefix-arg))) |
| 785 | (if count | 787 | (let ((deactivate-mark nil)) |
| 786 | (setq count (prefix-numeric-value count)) | 788 | (if count |
| 787 | (setq count python-indent-offset)) | 789 | (setq count (prefix-numeric-value count)) |
| 788 | (indent-rigidly start end count)) | 790 | (setq count python-indent-offset)) |
| 791 | (indent-rigidly start end count))) | ||
| 789 | 792 | ||
| 790 | ;; Directly from Dave Love's python.el | 793 | ;; Directly from Dave Love's python.el |
| 791 | (defun python-indent-electric-colon (arg) | 794 | (defun python-indent-electric-colon (arg) |