diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 26dafde7591..50d712ebb0c 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1406,6 +1406,10 @@ keyword | |||
| 1406 | - Point is inside a paren from a block start followed by some | 1406 | - Point is inside a paren from a block start followed by some |
| 1407 | items on the same line. | 1407 | items on the same line. |
| 1408 | - START is the first non space char position *after* the open paren. | 1408 | - START is the first non space char position *after* the open paren. |
| 1409 | :inside-paren-continuation-line | ||
| 1410 | - Point is on a continuation line inside a paren. | ||
| 1411 | - START is the position where the previous line (excluding lines | ||
| 1412 | for inner parens) starts. | ||
| 1409 | 1413 | ||
| 1410 | :after-backslash | 1414 | :after-backslash |
| 1411 | - Fallback case when point is after backslash. | 1415 | - Fallback case when point is after backslash. |
| @@ -1460,7 +1464,21 @@ keyword | |||
| 1460 | (= (line-number-at-pos) | 1464 | (= (line-number-at-pos) |
| 1461 | (progn | 1465 | (progn |
| 1462 | (python-util-forward-comment) | 1466 | (python-util-forward-comment) |
| 1463 | (line-number-at-pos)))))))) | 1467 | (line-number-at-pos))))))) |
| 1468 | (continuation-start | ||
| 1469 | (when start | ||
| 1470 | (save-excursion | ||
| 1471 | (forward-line -1) | ||
| 1472 | (back-to-indentation) | ||
| 1473 | ;; Skip inner parens. | ||
| 1474 | (cl-loop with prev-start = (python-syntax-context 'paren) | ||
| 1475 | while (and prev-start (>= prev-start start)) | ||
| 1476 | if (= prev-start start) | ||
| 1477 | return (point) | ||
| 1478 | else do (goto-char prev-start) | ||
| 1479 | (back-to-indentation) | ||
| 1480 | (setq prev-start | ||
| 1481 | (python-syntax-context 'paren))))))) | ||
| 1464 | (when start | 1482 | (when start |
| 1465 | (cond | 1483 | (cond |
| 1466 | ;; Current line only holds the closing paren. | 1484 | ;; Current line only holds the closing paren. |
| @@ -1476,6 +1494,9 @@ keyword | |||
| 1476 | (back-to-indentation) | 1494 | (back-to-indentation) |
| 1477 | (python-syntax-closing-paren-p)) | 1495 | (python-syntax-closing-paren-p)) |
| 1478 | (cons :inside-paren-at-closing-nested-paren start)) | 1496 | (cons :inside-paren-at-closing-nested-paren start)) |
| 1497 | ;; This line is a continuation of the previous line. | ||
| 1498 | (continuation-start | ||
| 1499 | (cons :inside-paren-continuation-line continuation-start)) | ||
| 1479 | ;; This line starts from an opening block in its own line. | 1500 | ;; This line starts from an opening block in its own line. |
| 1480 | ((save-excursion | 1501 | ((save-excursion |
| 1481 | (goto-char start) | 1502 | (goto-char start) |
| @@ -1591,7 +1612,8 @@ possibilities can be narrowed to specific indentation points." | |||
| 1591 | (`(,(or :after-line | 1612 | (`(,(or :after-line |
| 1592 | :after-comment | 1613 | :after-comment |
| 1593 | :inside-string | 1614 | :inside-string |
| 1594 | :after-backslash) . ,start) | 1615 | :after-backslash |
| 1616 | :inside-paren-continuation-line) . ,start) | ||
| 1595 | ;; Copy previous indentation. | 1617 | ;; Copy previous indentation. |
| 1596 | (goto-char start) | 1618 | (goto-char start) |
| 1597 | (current-indentation)) | 1619 | (current-indentation)) |