--- Begin Message ---
Subject: |
Re: flyspell before and after-string |
Date: |
Fri, 25 Jan 2002 10:51:12 +0100 |
Hello Mario,
> I just tried to implement a flyspell feature I always wanted to have. I want
> flyspell to mark a incorrect word using a before and after-string, instead of
> just
> a different colour. This is useful on ttys which are monochrome, and
> especially for me as blind braille display user. A braille display doesnt
> show colours by default. I'd need to switch into another mode to see different
> colours, and so a text string is better than colours.
>
>
> Here is what I have:
>
> (defcustom flyspell-before-incorrect-word-string "->"
> "String used to indicate an incorrect word."
> :group 'flyspell
> :type 'string)
>
> (defcustom flyspell-after-incorrect-word-string "<-"
> "String used to indicate an incorrect word."
> :group 'flyspell
> :type 'string)
>
> (defun make-flyspell-overlay (beg end face mouse-face)
> "Allocate an overlay to highlight an incorrect word.
> BEG and END specify the range in the buffer of that word.
> FACE and MOUSE-FACE specify the `face' and `mouse-face' properties
> for the overlay."
> (let ((flyspell-overlay (make-overlay beg end nil t nil)))
> (overlay-put flyspell-overlay 'face face)
> (overlay-put flyspell-overlay 'mouse-face mouse-face)
> (overlay-put flyspell-overlay 'flyspell-overlay t)
> (if flyspell-use-local-map
> (overlay-put flyspell-overlay
> flyspell-overlay-keymap-property-name
> flyspell-mouse-map))
> (when (eq face 'flyspell-incorrect-face)
> (and (stringp flyspell-before-incorrect-word-string)
> (overlay-put flyspell-overlay 'before-string
> flyspell-before-incorrect-word-string))
> (and (stringp flyspell-after-incorrect-word-string)
> (overlay-put flyspell-overlay 'after-string
> flyspell-after-incorrect-word-string)))
> flyspell-overlay))
>
> There seems to be only a small bug with that trick. When I use
> flyspell-auto-correct-word (M-TAB), I get some remaining before-strings in
> the buffer.
> Try it yourself, you'll be suprised. I thought you probably have an idea why
> this happens.
> Maybe you can help me to get this working fine.
Actually I have tried your patch (we seems a good idea to me) and I have seen
the problem. Unfortunately I think it is a GNU-Emacs problem. Your code seems
correct to me and in addition, it works with Xemacs. I think that you should
contact the people from Emacs to point them out the problem.
Many thanks for your contribution (that will be included in the next flyspell
version).
Sincerely,
--
Manuel
--- End Message ---