diff options
| author | Fabián Ezequiel Gallina | 2012-05-17 00:03:43 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2012-05-17 00:03:43 -0300 |
| commit | 462973b5ef2bdb31392ec8a87ea23d5501059db2 (patch) | |
| tree | 196fd8e49ef928431363fb1f2886a89f525a8ef1 /lisp/progmodes | |
| parent | b15e880041f5aacb12de0959c79d60e6065188fd (diff) | |
| download | emacs-462973b5ef2bdb31392ec8a87ea23d5501059db2.tar.gz emacs-462973b5ef2bdb31392ec8a87ea23d5501059db2.zip | |
Enhancements on `python-beginning-of-defun-function' for `mark-defun' behavior.
`mark-defun' was failing when point was right at the start of a defun.
Diffstat (limited to 'lisp/progmodes')
| -rw-r--r-- | lisp/progmodes/python.el | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 4654143a160..1279c38b68b 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1052,16 +1052,19 @@ negative do the same but backwards. When NODECORATORS is non-nil | |||
| 1052 | decorators are not included. Return non-nil if point is moved to the | 1052 | decorators are not included. Return non-nil if point is moved to the |
| 1053 | `beginning-of-defun'." | 1053 | `beginning-of-defun'." |
| 1054 | (when (or (null arg) (= arg 0)) (setq arg 1)) | 1054 | (when (or (null arg) (= arg 0)) (setq arg 1)) |
| 1055 | (if (> arg 0) | 1055 | (cond ((and (eq this-command 'mark-defun) |
| 1056 | (dotimes (i arg (python-nav-beginning-of-defun nodecorators))) | 1056 | (looking-at python-nav-beginning-of-defun-regexp))) |
| 1057 | (let ((found)) | 1057 | ((> arg 0) |
| 1058 | (dotimes (i (- arg) found) | 1058 | (dotimes (i arg (python-nav-beginning-of-defun nodecorators)))) |
| 1059 | (python-end-of-defun-function) | 1059 | (t |
| 1060 | (python-util-forward-comment) | 1060 | (let ((found)) |
| 1061 | (goto-char (line-end-position)) | 1061 | (dotimes (i (- arg) found) |
| 1062 | (when (not (eobp)) | 1062 | (python-end-of-defun-function) |
| 1063 | (setq found | 1063 | (python-util-forward-comment) |
| 1064 | (python-nav-beginning-of-defun nodecorators))))))) | 1064 | (goto-char (line-end-position)) |
| 1065 | (when (not (eobp)) | ||
| 1066 | (setq found | ||
| 1067 | (python-nav-beginning-of-defun nodecorators)))))))) | ||
| 1065 | 1068 | ||
| 1066 | (defun python-end-of-defun-function () | 1069 | (defun python-end-of-defun-function () |
| 1067 | "Move point to the end of def or class. | 1070 | "Move point to the end of def or class. |