aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2012-12-31 17:58:57 -0300
committerFabián Ezequiel Gallina2012-12-31 17:58:57 -0300
commit6861432ebdc503bbf0f8886679d169c16060626b (patch)
treec0cb33275d2f49bc8680ce32a5be361a107dfa0f
parent08f592198a56f227b7ba5269910578990f722932 (diff)
downloademacs-6861432ebdc503bbf0f8886679d169c16060626b.tar.gz
emacs-6861432ebdc503bbf0f8886679d169c16060626b.zip
* progmodes/python.el (python-nav-end-of-statement): Rewrite in
order to improve efficiency (Based on Daniel Colascione's <dancol@dancol.org> patch). Fixes: debbugs:13182
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/progmodes/python.el29
2 files changed, 26 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e910b2cc502..a62a9cdb188 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12012-12-31 Fabián Ezequiel Gallina <fgallina@cuca>
2
3 * progmodes/python.el (python-nav-end-of-statement): Rewrite in
4 order to improve efficiency (Based on Daniel Colascione's
5 <dancol@dancol.org> patch). (Bug#13182)
6
12012-12-31 Glenn Morris <rgm@gnu.org> 72012-12-31 Glenn Morris <rgm@gnu.org>
2 8
3 * vc/log-edit.el (log-edit-header-contents-regexp): Add doc string. 9 * vc/log-edit.el (log-edit-header-contents-regexp): Add doc string.
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 90e0d604217..c168b3813ff 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1177,16 +1177,27 @@ Returns nil if point is not in a def or class."
1177 (forward-line -1)))) 1177 (forward-line -1))))
1178 (point-marker)) 1178 (point-marker))
1179 1179
1180(defun python-nav-end-of-statement () 1180(defun python-nav-end-of-statement (&optional noend)
1181 "Move to end of current statement." 1181 "Move to end of current statement.
1182Optional argument NOEND is internal and makes the logic to not
1183jump to the end of line when moving forward searching for the end
1184of the statement."
1182 (interactive "^") 1185 (interactive "^")
1183 (while (and (goto-char (line-end-position)) 1186 (let (string-start bs-pos)
1184 (not (eobp)) 1187 (while (and (or noend (goto-char (line-end-position)))
1185 (when (or 1188 (not (eobp))
1186 (python-info-line-ends-backslash-p) 1189 (cond ((setq string-start (python-syntax-context 'string))
1187 (python-syntax-context 'string) 1190 (goto-char string-start)
1188 (python-syntax-context 'paren)) 1191 (python-nav-end-of-statement t))
1189 (forward-line 1)))) 1192 ((python-syntax-context 'paren)
1193 ;; The statement won't end before we've escaped
1194 ;; at least one level of parenthesis.
1195 (condition-case err
1196 (goto-char (scan-lists (point) 1 -1))
1197 (scan-error (goto-char (nth 3 err)))))
1198 ((setq bs-pos (python-info-line-ends-backslash-p))
1199 (goto-char bs-pos)
1200 (forward-line 1))))))
1190 (point-marker)) 1201 (point-marker))
1191 1202
1192(defun python-nav-backward-statement (&optional arg) 1203(defun python-nav-backward-statement (&optional arg)