diff options
author | Fabián Ezequiel Gallina <fgallina@gnu.org> | 2013-12-26 13:45:19 -0300 |
---|---|---|
committer | Fabián Ezequiel Gallina <fgallina@gnu.org> | 2013-12-26 13:45:19 -0300 |
commit | fbcc63a3176389f39cb06f5a56f2abb29b06eaab (patch) | |
tree | 4c9b7d4be4f924bc0352741b7c06d33369d94b9e /lisp | |
parent | 0cbab19e6e5147fda4c89dcadd2826a35857b5ce (diff) | |
download | emacs-fbcc63a3176389f39cb06f5a56f2abb29b06eaab.tar.gz |
* lisp/progmodes/python.el: Use lexical-binding.
(python-nav-beginning-of-defun): Stop searching ASAP.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/progmodes/python.el | 18 |
2 files changed, 14 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 76e175919e4..972106bd26f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-12-26 Fabián Ezequiel Gallina <fgallina@gnu.org> + + * progmodes/python.el: Use lexical-binding. + (python-nav-beginning-of-defun): Stop searching ASAP. + 2013-12-25 Xue Fuqiao <xfq.free@gmail.com> * vc/vc.el (vc-ignore): Use `vc-responsible-backend'. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 0646eade780..688d2cb1d96 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1,4 +1,4 @@ -;;; python.el --- Python's flying circus support for Emacs +;;; python.el --- Python's flying circus support for Emacs -*- lexical-binding: t -*- ;; Copyright (C) 2003-2013 Free Software Foundation, Inc. @@ -180,7 +180,7 @@ ;; Imenu: There are two index building functions to be used as ;; `imenu-create-index-function': `python-imenu-create-index' (the ;; default one, builds the alist in form of a tree) and -;; `python-imenu-create-flat-index'. See also +;; `python-imenu-create-flat-index'. See also ;; `python-imenu-format-item-label-function', ;; `python-imenu-format-parent-item-label-function', ;; `python-imenu-format-parent-item-jump-label-function' variables for @@ -1183,13 +1183,13 @@ position. Return non-nil if point is moved to `beginning-of-defun'." (when (or (null arg) (= arg 0)) (setq arg 1)) (let ((found)) - (cond ((and (eq this-command 'mark-defun) - (python-info-looking-at-beginning-of-defun))) - (t - (dotimes (i (if (> arg 0) arg (- arg))) - (when (and (python-nav--beginning-of-defun arg) - (not found)) - (setq found t))))) + (while (and (not (= arg 0)) + (let ((keep-searching-p + (python-nav--beginning-of-defun arg))) + (when (and keep-searching-p (null found)) + (setq found t)) + keep-searching-p)) + (setq arg (if (> arg 0) (1- arg) (1+ arg)))) found)) (defun python-nav-end-of-defun () |