diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 669da135644..33039a4d087 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -686,6 +686,8 @@ Context information is returned with a cons with the form: | |||
| 686 | \(STATUS . START) | 686 | \(STATUS . START) |
| 687 | 687 | ||
| 688 | Where status can be any of the following symbols: | 688 | Where status can be any of the following symbols: |
| 689 | |||
| 690 | * after-comment: When current line might continue a comment block | ||
| 689 | * inside-paren: If point in between (), {} or [] | 691 | * inside-paren: If point in between (), {} or [] |
| 690 | * inside-string: If point is inside a string | 692 | * inside-string: If point is inside a string |
| 691 | * after-backslash: Previous line ends in a backslash | 693 | * after-backslash: Previous line ends in a backslash |
| @@ -704,6 +706,17 @@ START is the buffer position where the sexp starts." | |||
| 704 | (goto-char (line-beginning-position)) | 706 | (goto-char (line-beginning-position)) |
| 705 | (bobp)) | 707 | (bobp)) |
| 706 | 'no-indent) | 708 | 'no-indent) |
| 709 | ;; Comment continuation | ||
| 710 | ((save-excursion | ||
| 711 | (when (and | ||
| 712 | (or | ||
| 713 | (python-info-current-line-comment-p) | ||
| 714 | (python-info-current-line-empty-p)) | ||
| 715 | (progn | ||
| 716 | (forward-comment -1) | ||
| 717 | (python-info-current-line-comment-p))) | ||
| 718 | (setq start (point)) | ||
| 719 | 'after-comment))) | ||
| 707 | ;; Inside string | 720 | ;; Inside string |
| 708 | ((setq start (python-syntax-context 'string ppss)) | 721 | ((setq start (python-syntax-context 'string ppss)) |
| 709 | 'inside-string) | 722 | 'inside-string) |
| @@ -755,6 +768,9 @@ START is the buffer position where the sexp starts." | |||
| 755 | (save-excursion | 768 | (save-excursion |
| 756 | (pcase context-status | 769 | (pcase context-status |
| 757 | (`no-indent 0) | 770 | (`no-indent 0) |
| 771 | (`after-comment | ||
| 772 | (goto-char context-start) | ||
| 773 | (current-indentation)) | ||
| 758 | ;; When point is after beginning of block just add one level | 774 | ;; When point is after beginning of block just add one level |
| 759 | ;; of indentation relative to the context-start | 775 | ;; of indentation relative to the context-start |
| 760 | (`after-beginning-of-block | 776 | (`after-beginning-of-block |