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: Rethinking count-words-region Date: Fri, 7 Oct 2011 20:55:23 +0000 Message-ID: <20111007205523.GI2830@acm.acm> References: <87vcs0q05l.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1318021202 24302 80.91.229.12 (7 Oct 2011 21:00:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 7 Oct 2011 21:00:02 +0000 (UTC) Cc: emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 07 22:59:58 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RCHWL-00009o-QJ for ged-emacs-devel@m.gmane.org; Fri, 07 Oct 2011 22:59:53 +0200 Original-Received: from localhost ([::1]:51074 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCHWL-0008Nb-BP for ged-emacs-devel@m.gmane.org; Fri, 07 Oct 2011 16:59:53 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:35177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCHWI-0008J9-U4 for emacs-devel@gnu.org; Fri, 07 Oct 2011 16:59:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RCHWH-00014h-9c for emacs-devel@gnu.org; Fri, 07 Oct 2011 16:59:50 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:20480 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCHWG-00013U-VL for emacs-devel@gnu.org; Fri, 07 Oct 2011 16:59:49 -0400 Original-Received: (qmail 74967 invoked by uid 3782); 7 Oct 2011 20:59:46 -0000 Original-Received: from acm.muc.de (pD951B9DD.dip.t-dialin.net [217.81.185.221]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 07 Oct 2011 22:59:45 +0200 Original-Received: (qmail 17422 invoked by uid 1000); 7 Oct 2011 20:55:23 -0000 Content-Disposition: inline In-Reply-To: <87vcs0q05l.fsf@stupidchicken.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:144724 Archived-At: Hi, Yidong. On Fri, Oct 07, 2011 at 11:41:42AM -0400, Chong Yidong wrote: > The command `count-words-region', newly introduced for Emacs 24, is > inconsistent with the pre-existing `count-lines-region'. If no region > is active, the former reports the number of words in the buffer > (implemented in Bug#9429). That is horrible. Functions should do what their names say. `count-lines-region' should count the lines in the region. Period. Is this so difficult to grasp? How about renaming the above function `count-lines' and defining `count-lines-region' properly. Some of us don't use transient-mark-mode. > The latter always reports the number of lines in the region, whether or > not it is active. > The two ought to be consistent. The behavior of `count-words-region' is > the better one, I think, even if adopting it incurs some backward > incompatibility. I think it is more about naming than functionality. It seems (up to) six functions are called for: `count-{lines,words}-{,region,buffer}'. With this approach, the above problem evaporates. > But going beyond this, instead of introducing a separate > `count-words-region' command, why not fold this functionality into > `count-lines-region'? After all, `count-lines-region' already reports > the number of characters, and there's space for it to report the number > of words too. And it has a convenient binding in M-=, whereas > `count-words-region' has no default binding. > Maybe we could rename the combined function something like `count-text' > (better suggestions welcome). "wc", like the raiser of bug #9429 suggested. But please, please, please, if the function has "region" in its name, make it work on the region. -- Alan Mackenzie (Nuremberg, Germany).