[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r111108: * progmodes/python.el (py
From: |
Fabián Ezequiel Gallina |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r111108: * progmodes/python.el (python-nav-end-of-statement): Rewrite in |
Date: |
Mon, 31 Dec 2012 17:58:57 -0300 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111108
fixes bug: http://debbugs.gnu.org/13182
committer: Fabián Ezequiel Gallina <address@hidden>
branch nick: emacs-24
timestamp: Mon 2012-12-31 17:58:57 -0300
message:
* progmodes/python.el (python-nav-end-of-statement): Rewrite in
order to improve efficiency (Based on Daniel Colascione's
<address@hidden> patch).
modified:
lisp/ChangeLog
lisp/progmodes/python.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-12-31 20:13:28 +0000
+++ b/lisp/ChangeLog 2012-12-31 20:58:57 +0000
@@ -1,3 +1,9 @@
+2012-12-31 Fabián Ezequiel Gallina <address@hidden>
+
+ * progmodes/python.el (python-nav-end-of-statement): Rewrite in
+ order to improve efficiency (Based on Daniel Colascione's
+ <address@hidden> patch). (Bug#13182)
+
2012-12-31 Glenn Morris <address@hidden>
* vc/log-edit.el (log-edit-header-contents-regexp): Add doc string.
=== modified file 'lisp/progmodes/python.el'
--- a/lisp/progmodes/python.el 2012-12-31 19:35:57 +0000
+++ b/lisp/progmodes/python.el 2012-12-31 20:58:57 +0000
@@ -1177,16 +1177,27 @@
(forward-line -1))))
(point-marker))
-(defun python-nav-end-of-statement ()
- "Move to end of current statement."
+(defun python-nav-end-of-statement (&optional noend)
+ "Move to end of current statement.
+Optional argument NOEND is internal and makes the logic to not
+jump to the end of line when moving forward searching for the end
+of the statement."
(interactive "^")
- (while (and (goto-char (line-end-position))
- (not (eobp))
- (when (or
- (python-info-line-ends-backslash-p)
- (python-syntax-context 'string)
- (python-syntax-context 'paren))
- (forward-line 1))))
+ (let (string-start bs-pos)
+ (while (and (or noend (goto-char (line-end-position)))
+ (not (eobp))
+ (cond ((setq string-start (python-syntax-context 'string))
+ (goto-char string-start)
+ (python-nav-end-of-statement t))
+ ((python-syntax-context 'paren)
+ ;; The statement won't end before we've escaped
+ ;; at least one level of parenthesis.
+ (condition-case err
+ (goto-char (scan-lists (point) 1 -1))
+ (scan-error (goto-char (nth 3 err)))))
+ ((setq bs-pos (python-info-line-ends-backslash-p))
+ (goto-char bs-pos)
+ (forward-line 1))))))
(point-marker))
(defun python-nav-backward-statement (&optional arg)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-24 r111108: * progmodes/python.el (python-nav-end-of-statement): Rewrite in,
Fabián Ezequiel Gallina <=