diff options
| author | Fabián Ezequiel Gallina | 2012-05-17 00:03:08 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2012-05-17 00:03:08 -0300 |
| commit | 9f1537ef3e5e6782edacfacbf9f4396e3ab11bd1 (patch) | |
| tree | db6163a848bd91f753f274cd2843d146daf13cd6 /lisp | |
| parent | c43cd8b10f278195c59fa641dca7670811e7c146 (diff) | |
| download | emacs-9f1537ef3e5e6782edacfacbf9f4396e3ab11bd1.tar.gz emacs-9f1537ef3e5e6782edacfacbf9f4396e3ab11bd1.zip | |
Added indentation support for continuation of dotted expressions
Expressions like these are now supported and indented correctly:
Object.objects.exclude(foo=1)\
.filter(bar=2)\
.values_list('baz')
Also added a small fix to python-info-assignment-continuation-line-p
to check the match for the operator is not inside some paren.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/progmodes/python.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 79ef752c0f2..b745050f551 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -618,6 +618,17 @@ START is the buffer position where the sexp starts." | |||
| 618 | (save-excursion | 618 | (save-excursion |
| 619 | (forward-line -1) | 619 | (forward-line -1) |
| 620 | (python-info-assignment-continuation-line-p))) | 620 | (python-info-assignment-continuation-line-p))) |
| 621 | (dot-continuation | ||
| 622 | (save-excursion | ||
| 623 | (back-to-indentation) | ||
| 624 | (when (looking-at "\\.") | ||
| 625 | (forward-line -1) | ||
| 626 | (back-to-indentation) | ||
| 627 | (forward-char (length | ||
| 628 | (with-syntax-table python-dotty-syntax-table | ||
| 629 | (current-word)))) | ||
| 630 | (re-search-backward "\\." (line-beginning-position) t 1) | ||
| 631 | (current-column)))) | ||
| 621 | (indentation (cond (block-continuation | 632 | (indentation (cond (block-continuation |
| 622 | (goto-char block-continuation) | 633 | (goto-char block-continuation) |
| 623 | (re-search-forward | 634 | (re-search-forward |
| @@ -634,6 +645,8 @@ START is the buffer position where the sexp starts." | |||
| 634 | (python-rx (* space)) | 645 | (python-rx (* space)) |
| 635 | (line-end-position) t) | 646 | (line-end-position) t) |
| 636 | (current-column)) | 647 | (current-column)) |
| 648 | (dot-continuation | ||
| 649 | dot-continuation) | ||
| 637 | (t | 650 | (t |
| 638 | (goto-char context-start) | 651 | (goto-char context-start) |
| 639 | (current-indentation))))) | 652 | (current-indentation))))) |
| @@ -1956,6 +1969,7 @@ not inside a defun." | |||
| 1956 | not-simple-operator) | 1969 | not-simple-operator) |
| 1957 | (line-end-position) t) | 1970 | (line-end-position) t) |
| 1958 | (not (or (python-info-ppss-context 'string) | 1971 | (not (or (python-info-ppss-context 'string) |
| 1972 | (python-info-ppss-context 'paren) | ||
| 1959 | (python-info-ppss-context 'comment)))))) | 1973 | (python-info-ppss-context 'comment)))))) |
| 1960 | (point-marker)))) | 1974 | (point-marker)))) |
| 1961 | 1975 | ||