diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index e549c477233..4e9c045d184 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -990,19 +990,16 @@ This function is intended to be added to the | |||
| 990 | adding a char before it, the line will be re-indented | 990 | adding a char before it, the line will be re-indented |
| 991 | automatically if needed." | 991 | automatically if needed." |
| 992 | (when (and (eq (char-before) last-command-event) | 992 | (when (and (eq (char-before) last-command-event) |
| 993 | (= (current-indentation) 0) | ||
| 994 | (not (bolp)) | 993 | (not (bolp)) |
| 995 | (memq (char-after) '(?\) ?\] ?\}))) | 994 | (memq (char-after) '(?\) ?\] ?\}))) |
| 996 | (let ((indentation (save-excursion | 995 | (save-excursion |
| 997 | ;; If after going to the beginning of line the point | 996 | (goto-char (line-beginning-position)) |
| 998 | ;; is still inside a paren it's ok to do the trick | 997 | ;; If after going to the beginning of line the point |
| 999 | (goto-char (line-beginning-position)) | 998 | ;; is still inside a paren it's ok to do the trick |
| 1000 | (when (python-info-ppss-context 'paren) | 999 | (when (python-info-ppss-context 'paren) |
| 1001 | (python-indent-calculate-indentation))))) | 1000 | (let ((indentation (python-indent-calculate-indentation))) |
| 1002 | (when (and indentation | 1001 | (when (< (current-indentation) indentation) |
| 1003 | (< (current-indentation) indentation)) | 1002 | (indent-line-to indentation))))))) |
| 1004 | (save-excursion | ||
| 1005 | (indent-line-to indentation)))))) | ||
| 1006 | 1003 | ||
| 1007 | 1004 | ||
| 1008 | ;;; Navigation | 1005 | ;;; Navigation |