mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-25 23:10:47 -08:00
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.
This commit is contained in:
parent
c43cd8b10f
commit
9f1537ef3e
1 changed files with 14 additions and 0 deletions
|
|
@ -618,6 +618,17 @@ START is the buffer position where the sexp starts."
|
|||
(save-excursion
|
||||
(forward-line -1)
|
||||
(python-info-assignment-continuation-line-p)))
|
||||
(dot-continuation
|
||||
(save-excursion
|
||||
(back-to-indentation)
|
||||
(when (looking-at "\\.")
|
||||
(forward-line -1)
|
||||
(back-to-indentation)
|
||||
(forward-char (length
|
||||
(with-syntax-table python-dotty-syntax-table
|
||||
(current-word))))
|
||||
(re-search-backward "\\." (line-beginning-position) t 1)
|
||||
(current-column))))
|
||||
(indentation (cond (block-continuation
|
||||
(goto-char block-continuation)
|
||||
(re-search-forward
|
||||
|
|
@ -634,6 +645,8 @@ START is the buffer position where the sexp starts."
|
|||
(python-rx (* space))
|
||||
(line-end-position) t)
|
||||
(current-column))
|
||||
(dot-continuation
|
||||
dot-continuation)
|
||||
(t
|
||||
(goto-char context-start)
|
||||
(current-indentation)))))
|
||||
|
|
@ -1956,6 +1969,7 @@ not inside a defun."
|
|||
not-simple-operator)
|
||||
(line-end-position) t)
|
||||
(not (or (python-info-ppss-context 'string)
|
||||
(python-info-ppss-context 'paren)
|
||||
(python-info-ppss-context 'comment))))))
|
||||
(point-marker))))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue