From 3697b5314ae77a50e12972b70f8367d8d3ba7853 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fabi=C3=A1n=20Ezequiel=20Gallina?= Date: Thu, 17 May 2012 00:03:15 -0300 Subject: [PATCH] Added python-nav-sentence-start and python-nav-sentence-end functions --- lisp/progmodes/python.el | 31 +++++++++++++++++++++++-------- 1 file 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." ;; After normal line ((setq start (save-excursion (while (and (forward-comment -1) (not (bobp)))) - (while (and (not (back-to-indentation)) - (not (bobp)) - (if (python-info-ppss-context 'paren) - (forward-line -1) - (if (save-excursion - (forward-line -1) - (python-info-line-ends-backslash-p)) - (forward-line -1))))) + (python-nav-sentence-start) (point-marker))) 'after-line) ;; Do not indent @@ -955,6 +948,28 @@ Returns nil if point is not in a def or class." (forward-comment 1) (goto-char (line-beginning-position)))) +(defun python-nav-sentence-start () + "Move to start of current sentence." + (interactive "^") + (while (and (not (back-to-indentation)) + (not (bobp)) + (when (or + (save-excursion + (forward-line -1) + (python-info-line-ends-backslash-p)) + (python-info-ppss-context 'paren)) + (forward-line -1))))) + +(defun python-nav-sentence-end () + "Move to end of current sentence." + (interactive "^") + (while (and (goto-char (line-end-position)) + (not (eobp)) + (when (or + (python-info-line-ends-backslash-p) + (python-info-ppss-context 'paren)) + (forward-line 1))))) + ;;; Shell integration -- 2.39.5