]> git.eshelyaron.com Git - emacs.git/commitdiff
Added python-nav-sentence-start and python-nav-sentence-end functions
authorFabián Ezequiel Gallina <fgallina@cuca>
Thu, 17 May 2012 03:03:15 +0000 (00:03 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Thu, 17 May 2012 03:03:15 +0000 (00:03 -0300)
lisp/progmodes/python.el

index 860f0859b01865e3972d3f41c2187feaa4a31b1c..aa20c20fae60ecf6d3f96e1999abacf95a756103 100644 (file)
@@ -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)))))
+
 \f
 ;;; Shell integration