(defun python-nav-end-of-defun ()
"Move point to the end of def or class.
Returns nil if point is not in a def or class."
- (interactive nil python-mode)
+ (interactive)
(let ((beg-defun-indent)
(beg-pos (point)))
(when (or (python-info-looking-at-beginning-of-defun)
"Navigate to closer defun backward ARG times.
Unlikely `python-nav-beginning-of-defun' this doesn't care about
nested definitions."
- (interactive "^p" python-mode)
+ (interactive "^p")
(python-nav--forward-defun (- (or arg 1))))
(defun python-nav-forward-defun (&optional arg)
"Navigate to closer defun forward ARG times.
Unlikely `python-nav-beginning-of-defun' this doesn't care about
nested definitions."
- (interactive "^p" python-mode)
+ (interactive "^p")
(python-nav--forward-defun (or arg 1)))
(defun python-nav-beginning-of-statement ()
"Move to start of current statement."
- (interactive "^" python-mode)
+ (interactive "^")
(forward-line 0)
(let* ((ppss (syntax-ppss))
(context-point
Optional argument NOEND is internal and makes the logic to not
jump to the end of line when moving forward searching for the end
of the statement."
- (interactive "^" python-mode)
+ (interactive "^")
(let (string-start bs-pos (last-string-end 0))
(while (and (or noend (goto-char (line-end-position)))
(not (eobp))
(defun python-nav-backward-statement (&optional arg)
"Move backward to previous statement.
With ARG, repeat. See `python-nav-forward-statement'."
- (interactive "^p" python-mode)
+ (interactive "^p")
(or arg (setq arg 1))
(python-nav-forward-statement (- arg)))
"Move forward to next statement.
With ARG, repeat. With negative argument, move ARG times
backward to previous statement."
- (interactive "^p" python-mode)
+ (interactive "^p")
(or arg (setq arg 1))
(while (> arg 0)
(python-nav-end-of-statement)
(defun python-nav-beginning-of-block ()
"Move to start of current block."
- (interactive "^" python-mode)
+ (interactive "^")
(let ((starting-pos (point)))
(if (progn
(python-nav-beginning-of-statement)
(defun python-nav-end-of-block ()
"Move to end of current block."
- (interactive "^" python-mode)
+ (interactive "^")
(when (python-nav-beginning-of-block)
(let ((block-indentation (current-indentation)))
(python-nav-end-of-statement)
(defun python-nav-backward-block (&optional arg)
"Move backward to previous block of code.
With ARG, repeat. See `python-nav-forward-block'."
- (interactive "^p" python-mode)
+ (interactive "^p")
(or arg (setq arg 1))
(python-nav-forward-block (- arg)))
"Move forward to next block of code.
With ARG, repeat. With negative argument, move ARG times
backward to previous block."
- (interactive "^p" python-mode)
+ (interactive "^p")
(or arg (setq arg 1))
(let ((block-start-regexp
(python-rx line-start (* whitespace) block-start))
argument SKIP-PARENS-P force sexp motion to ignore parenthesized
expressions when looking at them in either direction (forced to t
in interactive calls)."
- (interactive "^p" python-mode)
+ (interactive "^p")
(or arg (setq arg 1))
;; Do not follow parens on interactive calls. This hack to detect
;; if the function was called interactively copes with the way
argument SKIP-PARENS-P force sexp motion to ignore parenthesized
expressions when looking at them in either direction (forced to t
in interactive calls)."
- (interactive "^p" python-mode)
+ (interactive "^p")
(or arg (setq arg 1))
(python-nav-forward-sexp (- arg) safe skip-parens-p))
backward N times. With optional argument SKIP-PARENS-P force
sexp motion to ignore parenthesized expressions when looking at
them in either direction (forced to t in interactive calls)."
- (interactive "^p" python-mode)
+ (interactive "^p")
(python-nav-forward-sexp arg t skip-parens-p))
(defun python-nav-backward-sexp-safe (&optional arg skip-parens-p)
forward N times. With optional argument SKIP-PARENS-P force sexp
motion to ignore parenthesized expressions when looking at them in
either direction (forced to t in interactive calls)."
- (interactive "^p" python-mode)
+ (interactive "^p")
(python-nav-backward-sexp arg t skip-parens-p))
(defun python-nav--up-list (&optional dir)
With ARG, do this that many times.
A negative argument means move backward but still to a less deep spot.
This command assumes point is not in a string or comment."
- (interactive "^p" python-mode)
+ (interactive "^p")
(or arg (setq arg 1))
(while (> arg 0)
(python-nav--up-list 1)
With ARG, do this that many times.
A negative argument means move forward but still to a less deep spot.
This command assumes point is not in a string or comment."
- (interactive "^p" python-mode)
+ (interactive "^p")
(or arg (setq arg 1))
(python-nav-up-list (- arg)))
"Move point at the beginning the __main__ block.
When \"if __name__ == \\='__main__\\=':\" is found returns its
position, else returns nil."
- (interactive nil python-mode)
+ (interactive)
(let ((point (point))
(found (catch 'found
(goto-char (point-min))