diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 726c0b2d542..3ac871981e4 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -676,12 +676,12 @@ START is the buffer position where the sexp starts." | |||
| 676 | (goto-char (line-beginning-position)) | 676 | (goto-char (line-beginning-position)) |
| 677 | (bobp)) | 677 | (bobp)) |
| 678 | 'no-indent) | 678 | 'no-indent) |
| 679 | ;; Inside a paren | ||
| 680 | ((setq start (python-syntax-context 'paren ppss)) | ||
| 681 | 'inside-paren) | ||
| 682 | ;; Inside string | 679 | ;; Inside string |
| 683 | ((setq start (python-syntax-context 'string ppss)) | 680 | ((setq start (python-syntax-context 'string ppss)) |
| 684 | 'inside-string) | 681 | 'inside-string) |
| 682 | ;; Inside a paren | ||
| 683 | ((setq start (python-syntax-context 'paren ppss)) | ||
| 684 | 'inside-paren) | ||
| 685 | ;; After backslash | 685 | ;; After backslash |
| 686 | ((setq start (when (not (or (python-syntax-context 'string ppss) | 686 | ((setq start (when (not (or (python-syntax-context 'string ppss) |
| 687 | (python-syntax-context 'comment ppss))) | 687 | (python-syntax-context 'comment ppss))) |
| @@ -710,7 +710,7 @@ START is the buffer position where the sexp starts." | |||
| 710 | ;; After normal line | 710 | ;; After normal line |
| 711 | ((setq start (save-excursion | 711 | ((setq start (save-excursion |
| 712 | (back-to-indentation) | 712 | (back-to-indentation) |
| 713 | (python-util-forward-comment -1) | 713 | (skip-chars-backward (rx (or whitespace ?\n))) |
| 714 | (python-nav-beginning-of-statement) | 714 | (python-nav-beginning-of-statement) |
| 715 | (point-marker))) | 715 | (point-marker))) |
| 716 | 'after-line) | 716 | 'after-line) |
| @@ -973,7 +973,16 @@ Called from a program, START and END specify the region to indent." | |||
| 973 | (back-to-indentation) | 973 | (back-to-indentation) |
| 974 | (setq word (current-word)) | 974 | (setq word (current-word)) |
| 975 | (forward-line 1) | 975 | (forward-line 1) |
| 976 | (when word | 976 | (when (and word |
| 977 | ;; Don't mess with strings, unless it's the | ||
| 978 | ;; enclosing set of quotes. | ||
| 979 | (or (not (python-syntax-context 'string)) | ||
| 980 | (eq | ||
| 981 | (syntax-after | ||
| 982 | (+ (1- (point)) | ||
| 983 | (current-indentation) | ||
| 984 | (python-syntax-count-quotes (char-after) (point)))) | ||
| 985 | (string-to-syntax "|")))) | ||
| 977 | (beginning-of-line) | 986 | (beginning-of-line) |
| 978 | (delete-horizontal-space) | 987 | (delete-horizontal-space) |
| 979 | (indent-to (python-indent-calculate-indentation))))) | 988 | (indent-to (python-indent-calculate-indentation))))) |