aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el31
1 files changed, 23 insertions, 8 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 860f0859b01..aa20c20fae6 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -590,14 +590,7 @@ START is the buffer position where the sexp starts."
590 ;; After normal line 590 ;; After normal line
591 ((setq start (save-excursion 591 ((setq start (save-excursion
592 (while (and (forward-comment -1) (not (bobp)))) 592 (while (and (forward-comment -1) (not (bobp))))
593 (while (and (not (back-to-indentation)) 593 (python-nav-sentence-start)
594 (not (bobp))
595 (if (python-info-ppss-context 'paren)
596 (forward-line -1)
597 (if (save-excursion
598 (forward-line -1)
599 (python-info-line-ends-backslash-p))
600 (forward-line -1)))))
601 (point-marker))) 594 (point-marker)))
602 'after-line) 595 'after-line)
603 ;; Do not indent 596 ;; Do not indent
@@ -955,6 +948,28 @@ Returns nil if point is not in a def or class."
955 (forward-comment 1) 948 (forward-comment 1)
956 (goto-char (line-beginning-position)))) 949 (goto-char (line-beginning-position))))
957 950
951(defun python-nav-sentence-start ()
952 "Move to start of current sentence."
953 (interactive "^")
954 (while (and (not (back-to-indentation))
955 (not (bobp))
956 (when (or
957 (save-excursion
958 (forward-line -1)
959 (python-info-line-ends-backslash-p))
960 (python-info-ppss-context 'paren))
961 (forward-line -1)))))
962
963(defun python-nav-sentence-end ()
964 "Move to end of current sentence."
965 (interactive "^")
966 (while (and (goto-char (line-end-position))
967 (not (eobp))
968 (when (or
969 (python-info-line-ends-backslash-p)
970 (python-info-ppss-context 'paren))
971 (forward-line 1)))))
972
958 973
959;;; Shell integration 974;;; Shell integration
960 975