From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: What primitive has moved point? Date: Sat, 7 Nov 2009 13:25:37 +0000 Message-ID: <20091107132537.GC5329@muc.de> References: <20091106114853.GA1917@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1257600074 16664 80.91.229.12 (7 Nov 2009 13:21:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 7 Nov 2009 13:21:14 +0000 (UTC) Cc: Richard Stallman , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 07 14:21:07 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 1N6lE3-0005cI-71 for ged-emacs-devel@m.gmane.org; Sat, 07 Nov 2009 14:21:07 +0100 Original-Received: from localhost ([127.0.0.1]:45658 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N6lE2-0000XB-K6 for ged-emacs-devel@m.gmane.org; Sat, 07 Nov 2009 08:21:06 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N6lDv-0000VF-2G for emacs-devel@gnu.org; Sat, 07 Nov 2009 08:20:59 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N6lDq-0000T1-R7 for emacs-devel@gnu.org; Sat, 07 Nov 2009 08:20:58 -0500 Original-Received: from [199.232.76.173] (port=52596 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N6lDq-0000Sy-O3 for emacs-devel@gnu.org; Sat, 07 Nov 2009 08:20:54 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:2106 helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N6lDo-00008v-MW for emacs-devel@gnu.org; Sat, 07 Nov 2009 08:20:53 -0500 Original-Received: (qmail 10513 invoked by uid 3782); 7 Nov 2009 13:20:49 -0000 Original-Received: from acm.muc.de (pD9E534B7.dip.t-dialin.net [217.229.52.183]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Sat, 07 Nov 2009 14:20:48 +0100 Original-Received: (qmail 5934 invoked by uid 1000); 7 Nov 2009 13:25:37 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-operating-system: by monty-python.gnu.org: FreeBSD 4.6-4.9 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:116699 Archived-At: Hi, Stefan! On Fri, Nov 06, 2009 at 10:36:05AM -0500, Stefan Monnier wrote: > > After point has been moved, how can I determine exactly which > > primitive did the moving? > Down this path lies madness. Hmmm. Thinking about it a bit longer, you're probably right. Though, having been maintaining CC Mode for ~8 years, this madness is sadly no longer to be avoided. ;-( > > (possibly by the use of point-entered/left text properties), > ...more madness. These properties were invented by somebody with some use in mind. So they can't be that mad. OK, a quick grep shows they're used in the games, and table.el. > > However, if the user gets to brace B with forward-line (e.g., with C-p) > > I want to leave point well alone. > I think your "feature" will be a misfeature, but if you really really > want to implement it, the sanest way is probably to consider not the > primitive used, but the direction of the movement: remember point in > pre-command-hook, and compare in post-command-hook. Otherwise: wrap all > the relevant primitives (via defadvice, for example) and make them do > what you want. Actually, users have been complaining for a long time about "alternative" parens in branches of #if's not scanning or parsing properly. I WANT TO FIX THIS, difficult though it might be. Maybe this would be a better idea: (i) "Neutralize" the syntactic value of every character inside a #define or each branch of #if/#elseif/#else apart from the favoured one. Do this neutralization by splatting the area with syntax-table text properties, whilst remembering what the "real" properties should be. (ii) Each time point enters such a "splatted" region, restore the properties. Also restore them for the purpose of font locking. (iii) Each time point leaves such a region, splat the properties again. What do you think? > Stefan -- Alan Mackenzie (Nuremberg, Germany).