From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Eric M. Ludlam" Newsgroups: gmane.emacs.devel,gmane.emacs.xemacs.beta Subject: Re: simplifying beginning-of-defun Date: Sun, 27 Sep 2009 22:04:48 -0400 Message-ID: <1254103488.6168.152.camel@projectile.siege-engine.com> References: <4ABE54F9.7090107@online.de> <4ABF3DCB.3060602@online.de> <1254050248.6168.30.camel@projectile.siege-engine.com> <1254082041.6168.65.camel@projectile.siege-engine.com> Reply-To: eric@siege-engine.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1254103495 9315 80.91.229.12 (28 Sep 2009 02:04:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 28 Sep 2009 02:04:55 +0000 (UTC) Cc: emacs-devel@gnu.org, Andreas Roehler , XEmacs-Beta@xemacs.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 28 04:04:48 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 1Ms5bc-00051U-4H for ged-emacs-devel@m.gmane.org; Mon, 28 Sep 2009 04:04:48 +0200 Original-Received: from localhost ([127.0.0.1]:50496 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ms5bb-0002JV-P9 for ged-emacs-devel@m.gmane.org; Sun, 27 Sep 2009 22:04:47 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ms5bW-0002JG-EE for emacs-devel@gnu.org; Sun, 27 Sep 2009 22:04:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ms5bV-0002J3-Ah for emacs-devel@gnu.org; Sun, 27 Sep 2009 22:04:41 -0400 Original-Received: from [199.232.76.173] (port=44890 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ms5bV-0002J0-71 for emacs-devel@gnu.org; Sun, 27 Sep 2009 22:04:41 -0400 Original-Received: from static-71-184-83-10.bstnma.fios.verizon.net ([71.184.83.10]:33249 helo=projectile.siege-engine.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ms5bU-0007Tm-NO for emacs-devel@gnu.org; Sun, 27 Sep 2009 22:04:40 -0400 Original-Received: from projectile.siege-engine.com (localhost [127.0.0.1]) by projectile.siege-engine.com (8.14.3/8.14.3/Debian-6) with ESMTP id n8S24ofO005301; Sun, 27 Sep 2009 22:04:50 -0400 Original-Received: (from zappo@localhost) by projectile.siege-engine.com (8.14.3/8.14.3/Submit) id n8S24nYS005300; Sun, 27 Sep 2009 22:04:49 -0400 X-Authentication-Warning: projectile.siege-engine.com: zappo set sender to eric@siege-engine.com using -f In-Reply-To: X-Mailer: Evolution 2.26.1 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:115706 gmane.emacs.xemacs.beta:30593 Archived-At: On Sun, 2009-09-27 at 18:52 -0400, Stefan Monnier wrote: > > > I think there are these variants: > > > * A program wants the default behavior > > * A major mode wants to change the interactive form > > * A program wants use the major-mode behavior > > * A third tool (ie - cedet) wants to change the interactive forms > > without breaking the above three, and without modifying the global map > > I can't think of a reason why #3 wouldn't want to be affected by #4. > Note that for #2, it's not just the interactive form, since it also > affects #3 (e.g. mark-defun, send-defun-to-inferior-process, younameit, > ...). Hmmm. A dilemma. Given this C code: int main() { return 0; } The original beginning-of-defun stops at the {. (ie, if you unset beginning-of-defun-function). The c variant knows to stop at the i in int. CEDET also knows to stop at the i in int. In effect, cc-mode, and CEDET agree. It doesn't matter who takes over beginning-of-defun duty. In this C++ example: namespace foo { int myfcn() { return 1; } } If the cursor is on the "return", beginning-of-defun-raw gets completely lost, cc-mode jumps to namespace, and CEDET jumps to the i in int. For the range of interactive fcns you mentioned above, when used interactively, the CEDET behavior is preferred. Within cc-mode, it likely needs to land on the namespace line because that is what it historically has done. The base behavior, of course, is not really desirable. Sure, a user could re-indent their code, but that is not always an option. Of course, perhaps I am wrong in thinking that stopping on 'int' is preferred, but I do know it is preferred by me. Would this make the CEDET behavior as found in 'senator' completely new in some way? > > I think of CEDET as being able to 'glitz' up functions like > > beginning-of-defun by making them accurate. Programs that actually want > > to use CEDET to get the more accurate behavior will not use > > 'beginning-of-defun' at all. > > What about programs that want to use CEDET but that also want to work > when CEDET is not available? They would most likely want to use > beginning-of-defun. I had not contemplated this in the context of beginning-of-defun. Ideally they would not need some if statement to deal with the issue. Of course, the need here would be pretty basic stuff too if it was robust to the actual landing place being different for different situations, sort of the way narrow-to-defun might not care exactly where it lands, so long as it goes somewhere. Eric