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: subword-mode Date: Wed, 25 Nov 2009 09:19:25 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1259159210 8803 80.91.229.12 (25 Nov 2009 14:26:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Nov 2009 14:26:50 +0000 (UTC) Cc: emacs-devel@gnu.org To: Miles Bader Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 25 15:26:43 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 1NDIpO-0000KG-Ib for ged-emacs-devel@m.gmane.org; Wed, 25 Nov 2009 15:26:42 +0100 Original-Received: from localhost ([127.0.0.1]:41310 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDIpO-0002hc-0U for ged-emacs-devel@m.gmane.org; Wed, 25 Nov 2009 09:26:42 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDIiX-0003P3-Gq for emacs-devel@gnu.org; Wed, 25 Nov 2009 09:19:37 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDIiS-0003MD-DF for emacs-devel@gnu.org; Wed, 25 Nov 2009 09:19:36 -0500 Original-Received: from [199.232.76.173] (port=56241 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDIiS-0003M4-1c for emacs-devel@gnu.org; Wed, 25 Nov 2009 09:19:32 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:14622 helo=ironport2-out.pppoe.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NDIiQ-0001VJ-KS; Wed, 25 Nov 2009 09:19:30 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvYEAGzLDEtFpYc//2dsb2JhbACBTdQvhDIEihY X-IronPort-AV: E=Sophos;i="4.47,286,1257138000"; d="scan'208";a="49988716" Original-Received: from 69-165-135-63.dsl.teksavvy.com (HELO pastel.home) ([69.165.135.63]) by ironport2-out.pppoe.ca with ESMTP; 25 Nov 2009 09:19:26 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id B2FA280E3; Wed, 25 Nov 2009 09:19:25 -0500 (EST) In-Reply-To: (Miles Bader's message of "Wed, 25 Nov 2009 14:22:27 +0900") 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:117742 Archived-At: >> I just bumped into find-word-boundary-function-table, which lead me to >> its only user: cap-words.el. >> It seems both subword.el and cap-words.el provide the same feature (tho >> cap-words.el is obviously not good at advertising itself, ahem). > Given that it's only about 3 lines long, and apparently works by taking > advantage of some existing low-level mechanism, cap-words.el seems by > far the more elegant implementation... Of course, it also has its disadvantages: - the mechanism was not pre-existing (i.e. the implementation of cap-words.el included a patch to syntax.c to add the relevant hook). - because it operates at a low level it sometimes does more than one asks for: e.g. since abbrevs are defined by default as "words", it means that "FooBar" cannot be an abbrev without extra work. BTW, looking at both subword and cap-words I'm surpried at the use of 2 completely separate regexps when going forward and backward. I'd expect the use of a regexp like "\\([[:lower:]]\\)[[:upper:][:digit:]]" where (match-end 1) says where to stop and that should work in either direction. That can be combined with "\\<" or "\\>" depending on the direction, (although I'd actually prefer using forward-word to find that boundary, so it also obeys script boundaries). Stefan