unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <incal@dataswamp.org>
To: help-gnu-emacs@gnu.org
Subject: Re: count all ispell(flyspell) errors in a buffer
Date: Mon, 27 Nov 2023 01:53:22 +0100	[thread overview]
Message-ID: <87zfz0c8zh.fsf@dataswamp.org> (raw)
In-Reply-To: 87a5r2gclr.fsf@mat.ucm.es

Check out the below file URL, and this one

  https://dataswamp.org/~incal/emacs-init/dwim.el

for some further minor improvements of this program.

But the one I posted works fine and does not need the
dwim.el file.

;;; -*- lexical-binding: t -*-
;;
;; this file:
;;   https://dataswamp.org/~incal/emacs-init/spell.el

(require 'cl-lib)
(require 'dwim)
(require 'ispell)

(defun ispell-count (&optional beg end)
  (interactive (use-region))
  (or beg (setq beg (point-min)))
  (or end (setq end (point-max)))
  (save-mark-and-excursion
    (goto-char beg)
    (backward-word)
    (cl-loop
      with words  = 0
      with errors = 0
      while (< (point) end)
      do (let ((word (thing-at-point 'word t)))
           (cl-incf words)
           (unless (ispell-lookup-words word)
             (cl-incf errors) )
           (forward-to-word) )
      finally (message "%s words checked, %s errors" words errors) )))

-- 
underground experts united
https://dataswamp.org/~incal




      parent reply	other threads:[~2023-11-27  0:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-25 13:57 count all ispell(flyspell) errors in a buffer Uwe Brauer
2023-11-26 23:53 ` Emanuel Berg
2023-11-27  0:36 ` Emanuel Berg
2023-11-27  0:53 ` Emanuel Berg [this message]

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=87zfz0c8zh.fsf@dataswamp.org \
    --to=incal@dataswamp.org \
    --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).