Today I had to copy a bank account number from a real (dead tree) letter to an Emacs buffer and then send it by email. And I made a mistake while copying it from the letter to the Emacs buffer (forgot one digit). Which resulted in one email from a coworker telling me: "couldn't make the payment, bogus IBAN".
How hard would it be to create a function/minor-mode that would:
detect "things" that do look like an IBAN (for example two uppercase letters followed by between 'x' and 'y' digits, ignoring spaces etc. There are ready-to-use regexps out there that verify if something looks like an IBAN or not)
run a mod 97 and highlight the IBAN in red if it looks invalid
Ideally I'd need a minor-mode that I could turn on for several types of buffers (silly text files, but also email, etc.).
What would be the "approach" to use to do that using Emacs?
You can easily use something like
(font-lock-add-keywords nil
'(("[A-Z][A-Z][0-9]\\{x,y\\}"
(0 (if (eq (mod blabla 97) foo) nil 'font-lock-warning-face))))))
Just fill in the blabla.