all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#10797: 24.0.93; end-of-defun goes into infinite mutual recursion with beginning-of-defun-raw at certain conditions
@ 2012-02-12 14:19 Dmitry Gutov
  2012-02-23  8:14 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Gutov @ 2012-02-12 14:19 UTC (permalink / raw
  To: 10797

[-- Attachment #1: Type: text/plain, Size: 6176 bytes --]

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:
<down-mouse-1> <mouse-1> M-x p y t h o n <return> C-y
<up> <up> <up> <home> C-M-e <down> <down> <down> <down>
C-M-e <down-mouse-1> <mouse-1> <home> M-x r e p o r
t <return> e n d - o f - e <backspace> d e f u n <return>
<down-mouse-1> <mouse-1> <help-echo> <down-mouse-1>
<mouse-1> <help-echo> <down-mouse-1> <mouse-1> <help-echo>
<down> <down> <down> <down> <down> <right> <right>
<right> <right> <right> <right> <return> <left> <up>
<left> <left> <left> SPC <left> SPC <return> <down>
<right> <right> <right> <right> <right> <return> <down>
<down> <right> <right> <right> <right> <right> <right>
<right> <right> <return> q <down> <down> <end> <left>
<left> <return> <down-mouse-1> <mouse-1> <down-mouse-1>
<mouse-1> <help-echo> <up> <up> <up> <up> <up> <end>
<backspace> <backspace> <up> <home> <tab> <down> <tab>
<tab> <tab> <tab> <down> <down> <tab> <down> <down>
<tab> <down> <tab> <tab> <tab> <tab> <down> <down>
<down> <return> <tab> <tab> <up> <up> <up> <up> C-M-e
<down> <down> <down> <down> C-M-e <down> <down> <down>
<down> <down> C-M-e <up> <up> <up> <up> C-M-e <down>
<down> <down> M-x r e p o r t <right> <return>

Recent messages:
widget-apply-action: Attempt to perform action on inactive widget
call-interactively: Buffer is read-only: #<buffer *Existing Emacs Bugs*>
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)

[-- Attachment #2: beginning-of-defun-raw-patch.diff --]
[-- Type: text/plain, Size: 657 bytes --]

diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 8c53ad5..4efdc32 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -257,9 +257,8 @@ is called as a function to find the defun's beginning."
        (if (> arg 0)
            (dotimes (i arg)
              (funcall beginning-of-defun-function))
-         ;; Better not call end-of-defun-function directly, in case
-         ;; it's not defined.
-         (end-of-defun (- arg))))))
+	 (dotimes (i (- arg))
+	   (funcall end-of-defun-function))))))
 
    ((or defun-prompt-regexp open-paren-in-column-0-is-defun-start)
     (and (< arg 0) (not (eobp)) (forward-char 1))

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#10797: 24.0.93; end-of-defun goes into infinite mutual recursion with beginning-of-defun-raw at certain conditions
  2012-02-12 14:19 bug#10797: 24.0.93; end-of-defun goes into infinite mutual recursion with beginning-of-defun-raw at certain conditions Dmitry Gutov
@ 2012-02-23  8:14 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2012-02-23  8:14 UTC (permalink / raw
  To: Dmitry Gutov; +Cc: 10797-done

> -         ;; Better not call end-of-defun-function directly, in case
> -         ;; it's not defined.
> -         (end-of-defun (- arg))))))
> +	 (dotimes (i (- arg))
> +	   (funcall end-of-defun-function))))))
 
Looks good, installed,
Thank you,


        Stefan





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-23  8:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-12 14:19 bug#10797: 24.0.93; end-of-defun goes into infinite mutual recursion with beginning-of-defun-raw at certain conditions Dmitry Gutov
2012-02-23  8:14 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.