1 ;;; ocr-user.el --- Input looong OCR number more safely
3 ;; Author: Lennart Borgman (lennart O borgman A gmail O com)
4 ;; Created: 2008-06-18T23:00:25+0200 Wed
11 ;; Features that might be required by this library:
15 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19 ;; I just get mad at entering OCR numbers more than twenty digits long
20 ;; so I wrote this litte minor mode that colors up the digits three by
27 ;; Crazy? Yeah, I get crazy by entering these digits. You would not
28 ;; like to meet me when I have done that!
30 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
35 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
37 ;; This program is free software; you can redistribute it and/or
38 ;; modify it under the terms of the GNU General Public License as
39 ;; published by the Free Software Foundation; either version 2, or
40 ;; (at your option) any later version.
42 ;; This program is distributed in the hope that it will be useful,
43 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
44 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
45 ;; General Public License for more details.
47 ;; You should have received a copy of the GNU General Public License
48 ;; along with this program; see the file COPYING. If not, write to
49 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
50 ;; Floor, Boston, MA 02110-1301, USA.
52 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56 (defconst ocr-keywords
60 "\\(?1:[0-9]\\{3\\}\\)"
61 "\\(?2:[0-9]\\{3\\}\\)?"
65 (put-text-property (match-beginning 1) (match-end 1)
66 'face '(:background "LightBlue1"))
67 (when (match-beginning 2)
68 (put-text-property (match-beginning 2) (match-end 2)
69 'face '(:background "PaleGreen1"))))))))
75 (define-minor-mode ocr-user-mode
76 "Color up digits three by three."
79 (font-lock-add-keywords nil ocr-keywords)
80 (font-lock-remove-keywords nil ocr-keywords))
81 (font-lock-fontify-buffer))
85 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
86 ;;; ocr-user.el ends here