From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#10797: 24.0.93; end-of-defun goes into infinite mutual recursion with beginning-of-defun-raw at certain conditions Date: Sun, 12 Feb 2012 18:19:22 +0400 Message-ID: <4F37CA6A.8040808@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040305010706000908020705" X-Trace: dough.gmane.org 1329056448 21713 80.91.229.3 (12 Feb 2012 14:20:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 12 Feb 2012 14:20:48 +0000 (UTC) To: 10797@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Feb 12 15:20:47 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RwaIH-0000kT-MD for geb-bug-gnu-emacs@m.gmane.org; Sun, 12 Feb 2012 15:20:45 +0100 Original-Received: from localhost ([::1]:47881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwaIG-0007z0-Qy for geb-bug-gnu-emacs@m.gmane.org; Sun, 12 Feb 2012 09:20:44 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:45426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwaIB-0007yv-VD for bug-gnu-emacs@gnu.org; Sun, 12 Feb 2012 09:20:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RwaI9-0000kb-Hz for bug-gnu-emacs@gnu.org; Sun, 12 Feb 2012 09:20:39 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33278) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwaI9-0000kX-Ex for bug-gnu-emacs@gnu.org; Sun, 12 Feb 2012 09:20:37 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1RwaJW-0005Tp-1Z for bug-gnu-emacs@gnu.org; Sun, 12 Feb 2012 09:22:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Feb 2012 14:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 10797 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.132905646920998 (code B ref -1); Sun, 12 Feb 2012 14:22:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Feb 2012 14:21:09 +0000 Original-Received: from localhost ([127.0.0.1]:36896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RwaId-0005Sb-Fz for submit@debbugs.gnu.org; Sun, 12 Feb 2012 09:21:08 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:49702) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RwaIW-0005Ro-3n for submit@debbugs.gnu.org; Sun, 12 Feb 2012 09:21:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RwaH2-0000Uk-Sd for submit@debbugs.gnu.org; Sun, 12 Feb 2012 09:19:30 -0500 Original-Received: from lists.gnu.org ([140.186.70.17]:48900) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwaH2-0000Ug-N5 for submit@debbugs.gnu.org; Sun, 12 Feb 2012 09:19:28 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:45124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwaH1-0007re-4s for bug-gnu-emacs@gnu.org; Sun, 12 Feb 2012 09:19:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RwaGz-0000U6-C4 for bug-gnu-emacs@gnu.org; Sun, 12 Feb 2012 09:19:27 -0500 Original-Received: from forward16.mail.yandex.net ([95.108.253.141]:48364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwaGy-0000Ty-QA for bug-gnu-emacs@gnu.org; Sun, 12 Feb 2012 09:19:25 -0500 Original-Received: from smtp17.mail.yandex.net (smtp17.mail.yandex.net [95.108.252.17]) by forward16.mail.yandex.net (Yandex) with ESMTP id 53C6DD20DE9 for ; Sun, 12 Feb 2012 18:19:22 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1329056362; bh=HL8FUwbwhMPrMv8vBLAO7JL4HGTzHxLd/S8Nd8mgpcA=; h=Message-ID:Date:From:MIME-Version:To:Subject:Content-Type; b=cFcZsmlAxsyjgRor46jBZEAtmRoffUAhctsYKt2dO9NEYjs0LyLpRRNvIUu07iEvG jXOIE2/cM2d1sFyYvUpJyz8rguXvRzlp+EvpZp/5KakIL3Dvf09GwqTiLwb3r/sTWj uPszsPvaAjrDS2wkFsFlJF1mhQcymrLhFvHOPMbY= Original-Received: from smtp17.mail.yandex.net (localhost [127.0.0.1]) by smtp17.mail.yandex.net (Yandex) with ESMTP id 398521900018 for ; Sun, 12 Feb 2012 18:19:22 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1329056362; bh=HL8FUwbwhMPrMv8vBLAO7JL4HGTzHxLd/S8Nd8mgpcA=; h=Message-ID:Date:From:MIME-Version:To:Subject:Content-Type; b=cFcZsmlAxsyjgRor46jBZEAtmRoffUAhctsYKt2dO9NEYjs0LyLpRRNvIUu07iEvG jXOIE2/cM2d1sFyYvUpJyz8rguXvRzlp+EvpZp/5KakIL3Dvf09GwqTiLwb3r/sTWj uPszsPvaAjrDS2wkFsFlJF1mhQcymrLhFvHOPMbY= Original-Received: from 98-87.nwlink.spb.ru (98-87.nwlink.spb.ru [178.252.98.87]) by smtp17.mail.yandex.net (nwsmtp/Yandex) with ESMTP id JLNGc7kN-JLNqheXE; Sun, 12 Feb 2012 18:19:21 +0400 X-Yandex-Spam: 1 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:56829 Archived-At: This is a multi-part message in MIME format. --------------040305010706000908020705 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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) --------------040305010706000908020705 Content-Type: text/plain; name="beginning-of-defun-raw-patch.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="beginning-of-defun-raw-patch.diff" 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)) --------------040305010706000908020705--