]> git.eshelyaron.com Git - emacs.git/commitdiff
New variable python-use-beginning-of-innermost-defun
authorFabián Ezequiel Gallina <fgallina@cuca>
Thu, 17 May 2012 03:03:11 +0000 (00:03 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Thu, 17 May 2012 03:03:11 +0000 (00:03 -0300)
Controls if beginning-of-defun function should go to outermost or
innermost defun.

lisp/progmodes/python.el

index dc9e091603b51a5290b9fac001a74c95ed21c998..0213a0ec8fb74deffd05d9b8902f4a834594f3f0 100644 (file)
@@ -870,6 +870,12 @@ With numeric ARG, just insert that many colons.  With
 \f
 ;;; 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 ()