mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
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.
This commit is contained in:
parent
b15e880041
commit
462973b5ef
1 changed files with 13 additions and 10 deletions
|
|
@ -1052,16 +1052,19 @@ negative do the same but backwards. When NODECORATORS is non-nil
|
|||
decorators are not included. Return non-nil if point is moved to the
|
||||
`beginning-of-defun'."
|
||||
(when (or (null arg) (= arg 0)) (setq arg 1))
|
||||
(if (> arg 0)
|
||||
(dotimes (i arg (python-nav-beginning-of-defun nodecorators)))
|
||||
(let ((found))
|
||||
(dotimes (i (- arg) found)
|
||||
(python-end-of-defun-function)
|
||||
(python-util-forward-comment)
|
||||
(goto-char (line-end-position))
|
||||
(when (not (eobp))
|
||||
(setq found
|
||||
(python-nav-beginning-of-defun nodecorators)))))))
|
||||
(cond ((and (eq this-command 'mark-defun)
|
||||
(looking-at python-nav-beginning-of-defun-regexp)))
|
||||
((> arg 0)
|
||||
(dotimes (i arg (python-nav-beginning-of-defun nodecorators))))
|
||||
(t
|
||||
(let ((found))
|
||||
(dotimes (i (- arg) found)
|
||||
(python-end-of-defun-function)
|
||||
(python-util-forward-comment)
|
||||
(goto-char (line-end-position))
|
||||
(when (not (eobp))
|
||||
(setq found
|
||||
(python-nav-beginning-of-defun nodecorators))))))))
|
||||
|
||||
(defun python-end-of-defun-function ()
|
||||
"Move point to the end of def or class.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue