From: Alan Mackenzie <acm@muc.de>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: emacs-devel@gnu.org
Subject: Re: Rethinking count-words-region
Date: Fri, 7 Oct 2011 20:55:23 +0000 [thread overview]
Message-ID: <20111007205523.GI2830@acm.acm> (raw)
In-Reply-To: <87vcs0q05l.fsf@stupidchicken.com>
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).
next prev parent reply other threads:[~2011-10-07 20:55 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-07 15:41 Rethinking count-words-region Chong Yidong
2011-10-07 16:46 ` Jambunathan K
2011-10-08 16:53 ` Chong Yidong
2011-10-08 18:00 ` Andreas Röhler
2011-10-07 18:08 ` Eli Zaretskii
2011-10-07 20:51 ` Chong Yidong
2011-10-07 20:55 ` Chong Yidong
2011-10-08 17:58 ` Andreas Röhler
2011-10-08 18:11 ` Drew Adams
2011-10-08 18:23 ` Chong Yidong
2011-10-08 18:25 ` Drew Adams
2011-10-08 18:29 ` Alan Mackenzie
2011-10-08 19:04 ` Lars Ingebrigtsen
2011-10-08 19:28 ` Juri Linkov
2011-10-08 18:40 ` Andreas Röhler
2011-10-08 6:22 ` Eli Zaretskii
2011-10-07 20:29 ` Andreas Röhler
2011-10-07 20:55 ` Alan Mackenzie [this message]
2011-10-08 16:52 ` Chong Yidong
2011-10-08 17:51 ` Andreas Röhler
2011-10-08 20:04 ` Juri Linkov
2011-10-08 20:46 ` Chong Yidong
2011-10-08 21:09 ` Juri Linkov
2011-10-08 20:49 ` Drew Adams
2011-10-08 21:12 ` Juri Linkov
2011-10-08 21:33 ` Drew Adams
2011-10-09 0:57 ` chad
2011-10-09 1:05 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111007205523.GI2830@acm.acm \
--to=acm@muc.de \
--cc=cyd@stupidchicken.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.