One common mistake in my document is a word duplication. I think sometimes when you you write text, you also duplicate words like in this sentence. This is hard to find by a spell checker, since spelling is correct. Also, duplication is not always wrong. Once my colleague Alexander pointed me out, ``Why emacs does not have such a program to find it out. It is common mistake in a paper.''
Actually, gnu Emacs's document -- Emacs Lisp Intro -- has a section, The the-the function. This section explains exact the same problem and show how to write a regexp to find this out. In the document, this mistake is called as the-the problem.
The emacs document shows a nice solution. It is simple. The program has only 11 lines including comments and document. The author explains the solution is not perfect but sufficient. I also thought the solution is sufficient. However, when I start to use the function, I found next two problems.
This program is extended version of `The the-the function' that can solve above two problems.
;; find the-the pattern (autoload 'the-the-search-forward "the-the" nil t) (autoload 'the-the-region "the-the" nil t) (autoload 'the-the-buffer "the-the" nil t)
Do you know a story about a barber who ordered a new signboard ``cut and shave''? When the signboard was ready, the barber asked to improve it a little by adding extra space between cut and and and and and shave.
People have own style, but I like a style to put spaces between a and and and and and and and b. (Referring next sentence.)
if(a&&b){...}