From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel,gmane.emacs.xemacs.beta Subject: Re: simplifying beginning-of-defun Date: Sun, 27 Sep 2009 14:53:41 -0400 Message-ID: References: <4ABE54F9.7090107@online.de> <4ABF3DCB.3060602@online.de> <1254050248.6168.30.camel@projectile.siege-engine.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1254077669 13383 80.91.229.12 (27 Sep 2009 18:54:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 27 Sep 2009 18:54:29 +0000 (UTC) Cc: emacs-devel@gnu.org, Andreas Roehler , XEmacs-Beta@xemacs.org To: eric@siege-engine.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 27 20:54:22 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 1Mrysb-0001ls-Hf for ged-emacs-devel@m.gmane.org; Sun, 27 Sep 2009 20:53:53 +0200 Original-Received: from localhost ([127.0.0.1]:55971 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mrysa-0002qJ-ST for ged-emacs-devel@m.gmane.org; Sun, 27 Sep 2009 14:53:52 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MrysW-0002oT-UO for emacs-devel@gnu.org; Sun, 27 Sep 2009 14:53:48 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MrysS-0002hp-Bb for emacs-devel@gnu.org; Sun, 27 Sep 2009 14:53:48 -0400 Original-Received: from [199.232.76.173] (port=41037 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MrysS-0002hf-8z for emacs-devel@gnu.org; Sun, 27 Sep 2009 14:53:44 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:21540 helo=ironport2-out.pppoe.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MrysR-0000gq-T1 for emacs-devel@gnu.org; Sun, 27 Sep 2009 14:53:44 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtUEAONRv0pFpYq6/2dsb2JhbACBUNBmhB4Fh30 X-IronPort-AV: E=Sophos;i="4.44,461,1249272000"; d="scan'208";a="46674134" Original-Received: from 69-165-138-186.dsl.teksavvy.com (HELO pastel.home) ([69.165.138.186]) by ironport2-out.pppoe.ca with ESMTP; 27 Sep 2009 14:53:42 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id A0D1180C4; Sun, 27 Sep 2009 14:53:41 -0400 (EDT) In-Reply-To: <1254050248.6168.30.camel@projectile.siege-engine.com> (Eric M. Ludlam's message of "Sun, 27 Sep 2009 07:17:28 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:115695 gmane.emacs.xemacs.beta:30588 Archived-At: > I agree with the basic mechanics of what Andreas is providing here, not > any specific feature change involved in the patch. If there were some > function like the -raw functions he proposed that program modes would > use if they wanted exactly that behavior, and a separate interactive > function, then that opens the door for improvements on the interactive > function. We already have beginning-of-defun and beginning-of-defun-raw exactly for these kinds of reasons. > This comes up specifically with CEDET, where I can use parser > information to do a real `beginning-of-defun' for langauges whos defuns > don't happen to start with a ( in the first column. From an interactive > point of view, a total win. So you mean you'd want both beginning-of-defun-raw-function and beginning-of-defun-function (additionally to (define-key map [remap beginning-of-defun] ...), of course)? I'd have to think about it. > From a programs point of view, this would mean disaster if all their > code was expecting the cursor to show up on some opening {, and not on > the text actually starting the defun. For modes like cc-mode that > write their own correct `beginning-of-defun', they would use that > internally anyway, so no loss. So you mean we should provide a default-beginning-of-defun which is not subject to any *-function fiddling and change some of the calls to beginning-of-defun to use that function instead, so they're more robust in cases where something like CEDET sets beginning-of-defun-function? That makes sense, yet. > Right now, the feature I describe in CEDET/Semantic is done with advice > and various if statements making sure not to do the modification in > non-interactive cases. The code is in senator.el. I think that interactive/noninteractive is not the right distinction (there are non-interactive cases which would also benefit from using an improved implementation). It's probably the best (conservative) solution you could use, because the right solution requires more changes to other packages. Stefan