diff options
| author | Glenn Morris | 2013-02-21 08:56:49 -0800 |
|---|---|---|
| committer | Glenn Morris | 2013-02-21 08:56:49 -0800 |
| commit | cfbf790d80eaa399afceecd9a6c3e2e76bca59b0 (patch) | |
| tree | b2c7ea684fb8d24d5f51d6959aa38854e335d9b6 /lisp/progmodes/python.el | |
| parent | d20e6e9093f74ce2e435a3dac948df200e767405 (diff) | |
| parent | 62cfd799f17a31188b3cdb9ffbe1421b4e6cba5d (diff) | |
| download | emacs-cfbf790d80eaa399afceecd9a6c3e2e76bca59b0.tar.gz emacs-cfbf790d80eaa399afceecd9a6c3e2e76bca59b0.zip | |
Merge from emacs-24; up to 2012-12-21T07:35:02Z!ueno@gnu.org
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index da56fe70329..f0f67d01845 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -2959,39 +2959,40 @@ not inside a defun." | |||
| 2959 | (type)) | 2959 | (type)) |
| 2960 | (catch 'exit | 2960 | (catch 'exit |
| 2961 | (while (python-nav-beginning-of-defun 1) | 2961 | (while (python-nav-beginning-of-defun 1) |
| 2962 | (when (and | 2962 | (when (save-match-data |
| 2963 | (or (not last-indent) | 2963 | (and |
| 2964 | (< (current-indentation) last-indent)) | 2964 | (or (not last-indent) |
| 2965 | (or | 2965 | (< (current-indentation) last-indent)) |
| 2966 | (and first-run | 2966 | (or |
| 2967 | (and first-run | ||
| 2968 | (save-excursion | ||
| 2969 | ;; If this is the first run, we may add | ||
| 2970 | ;; the current defun at point. | ||
| 2971 | (setq first-run nil) | ||
| 2972 | (goto-char starting-pos) | ||
| 2973 | (python-nav-beginning-of-statement) | ||
| 2974 | (beginning-of-line 1) | ||
| 2975 | (looking-at-p | ||
| 2976 | python-nav-beginning-of-defun-regexp))) | ||
| 2977 | (< starting-pos | ||
| 2967 | (save-excursion | 2978 | (save-excursion |
| 2968 | ;; If this is the first run, we may add | 2979 | (let ((min-indent |
| 2969 | ;; the current defun at point. | 2980 | (+ (current-indentation) |
| 2970 | (setq first-run nil) | 2981 | python-indent-offset))) |
| 2971 | (goto-char starting-pos) | 2982 | (if (< starting-indentation min-indent) |
| 2972 | (python-nav-beginning-of-statement) | 2983 | ;; If the starting indentation is not |
| 2973 | (beginning-of-line 1) | 2984 | ;; within the min defun indent make the |
| 2974 | (looking-at-p | 2985 | ;; check fail. |
| 2975 | python-nav-beginning-of-defun-regexp))) | 2986 | starting-pos |
| 2976 | (< starting-pos | 2987 | ;; Else go to the end of defun and add |
| 2977 | (save-excursion | 2988 | ;; up the current indentation to the |
| 2978 | (let ((min-indent | 2989 | ;; ending position. |
| 2979 | (+ (current-indentation) | 2990 | (python-nav-end-of-defun) |
| 2980 | python-indent-offset))) | 2991 | (+ (point) |
| 2981 | (if (< starting-indentation min-indent) | 2992 | (if (>= (current-indentation) min-indent) |
| 2982 | ;; If the starting indentation is not | 2993 | (1+ (current-indentation)) |
| 2983 | ;; within the min defun indent make the | 2994 | 0))))))))) |
| 2984 | ;; check fail. | 2995 | (save-match-data (setq last-indent (current-indentation))) |
| 2985 | starting-pos | ||
| 2986 | ;; Else go to the end of defun and add | ||
| 2987 | ;; up the current indentation to the | ||
| 2988 | ;; ending position. | ||
| 2989 | (python-nav-end-of-defun) | ||
| 2990 | (+ (point) | ||
| 2991 | (if (>= (current-indentation) min-indent) | ||
| 2992 | (1+ (current-indentation)) | ||
| 2993 | 0)))))))) | ||
| 2994 | (setq last-indent (current-indentation)) | ||
| 2995 | (if (or (not include-type) type) | 2996 | (if (or (not include-type) type) |
| 2996 | (setq names (cons (match-string-no-properties 1) names)) | 2997 | (setq names (cons (match-string-no-properties 1) names)) |
| 2997 | (let ((match (split-string (match-string-no-properties 0)))) | 2998 | (let ((match (split-string (match-string-no-properties 0)))) |