From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: subword-mode Date: Wed, 25 Nov 2009 08:58:13 +0100 Message-ID: <87638zkpd6.fsf@thinkpad.tsdh.de> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1259135933 32739 80.91.229.12 (25 Nov 2009 07:58:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Nov 2009 07:58:53 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Miles Bader Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 25 08:58:45 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 1NDClu-0006pu-JZ for ged-emacs-devel@m.gmane.org; Wed, 25 Nov 2009 08:58:43 +0100 Original-Received: from localhost ([127.0.0.1]:57603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDClu-0005hK-7S for ged-emacs-devel@m.gmane.org; Wed, 25 Nov 2009 02:58:42 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDCln-0005gz-SI for emacs-devel@gnu.org; Wed, 25 Nov 2009 02:58:35 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDCli-0005dG-Qt for emacs-devel@gnu.org; Wed, 25 Nov 2009 02:58:35 -0500 Original-Received: from [199.232.76.173] (port=49029 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDCli-0005d1-2j for emacs-devel@gnu.org; Wed, 25 Nov 2009 02:58:30 -0500 Original-Received: from mx20.gnu.org ([199.232.41.8]:63659) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NDCle-000665-NC; Wed, 25 Nov 2009 02:58:26 -0500 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NDCld-0005Nz-MA; Wed, 25 Nov 2009 02:58:25 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by deliver.uni-koblenz.de (Postfix) with ESMTP id 6E39B789B93D; Wed, 25 Nov 2009 08:58:24 +0100 (CET) Original-Received: from deliver.uni-koblenz.de ([127.0.0.1]) by localhost (deliver.uni-koblenz.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 27929-07; Wed, 25 Nov 2009 08:58:23 +0100 (CET) X-CHKRCPT: Envelopesender noch tassilo@member.fsf.org Original-Received: from thinkpad.tsdh.de (unknown [141.26.94.95]) by deliver.uni-koblenz.de (Postfix) with ESMTP id B27937810DAA; Wed, 25 Nov 2009 08:58:23 +0100 (CET) Mail-Copies-To: never Mail-Followup-To: Miles Bader , Stefan Monnier , emacs-devel@gnu.org 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-Virus-Scanned: amavisd-new at uni-koblenz.de X-detected-operating-system: by mx20.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:117735 Archived-At: Miles Bader writes: > Stefan Monnier writes: >> 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... > > However.... it doesn't seem to actually work correctly in many cases; > perhaps the low-level feature has bit-rotted? > > E.g.: given the example word in the file "capitalizedWorDD", and turning > on `capitalized-words-mode', moving _backwards_ from the end of the > string with M-b stops at the first "D", then the "W', then the beginning > "c" -- that's correct except that it should have stopped at the second > "D" first. However moving _forwards_ from the beginning with M-f, it > only stops at the second "D". It looks to me that those differences come from the regexps used. cap-words uses those simple ones "\\=.\\w*[[:upper:]]" (forward) "[[:upper:]]\\w*\\=" (backward) and subword uses those more elaborated ones "\\W*\\(\\([[:upper:]]*\\W?\\)[[:lower:][:digit:]]*\\)" (forward) "\\(\\(\\W\\|[[:lower:][:digit:]]\\)\\([[:upper:]]+\\W*\\)\\|\\W\\w+\\)" (backward) Maybe just putting the subword regexps in cap-words.el achieves the desired behavior. If that's the case, then I agree with Miles that the cap-words approach is more elegant. If so, we should rename cap-words.el to subword.el. Additionally, the docs of cap-words need to be polished, because there it seems to be intended to stop at each capital letter, but in general that's not desired. With (the current) subword.el, the stop points are fooBarBAZ ^ ^ ^ ^ which seems correct to me and matches the behavior of Eclipse or IntelliJ. Ah, and of course, I'd volunteer to test and do that changes, although I probably won't do it before the weekend. Bye, Tassilo