Main condition: the beginning-of-defun-function must not take an argument. So the "compatibility" path at `beginning-of-defun-raw' is taken (lines 256-262). If point is at such position in buffer that (progn (funcall 'beginning-of-defun-function) (funcall 'end-of-defun-function)) doesn't move it lower in the buffer, then the (end-of-defun (- arg)) call in `beginning-of-defun-raw' eventually results in "Lisp nesting exceeds `max-lisp-eval-depth'". Example (the buffer must be in python-mode): def abc: return .a = 2 def cde: return The point is at the position denoted by ".". After pressing C-M-e, I reliably see the error message above. Same thing if I move the point forward one line. Patch attached. By the way, that comment was wrong (see patch) - `end-of-defun' doesn't check whether end-of-defun-function is defined, and fails if it's not. In GNU Emacs 24.0.93.1 (i386-mingw-nt6.1.7601) of 2012-02-09 on SOL Windowing system distributor `Microsoft Corp.', version 6.1.7601 Configured using: `configure --with-gcc (3.4) --cflags -IH:/Apps/System/gnuwin32/include' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: RU value of $XMODIFIERS: nil locale-coding-system: cp1251 default enable-multibyte-characters: t Major mode: Python Minor modes in effect: subword-mode: t hl-line-mode: t global-auto-revert-mode: t cua-mode: t global-auto-complete-mode: t auto-complete-mode: t autopair-mode: t autopair-global-mode: t yas/global-mode: t yas/minor-mode: t ido-ubiquitous-mode: t ido-everywhere: t show-paren-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: M-x p y t h o n C-y C-M-e C-M-e M-x r e p o r t e n d - o f - e d e f u n SPC SPC q C-M-e C-M-e C-M-e C-M-e M-x r e p o r t Recent messages: widget-apply-action: Attempt to perform action on inactive widget call-interactively: Buffer is read-only: # Sole indentation [6 times] byte-code: End of buffer [3 times] Sole indentation Mark set [198 times] syntax-ppss: Lisp nesting exceeds `max-lisp-eval-depth' Mark set [198 times] syntax-ppss: Lisp nesting exceeds `max-lisp-eval-depth' Mark set [199 times] syntax-ppss: Lisp nesting exceeds `max-lisp-eval-depth' Load-path shadows: None found. Features: (shadow sort flyspell ispell mail-extr message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader browse-url wid-edit mail-utils url-cache network-stream starttls url-http tls mail-parse rfc2231 rfc2047 rfc2045 ietf-drums url-gw url-auth url url-proxy url-privacy url-expand url-methods url-history url-cookie url-util url-parse auth-source eieio byte-opt bytecomp byte-compile cconv macroexp gnus-util password-cache url-vars mm-util mail-prsvr mailcap emacsbug subword python-21 python ansi-color comint elisp-slime-nav etags paredit hl-line saveplace autorevert cua-base winner .emacs-loaddefs server devenv switch-window quail point-stack pos-tip ac-slime auto-complete-config auto-complete popup eproject-extras ibuf-ext ibuffer iswitchb eproject esh-var esh-io esh-cmd esh-ext esh-proc esh-arg eldoc esh-groups eshell esh-module esh-mode esh-util progmodes mmm rhtml-sgml-hacks rhtml-ruby-hook ruby-mode sgml-mode rhtml-erb mmm-auto mmm-vars mmm-compat regexp-opt ecb-autoloads autopair yasnippet-bundle dropdown-list yasnippet derived easy-mmode help-mode view easymenu assoc keys winring ring transpose-frame iflipb redo+ misc prefs defuns eldoc-eval-autoloads findr-autoloads gist-autoloads highlight-symbol-autoloads inf-ruby-autoloads inflections-autoloads move-text-autoloads ruby-electric-autoloads starter-kit-bindings-autoloads windmove starter-kit-lisp-autoloads elisp-slime-nav-autoloads starter-kit-autoloads edmacro kmacro smex cl starter-kit-misc ido-ubiquitous ido paren starter-kit-defuns uniquify advice help-fns advice-preload magit-autoloads ido-ubiquitous-autoloads smex-autoloads find-file-in-project-autoloads idle-highlight-mode-autoloads paredit-autoloads switch-window-autoloads yaml-mode-autoloads package tabulated-list time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel dos-w32 disp-table ls-lisp w32-win w32-vars tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer button faces cus-face files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process multi-tty emacs)