unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: "Pravles Redneсkoff" <pravles@pm.me>
Cc: "'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'" <help-gnu-emacs@gnu.org>
Subject: RE: [External] : How to detect words being added and removed to a buffer in a minor mode?
Date: Sat, 19 Nov 2022 23:31:08 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488882703C6AC2B78900D53F3089@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <SkO7fkMSL-au9yYO5Xk5YrHuSBbM2mx36Fx4y964ak7UNP_wFy8FgEn_miE0Xx142g68yswZvuQVozqCaMNbCD-mny7SundkXZ2xZaxjIVA=@pm.me>

[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]

> As far as I know, none of the existing Emacs
> word counters offers this functionality.

Vanilla Emacs offers you the word count in the
region, with `M-=' (`count-words-region').  As
you say, that doesn't provide what you request.
But may help somewhat.
___

This too doesn't offer what you request, but it
might help you nevertheless: `modeline-region.el'.
___

https://www.emacswiki.org/emacs/ModeLineRegion

https://www.emacswiki.org/emacs/modeline-region.el
___

1. Customize option `mlr-non-rectangle-style' to
   "Lines, words, and chars" (`lines+words+chars').

2. To get the same effect with a rectangular region
   (selection), customize `mlr-rectangle-style' to
   "Rows, columns, words, and chars"
   (`rows+cols+words+chars').

3. Enable minor mode `modeline-region-mode' or
   `global-modeline-region-mode'.

Whenever the region is active, the number of words
(and more) selected is shown in the mode line.  So
`C-x C-x' shows you the count any time.

Works even for a rectangular region.  (Option
`mlr-count-partial-words-flag' controls whether to
count words that straddle rectangle boundaries.)

As usual, `C-x h' to select the whole buffer, to
see buffer counts.

[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 14214 bytes --]

  reply	other threads:[~2022-11-19 23:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-19 20:45 How to detect words being added and removed to a buffer in a minor mode? Pravles Redneсkoff via Users list for the GNU Emacs text editor
2022-11-19 23:31 ` Drew Adams [this message]
2022-11-20  3:10 ` Bob Newell

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB5488882703C6AC2B78900D53F3089@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=pravles@pm.me \
    /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.
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).