help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: count all ispell(flyspell) errors in a buffer


From: Emanuel Berg
Subject: Re: count all ispell(flyspell) errors in a buffer
Date: Mon, 27 Nov 2023 01:53:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]