diff options
| author | Fabián Ezequiel Gallina | 2012-05-17 00:03:16 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2012-05-17 00:03:16 -0300 |
| commit | 107c2439fa1e48afebe20ed96fc5998011e07484 (patch) | |
| tree | d7f689d1db639b86cf9465a308ba0a131cf6bf7d | |
| parent | 9fff18585a75ad540aedc84b1147a4a327d1dbdf (diff) | |
| download | emacs-107c2439fa1e48afebe20ed96fc5998011e07484.tar.gz emacs-107c2439fa1e48afebe20ed96fc5998011e07484.zip | |
indentation fixes on after backslash
| -rw-r--r-- | lisp/progmodes/python.el | 68 |
1 files changed, 40 insertions, 28 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index b45b22c139c..075aac4c0f5 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -644,33 +644,46 @@ START is the buffer position where the sexp starts." | |||
| 644 | (back-to-indentation) | 644 | (back-to-indentation) |
| 645 | (when (looking-at "\\.") | 645 | (when (looking-at "\\.") |
| 646 | (forward-line -1) | 646 | (forward-line -1) |
| 647 | (back-to-indentation) | 647 | (goto-char (line-end-position)) |
| 648 | (forward-char (length | 648 | (while (and (re-search-backward "\\." (line-beginning-position) t) |
| 649 | (with-syntax-table python-dotty-syntax-table | 649 | (or (python-info-ppss-context 'comment) |
| 650 | (current-word)))) | 650 | (python-info-ppss-context 'string) |
| 651 | (re-search-backward "\\." (line-beginning-position) t 1) | 651 | (python-info-ppss-context 'paren)))) |
| 652 | (current-column)))) | 652 | (if (and (looking-at "\\.") |
| 653 | (indentation (cond (block-continuation | 653 | (not (or (python-info-ppss-context 'comment) |
| 654 | (goto-char block-continuation) | 654 | (python-info-ppss-context 'string) |
| 655 | (re-search-forward | 655 | (python-info-ppss-context 'paren)))) |
| 656 | (python-rx block-start (* space)) | 656 | (current-column) |
| 657 | (line-end-position) t) | 657 | (+ (current-indentation) python-indent-offset))))) |
| 658 | (current-column)) | 658 | (indentation (cond |
| 659 | (assignment-continuation | 659 | (dot-continuation |
| 660 | (goto-char assignment-continuation) | 660 | dot-continuation) |
| 661 | (re-search-forward | 661 | (block-continuation |
| 662 | (python-rx simple-operator) | 662 | (goto-char block-continuation) |
| 663 | (line-end-position) t) | 663 | (re-search-forward |
| 664 | (forward-char 1) | 664 | (python-rx block-start (* space)) |
| 665 | (re-search-forward | 665 | (line-end-position) t) |
| 666 | (python-rx (* space)) | 666 | (current-column)) |
| 667 | (line-end-position) t) | 667 | (assignment-continuation |
| 668 | (current-column)) | 668 | (goto-char assignment-continuation) |
| 669 | (dot-continuation | 669 | (re-search-forward |
| 670 | dot-continuation) | 670 | (python-rx simple-operator) |
| 671 | (t | 671 | (line-end-position) t) |
| 672 | (goto-char context-start) | 672 | (forward-char 1) |
| 673 | (current-indentation))))) | 673 | (re-search-forward |
| 674 | (python-rx (* space)) | ||
| 675 | (line-end-position) t) | ||
| 676 | (current-column)) | ||
| 677 | (t | ||
| 678 | (goto-char context-start) | ||
| 679 | (if (not (member | ||
| 680 | (save-excursion | ||
| 681 | (back-to-indentation) | ||
| 682 | (message (current-word))) | ||
| 683 | '("return" "import" "from"))) | ||
| 684 | (current-indentation) | ||
| 685 | (+ (current-indentation) | ||
| 686 | python-indent-offset)))))) | ||
| 674 | indentation)) | 687 | indentation)) |
| 675 | ('inside-paren | 688 | ('inside-paren |
| 676 | (or (save-excursion | 689 | (or (save-excursion |
| @@ -1003,7 +1016,6 @@ With negative argument, move backward repeatedly to start of sentence." | |||
| 1003 | (forward-line -1) | 1016 | (forward-line -1) |
| 1004 | (setq arg (1+ arg)))) | 1017 | (setq arg (1+ arg)))) |
| 1005 | 1018 | ||
| 1006 | |||
| 1007 | 1019 | ||
| 1008 | ;;; Shell integration | 1020 | ;;; Shell integration |
| 1009 | 1021 | ||