From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: end-of-defun is fubsr. Date: Tue, 03 Feb 2009 12:13:19 -0500 Message-ID: References: <20090202202703.GB11077@muc.de> <20090203105035.GB1396@muc.de> <20090203122906.GC1396@muc.de> <20090203130028.GD1396@muc.de> <20090203160941.GE1396@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1233681386 28528 80.91.229.12 (3 Feb 2009 17:16:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 3 Feb 2009 17:16:26 +0000 (UTC) Cc: emacs-devel@gnu.org, Miles Bader To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 03 18:17:40 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LUOu1-000891-PM for ged-emacs-devel@m.gmane.org; Tue, 03 Feb 2009 18:17:38 +0100 Original-Received: from localhost ([127.0.0.1]:53426 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LUOsi-0001Gf-KQ for ged-emacs-devel@m.gmane.org; Tue, 03 Feb 2009 12:16:16 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LUOpz-0000II-HM for emacs-devel@gnu.org; Tue, 03 Feb 2009 12:13:27 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LUOpw-0000Gu-Hm for emacs-devel@gnu.org; Tue, 03 Feb 2009 12:13:26 -0500 Original-Received: from [199.232.76.173] (port=41587 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LUOpv-0000Ge-T2 for emacs-devel@gnu.org; Tue, 03 Feb 2009 12:13:24 -0500 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:33545) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LUOpt-0002WE-JY; Tue, 03 Feb 2009 12:13:21 -0500 Original-Received: from alfajor.home (vpn-132-204-232-163.acd.umontreal.ca [132.204.232.163]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id n13HE0XC013236; Tue, 3 Feb 2009 12:14:00 -0500 Original-Received: by alfajor.home (Postfix, from userid 20848) id 61110A22D1; Tue, 3 Feb 2009 12:13:19 -0500 (EST) In-Reply-To: <20090203160941.GE1396@muc.de> (Alan Mackenzie's message of "Tue, 3 Feb 2009 16:09:42 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3202=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:108692 Archived-At: >> > It's occurred to me that my "CVS" version wasn't actually clean. Sorry >> > for not checking this first. I've downloaded a fresh copy of the CVS, >> > and I'm building it at the moment. >> Built. Yes, I get the same thing as you, now. Sorry for messing you >> around. I'll look into it. > end-of-defun (in .../lisp/emacs-lisp/lisp.el) is buggy, at least when an > end-of-defun-function has been defined: > (i) After calling end-of-defun-function, e-o-d takes it upon itself to > advance an arbitrary amount of whitespace/comments. This is what you > (Miles) were complaining about. It should only move from "right after the closing }" to BOL 7. Not "an arbitrary amount of whitespace". Of course, there might be a bug, but my guess is that your end-of-defun-function jumpts to BOL 7 rather than right after the brace. So the problem is a disagreement between the two. > (ii) When point is BETWEEN two C functions (more precisely JUST AFTER > the end of the previous function), C-M-e doesn't move over the next > function. This is because it gets its knickers in a twist, first > calling BOD-raw, then EOD-function, trying to check if its succeeded > yet, etc. ......... This is crazy! This might be linked to the above problem. For Elisp it seems to work correctly. > This mechanism is entirely unsuited to CC Mode. > c-\(beginning\|end\)-of-defun have a very high setup (determining > whether point is within a function's block, or header, etc.) and tear > down (locating the start of a function's header) time, but is lightening > fast zipping through brace blocks in between. This high setup/teardown > time has been the cause of several "it's too slow" bugs (e.g. for C-x 4 > a) in the last few years. > The current implementation of end-of-defun is essentially calling > c-end-of-defun AND c-beginning-of-defun in a loop, sometimes calling > them twice in each iteration. This is slow for large ARG. It's crazy! > To see this, go into buffer.c, and do > C-u 106 C-M-e > . On my box, this takes 20s. By contrast, C-u 106 C-M-a takes about > 0.5s. I don't consider "C-u 106 C-M-e" as a common operation. > Also, the semantics of end-of-defun-function have been completely > changed (specifically, in lisp.el v1.82, 2007-11-26) so that it now has > only a coincidental connection with what its name suggests. Huh? It hasn't completely changed. Some details have changed to make it easier to implement a simple end-of-defun-function, while making sure that end-of-defun behaves consistently. It was mostly a matter of fixing end-of-defun which was completely broken when passed negative arguments. > 1/- end-of-defun-function should be restored to its prior semantics, and > additionally be passed the ARG argument in the same way as BOD-function. Not sure about restoring the previous semantics. But I could agree to the additional ARG argument, which could even let it "take over" (so beginning-of-defun-raw is not called in that case). > 3/- end-of-defun should be restructured along the lines of > beginning-of-defun. I don't think that's a good idea. The main reason is to deal with languages that allow nested functions. Stefan