unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Marcin Borkowski <mbork@mbork.pl>
To: Jean Louis <bugs@gnu.support>
Cc: Eric S Fraga <e.fraga@ucl.ac.uk>, help-gnu-emacs@gnu.org
Subject: Re: How to detect words being added and removed to a buffer in a minor mode?
Date: Mon, 21 Nov 2022 18:21:45 +0100	[thread overview]
Message-ID: <87sficcjfa.fsf@mbork.pl> (raw)
In-Reply-To: <87tu2scjmt.fsf@mbork.pl>


On 2022-11-21, at 18:17, Marcin Borkowski <mbork@mbork.pl> wrote:

> Would a mode which displays the number of words in the current buffer
> whenever you stop typing for a few seconds be enough?  (I am not sure
> how exactly you want to obtain the "number of words typed in today".)

Ah, ok.  I reread your initial message.  I don't think yours is the
easiest way to do that.  Here's how I would do it: I would /store/ the
number of words in a buffer somewhere (a buffer-local variable is one
possible idea) every time the counting function is called /the first
time on any given day/.  This way you wouldn't have to set the counter
to zero etc. - Emacs could even plot a graph showing your progress
during several days?

And now I'm /very/ much tempted to actually write this piece of code.
It could be quite fun!

It's even better.  It /might/ be a good idea ot turn it into an
educational blog post about Elisp or something similar.

WDYT?  I think I could come up with a prototype within a few days...

Best,

-- 
Marcin Borkowski
http://mbork.pl



  reply	other threads:[~2022-11-21 17:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-19 20:44 How to detect words being added and removed to a buffer in a minor mode? Dmitrii Pisarenko
2022-11-21  9:39 ` Eric S Fraga
2022-11-21 10:08   ` Jean Louis
2022-11-21 10:34     ` Emanuel Berg
2022-11-21 11:27     ` Eric S Fraga
2022-11-21 12:40       ` Emanuel Berg
2022-11-21 17:17     ` Marcin Borkowski
2022-11-21 17:21       ` Marcin Borkowski [this message]
2022-11-21 18:56       ` [External] : " Drew Adams
2022-11-22 15:33       ` Emanuel Berg
2022-11-26  6:14         ` Marcin Borkowski
2022-11-26 14:51           ` Emanuel Berg
  -- strict thread matches above, loose matches on Subject: below --
2022-11-19 20:45 Pravles Redneсkoff via Users list for the GNU Emacs text editor
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=87sficcjfa.fsf@mbork.pl \
    --to=mbork@mbork.pl \
    --cc=bugs@gnu.support \
    --cc=e.fraga@ucl.ac.uk \
    --cc=help-gnu-emacs@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.
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).