unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9959: 24.0.90; `count-words' command from a narrowed buffer
@ 2011-11-05 10:28 Dani Moncayo
  2011-11-06 15:01 ` Juri Linkov
  2022-02-13  9:56 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 12+ messages in thread
From: Dani Moncayo @ 2011-11-05 10:28 UTC (permalink / raw)
  To: 9959

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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9959: 24.0.90; `count-words' command from a narrowed buffer
  2011-11-05 10:28 bug#9959: 24.0.90; `count-words' command from a narrowed buffer Dani Moncayo
@ 2011-11-06 15:01 ` Juri Linkov
  2011-11-06 15:34   ` Drew Adams
  2022-02-13  9:56 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 12+ messages in thread
From: Juri Linkov @ 2011-11-06 15:01 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 9959

> 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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9959: 24.0.90; `count-words' command from a narrowed buffer
  2011-11-06 15:01 ` Juri Linkov
@ 2011-11-06 15:34   ` Drew Adams
  2011-11-06 16:30     ` Juri Linkov
  2011-11-09  4:39     ` Kevin Rodgers
  0 siblings, 2 replies; 12+ messages in thread
From: Drew Adams @ 2011-11-06 15:34 UTC (permalink / raw)
  To: 'Juri Linkov', 'Dani Moncayo'; +Cc: 9959

> > 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






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9959: 24.0.90; `count-words' command from a narrowed buffer
  2011-11-06 15:34   ` Drew Adams
@ 2011-11-06 16:30     ` Juri Linkov
  2011-11-06 17:30       ` Drew Adams
  2011-11-09  4:39     ` Kevin Rodgers
  1 sibling, 1 reply; 12+ messages in thread
From: Juri Linkov @ 2011-11-06 16:30 UTC (permalink / raw)
  To: Drew Adams; +Cc: 9959

>  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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9959: 24.0.90; `count-words' command from a narrowed buffer
  2011-11-06 16:30     ` Juri Linkov
@ 2011-11-06 17:30       ` Drew Adams
  0 siblings, 0 replies; 12+ messages in thread
From: Drew Adams @ 2011-11-06 17:30 UTC (permalink / raw)
  To: 'Juri Linkov'; +Cc: 9959

> >  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.)






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9959: 24.0.90; `count-words' command from a narrowed buffer
  2011-11-06 15:34   ` Drew Adams
  2011-11-06 16:30     ` Juri Linkov
@ 2011-11-09  4:39     ` Kevin Rodgers
  2011-11-09 15:05       ` Drew Adams
  2012-07-18 14:32       ` Chong Yidong
  1 sibling, 2 replies; 12+ messages in thread
From: Kevin Rodgers @ 2011-11-09  4:39 UTC (permalink / raw)
  To: 9959

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






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9959: 24.0.90; `count-words' command from a narrowed buffer
  2011-11-09  4:39     ` Kevin Rodgers
@ 2011-11-09 15:05       ` Drew Adams
  2011-11-09 16:01         ` Drew Adams
  2012-07-18 14:32       ` Chong Yidong
  1 sibling, 1 reply; 12+ messages in thread
From: Drew Adams @ 2011-11-09 15:05 UTC (permalink / raw)
  To: 'Kevin Rodgers', 9959

> 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.






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9959: 24.0.90; `count-words' command from a narrowed buffer
  2011-11-09 15:05       ` Drew Adams
@ 2011-11-09 16:01         ` Drew Adams
  2011-11-09 16:36           ` Juri Linkov
  0 siblings, 1 reply; 12+ messages in thread
From: Drew Adams @ 2011-11-09 16:01 UTC (permalink / raw)
  To: 'Kevin Rodgers', 9959

> > 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.






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9959: 24.0.90; `count-words' command from a narrowed buffer
  2011-11-09 16:01         ` Drew Adams
@ 2011-11-09 16:36           ` Juri Linkov
  2011-11-09 16:51             ` Drew Adams
  0 siblings, 1 reply; 12+ messages in thread
From: Juri Linkov @ 2011-11-09 16:36 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Kevin Rodgers', 9959

> 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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9959: 24.0.90; `count-words' command from a narrowed buffer
  2011-11-09 16:36           ` Juri Linkov
@ 2011-11-09 16:51             ` Drew Adams
  0 siblings, 0 replies; 12+ messages in thread
From: Drew Adams @ 2011-11-09 16:51 UTC (permalink / raw)
  To: 'Juri Linkov'; +Cc: 'Kevin Rodgers', 9959

> > 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.






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9959: 24.0.90; `count-words' command from a narrowed buffer
  2011-11-09  4:39     ` Kevin Rodgers
  2011-11-09 15:05       ` Drew Adams
@ 2012-07-18 14:32       ` Chong Yidong
  1 sibling, 0 replies; 12+ messages in thread
From: Chong Yidong @ 2012-07-18 14:32 UTC (permalink / raw)
  To: Kevin Rodgers; +Cc: 9959

Kevin Rodgers <kevin.d.rodgers@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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9959: 24.0.90; `count-words' command from a narrowed buffer
  2011-11-05 10:28 bug#9959: 24.0.90; `count-words' command from a narrowed buffer Dani Moncayo
  2011-11-06 15:01 ` Juri Linkov
@ 2022-02-13  9:56 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 12+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-13  9:56 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 9959

Dani Moncayo <dmoncayo@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





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-02-13  9:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-05 10:28 bug#9959: 24.0.90; `count-words' command from a narrowed buffer Dani Moncayo
2011-11-06 15:01 ` Juri Linkov
2011-11-06 15:34   ` Drew Adams
2011-11-06 16:30     ` Juri Linkov
2011-11-06 17:30       ` Drew Adams
2011-11-09  4:39     ` Kevin Rodgers
2011-11-09 15:05       ` Drew Adams
2011-11-09 16:01         ` Drew Adams
2011-11-09 16:36           ` Juri Linkov
2011-11-09 16:51             ` Drew Adams
2012-07-18 14:32       ` Chong Yidong
2022-02-13  9:56 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).