[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: count all spelling typos in a given buffer.
From: |
Uwe Brauer |
Subject: |
Re: count all spelling typos in a given buffer. |
Date: |
Thu, 30 Nov 2023 10:28:06 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
>>> "EB" == Emanuel Berg <incal@dataswamp.org> writes:
> Uwe Brauer wrote:
>> I asked this already on the emacs help list, but maybe
>> somebody here, knows about the following feature, namely:
>> Count all the typos, ispell (flyspell) finds in
>> given buffer.
> I posted this solution on gnu.emacs.help several days ago but
> it hasn't appeared, anyway here you go.
Thanks very much
> ;;; -*- lexical-binding: t -*-
> ;;
> ;; this file:
> ;; https://dataswamp.org/~incal/emacs-init/spell.el
I also tried to download spell.el but that file needs dwim.el
which I don't have and can't find in the emacs git tree (just pulled)
However I tried your code, and I also downloaded some of your packages,
including your misc.el
Be it as it may., when I execute ispell-count, I receive
Starting "look" process...
let: Autoloading file /home/oub/emacs/site-lisp/packages/berg-code/misc.el
failed to define function forward-to-word
Quit
When I rename your misc.el, restart emacs.
I try it again and then I obtain another error which I attach
Maybe I need a actualised version of your misc.el?
Thanks
> (require 'cl-lib)
> (defun ispell-count (&optional beg end)
> (interactive
> (if (use-region-p)
> (list (region-beginning) (region-end)) ))
> (or beg (setq beg (point-min)))
> (or end (setq end (point-max)))
> (save-mark-and-excursion
> (goto-char beg)
> (forward-word)
> (backward-word)
> (cl-loop
> with words = 0
> with errors = 0
> while (< (point) end)
> do (let ((word (thing-at-point 'word t)))
> (unless (ispell-lookup-words word)
> (cl-incf errors) )
> (cl-incf words)
> (forward-to-word) )
> finally (message "%s words checked, %s errors" words errors) )))
> ;; this is a region wiht two
> ;; worsd spelled incorrectly
--
I strongly condemn Hamas heinous atrocities on Israel, especially the
despicable pogroms.
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military.
I support the EU and NATO membership of Ukraine.
ispell-count-bug.txt
Description: Text document
smime.p7s
Description: S/MIME cryptographic signature