mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-02 10:11:05 -08:00
python-end-of-defun-function now works correctly when comments are not indented properly.
Calling `end-of-defun' on a python file will now do the correct thing,
even for cases like this:
def fib(n):
if n < 2:
# base cases
return n
else:
return fib(n - 2) + fib(n - 1)
This commit is contained in:
parent
dc4f2e5326
commit
cd1ed6c8f4
1 changed files with 6 additions and 1 deletions
|
|
@ -1062,7 +1062,12 @@ Returns nil if point is not in a def or class."
|
|||
(while (and (forward-line 1)
|
||||
(not (eobp))
|
||||
(or (not (current-word))
|
||||
(> (current-indentation) beg-defun-indent))))
|
||||
;; This checks if the indentation is less than the base
|
||||
;; one and if the line is not a comment
|
||||
(or (> (current-indentation) beg-defun-indent)
|
||||
(equal
|
||||
(char-after
|
||||
(+ (point) (current-indentation))) ?#)))))
|
||||
(python-util-forward-comment)
|
||||
(goto-char (line-beginning-position))))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue