GNU bug report logs - #9959
24.0.90; `count-words' command from a narrowed buffer

Previous Next

Package: emacs;

Reported by: Dani Moncayo <dmoncayo <at> gmail.com>

Date: Sat, 5 Nov 2011 10:32:01 UTC

Severity: wishlist

Found in version 24.0.90

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9959 in the body.
You can then email your comments to 9959 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#9959; Package emacs. (Sat, 05 Nov 2011 10:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dani Moncayo <dmoncayo <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 05 Nov 2011 10:32:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.90; `count-words' command from a narrowed buffer
Date: Sat, 5 Nov 2011 11:28:57 +0100
Hi,

Try the `count-words' command from a narrowed buffer (without active region).

The message displayed in the echo area is "Buffer has X lines, Y
words, and Z characters.", where the values X, Y and Z are actually
computed for the narrowed portion (not for the entire buffer).

So, this is inaccurate.  The message should begin with something like
"Buffer (narrowed part) has ...".


In GNU Emacs 24.0.90.1 (i386-mingw-nt6.1.7601)
 of 2011-10-27 on DANI-PC
Windowing system distributor `Microsoft Corp.', version 6.1.7601
configured using `configure --with-gcc (4.5)'

-- 
Dani Moncayo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9959; Package emacs. (Sun, 06 Nov 2011 15:15:02 GMT) Full text and rfc822 format available.

Message #8 received at 9959 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 9959 <at> debbugs.gnu.org
Subject: Re: bug#9959: 24.0.90; `count-words' command from a narrowed buffer
Date: Sun, 06 Nov 2011 17:01:30 +0200
> Try the `count-words' command from a narrowed buffer (without active region).
>
> The message displayed in the echo area is "Buffer has X lines, Y
> words, and Z characters.", where the values X, Y and Z are actually
> computed for the narrowed portion (not for the entire buffer).
>
> So, this is inaccurate.  The message should begin with something like
> "Buffer (narrowed part) has ...".

Like `C-x =' displays information about a narrowed buffer
in angle brackets `<...>', `count-words' could do the same
and display both widened and narrowed counts.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9959; Package emacs. (Sun, 06 Nov 2011 15:38:02 GMT) Full text and rfc822 format available.

Message #11 received at 9959 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Juri Linkov'" <juri <at> jurta.org>, "'Dani Moncayo'" <dmoncayo <at> gmail.com>
Cc: 9959 <at> debbugs.gnu.org
Subject: RE: bug#9959: 24.0.90; `count-words' command from a narrowed buffer
Date: Sun, 6 Nov 2011 07:34:58 -0800
> > The message should begin with something like
> > "Buffer (narrowed part) has ...".
> 
> Like `C-x =' displays information about a narrowed buffer
> in angle brackets `<...>', `count-words' could do the same
> and display both widened and narrowed counts.

FWIW, in Emacs generally, "buffer (narrowed part)" is referred to as the buffer
"restriction".

But I'm not sure that users unfamiliar with the term would understand it
immediately in a prompt.  Same potential problem with an unexplained convention
such as `<...>'.  I don't have a better suggestion, however.  So far, I'd lean
toward, "Buffer restriction has 112 lines, 673 words, 6074 chars"

Or maybe both counts could be shown, making it a bit clearer what the info is?
"Buffer (restriction): 1135 (112) lines, 6894 (673) words, 70452 (6074) chars".
And in that case, maybe "Buffer (narrowed)..." would be better.  Another
possibility (shorter):

 Narrowed/total: 112/1135 lines, 673/6894 words, 6074/70452 chars





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9959; Package emacs. (Sun, 06 Nov 2011 16:35:02 GMT) Full text and rfc822 format available.

Message #14 received at 9959 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 9959 <at> debbugs.gnu.org, 'Dani Moncayo' <dmoncayo <at> gmail.com>
Subject: Re: bug#9959: 24.0.90; `count-words' command from a narrowed buffer
Date: Sun, 06 Nov 2011 18:30:15 +0200
>  Narrowed/total: 112/1135 lines, 673/6894 words, 6074/70452 chars

This format is nice because it's compact.  Perhaps information about the
region should be added too when the region is active:

Region/narrowed/total: 5/112/1135 lines, 8/673/6894 words, 45/6074/70452 chars




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9959; Package emacs. (Sun, 06 Nov 2011 17:34:02 GMT) Full text and rfc822 format available.

Message #17 received at 9959 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Juri Linkov'" <juri <at> jurta.org>
Cc: 9959 <at> debbugs.gnu.org, 'Dani Moncayo' <dmoncayo <at> gmail.com>
Subject: RE: bug#9959: 24.0.90; `count-words' command from a narrowed buffer
Date: Sun, 6 Nov 2011 09:30:31 -0800
> >  Narrowed/total: 112/1135 lines, 673/6894 words, 6074/70452 chars
> 
> This format is nice because it's compact.  Perhaps 
> information about the region should be added too when
> the region is active:
> 
> Region/narrowed/total: 5/112/1135 lines, 8/673/6894 words, 
> 45/6074/70452 chars

I assume you mean only in the case where the buffer is narrowed and you have an
active region within the restriction.

That would be OK.  But keep in mind that your example uses a small region and
restriction.  In general, the message could be a bit long.  With the same buffer
size, the message could have up to an additional 12 chars.

(The length wouldn't be a problem for me, because my minibuffer frame is as wide
as my screen, and I don't mind if a message wraps.  Just mentioning the
possibility.)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9959; Package emacs. (Wed, 09 Nov 2011 04:40:02 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kevin Rodgers <kevin.d.rodgers <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#9959: 24.0.90; `count-words' command from a narrowed buffer
Date: Tue, 08 Nov 2011 21:39:06 -0700
On 11/6/11 8:34 AM, Drew Adams wrote:

> Or maybe both counts could be shown, making it a bit clearer what the info is?
> "Buffer (restriction): 1135 (112) lines, 6894 (673) words, 70452 (6074) chars".
> And in that case, maybe "Buffer (narrowed)..." would be better.  Another
> possibility (shorter):
>
>   Narrowed/total: 112/1135 lines, 673/6894 words, 6074/70452 chars

If I've narrowed a very large buffer to a small region, I am not interested in
the counts for the entire buffer nor willing to wait for them.

-- 
Kevin Rodgers
Denver, Colorado, USA





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9959; Package emacs. (Wed, 09 Nov 2011 15:07:02 GMT) Full text and rfc822 format available.

Message #23 received at 9959 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Kevin Rodgers'" <kevin.d.rodgers <at> gmail.com>, <9959 <at> debbugs.gnu.org>
Subject: RE: bug#9959: 24.0.90; `count-words' command from a narrowed buffer
Date: Wed, 9 Nov 2011 07:05:43 -0800
> If I've narrowed a very large buffer to a small region, I am 
> not interested in the counts for the entire buffer nor
> willing to wait for them.

Yes, that's the cost of such combining.

Possible solutions include (a) adding separate commands for individual pieces of
the combination and (b) finding a way (e.g. prefix arg) to specify interactively
to this command that you want only one or two pieces of info, not everything.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9959; Package emacs. (Wed, 09 Nov 2011 16:03:01 GMT) Full text and rfc822 format available.

Message #26 received at 9959 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Kevin Rodgers'" <kevin.d.rodgers <at> gmail.com>, <9959 <at> debbugs.gnu.org>
Subject: RE: bug#9959: 24.0.90; `count-words' command from a narrowed buffer
Date: Wed, 9 Nov 2011 08:01:53 -0800
> > If I've narrowed a very large buffer to a small region, I am 
> > not interested in the counts for the entire buffer nor
> > willing to wait for them.
> 
> Yes, that's the cost of such combining.
> 
> Possible solutions include (a) adding separate commands for 
> individual pieces of
> the combination and (b) finding a way (e.g. prefix arg) to 
> specify interactively
> to this command that you want only one or two pieces of info, 
> not everything.

Another possibility: Do as we do with `apropos' commands.  We have both a prefix
arg and a user option, `apropos-do-all', that affect the behavior, with the less
complete, and faster, behavior as the default.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9959; Package emacs. (Wed, 09 Nov 2011 16:39:02 GMT) Full text and rfc822 format available.

Message #29 received at 9959 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 'Kevin Rodgers' <kevin.d.rodgers <at> gmail.com>, 9959 <at> debbugs.gnu.org
Subject: Re: bug#9959: 24.0.90; `count-words' command from a narrowed buffer
Date: Wed, 09 Nov 2011 18:36:49 +0200
> Another possibility: Do as we do with `apropos' commands.  We have both a prefix
> arg and a user option, `apropos-do-all', that affect the behavior, with the less
> complete, and faster, behavior as the default.

Or do as we do with `what-cursor-position' (`C-x =') that prints info in
the echo area, but with prefix argument shows full details in *Help* buffer.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9959; Package emacs. (Wed, 09 Nov 2011 16:52:02 GMT) Full text and rfc822 format available.

Message #32 received at 9959 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Juri Linkov'" <juri <at> jurta.org>
Cc: 'Kevin Rodgers' <kevin.d.rodgers <at> gmail.com>, 9959 <at> debbugs.gnu.org
Subject: RE: bug#9959: 24.0.90; `count-words' command from a narrowed buffer
Date: Wed, 9 Nov 2011 08:51:15 -0800
> > Another possibility: Do as we do with `apropos' commands.  
> > We have both a prefix arg and a user option,
> > `apropos-do-all', that affect the behavior, with the less
> > complete, and faster, behavior as the default.
> 
> Or

It's not an "or" - the two are orthogonal (except for key binding
choice/conflict).  I was talking about how much info is shown.  You're talking
about where the info is displayed.

The `apropos' approach is good because it lets users define a personal
preference that might be for seeing more info (=t), yet it also lets users
change the behavior on the fly using a prefix arg.

> do as we do with `what-cursor-position' (`C-x =') that 
> prints info in the echo area, but with prefix argument shows
> full details in *Help* buffer.

I don't see the output of even the full info as being something voluminous,
necessitating *Help*.  But perhaps you had something more in mind.  The info
we've discussed so far should be OK for the minibuffer.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9959; Package emacs. (Wed, 18 Jul 2012 14:39:02 GMT) Full text and rfc822 format available.

Message #35 received at 9959 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Kevin Rodgers <kevin.d.rodgers <at> gmail.com>
Cc: 9959 <at> debbugs.gnu.org
Subject: Re: bug#9959: 24.0.90; `count-words' command from a narrowed buffer
Date: Wed, 18 Jul 2012 22:32:38 +0800
Kevin Rodgers <kevin.d.rodgers <at> gmail.com> writes:

> On 11/6/11 8:34 AM, Drew Adams wrote:
>
>> Or maybe both counts could be shown, making it a bit clearer what the info is?
>> "Buffer (restriction): 1135 (112) lines, 6894 (673) words, 70452
>> (6074) chars".
>> And in that case, maybe "Buffer (narrowed)..." would be better.  Another
>> possibility (shorter):
>>
>>   Narrowed/total: 112/1135 lines, 673/6894 words, 6074/70452 chars
>
> If I've narrowed a very large buffer to a small region, I am not interested in
> the counts for the entire buffer nor willing to wait for them.

Agreed.  I committed the simplest version, i.e. reporting "Narrowed part
of buffer" in the message.  I'll leave this open in case as a wishlist
item; if anyone wants to implement the more complicated reporting with
C-u, feel free.




Severity set to 'wishlist' from 'minor' Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 18 Jul 2012 14:40:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9959; Package emacs. (Sun, 13 Feb 2022 09:58:02 GMT) Full text and rfc822 format available.

Message #40 received at 9959 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 9959 <at> debbugs.gnu.org
Subject: Re: bug#9959: 24.0.90; `count-words' command from a narrowed buffer
Date: Sun, 13 Feb 2022 10:56:51 +0100
Dani Moncayo <dmoncayo <at> gmail.com> writes:

> Try the `count-words' command from a narrowed buffer (without active region).
>
> The message displayed in the echo area is "Buffer has X lines, Y
> words, and Z characters.", where the values X, Y and Z are actually
> computed for the narrowed portion (not for the entire buffer).
>
> So, this is inaccurate.  The message should begin with something like
> "Buffer (narrowed part) has ...".

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

Chong Yidong fixed this at the time.  The discussion then went on to
whether `C-u M-x count-words' should report data for both the
narrowed-to and total buffer.  That sounds reasonable to me, so I've now
done that in Emacs 29 (although the message is kinda wide).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 9959 <at> debbugs.gnu.org and Dani Moncayo <dmoncayo <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 13 Feb 2022 09:58:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 13 Mar 2022 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 17 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.