From: Fabián Ezequiel Gallina Date: Thu, 17 May 2012 03:03:15 +0000 (-0300) Subject: Added python-nav-sentence-start and python-nav-sentence-end functions X-Git-Tag: emacs-24.2.90~1199^2~566 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3697b5314ae77a50e12972b70f8367d8d3ba7853;p=emacs.git Added python-nav-sentence-start and python-nav-sentence-end functions --- 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