From c806ea6e87c11d32840844798a2bd6166d1a72e1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fabi=C3=A1n=20Ezequiel=20Gallina?= Date: Thu, 17 May 2012 00:03:11 -0300 Subject: [PATCH] New variable python-use-beginning-of-innermost-defun Controls if beginning-of-defun function should go to outermost or innermost defun. --- lisp/progmodes/python.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index dc9e091603b..0213a0ec8fb 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -870,6 +870,12 @@ With numeric ARG, just insert that many colons. With ;;; Navigation +(defcustom python-use-beginning-of-innermost-defun nil + "Set if `beginning-of-defun-function' should go to innermost defun." + :type 'string + :group 'python + :safe 'stringp) + (defvar python-beginning-of-defun-regexp "^\\(def\\|class\\)[[:space:]]+[[:word:]]+" "Regular expresion matching beginning of outermost class or function.") @@ -919,8 +925,17 @@ innermost definition." nil)))) (defun python-beginning-of-defun-function () + "Move point to the beginning of \(inner|outer)most def or class. +The point is moved to the beginning of innermost or outermost def +or class given the value of +`python-use-beginning-of-innermost-defun'. Returns nil if point +is not in a def or class." + (python-beginning-of-defun python-use-beginning-of-innermost-defun)) + +(defun python-beginning-of-outermost-defun () "Move point to the beginning of outermost def or class. Returns nil if point is not in a def or class." + (interactive) (python-beginning-of-defun nil)) (defun python-beginning-of-innermost-defun () -- 2.39.5