[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Manuel Serrano <address@hidden>] Re: flyspell before and after-string

From: Mario Lang
Subject: [Manuel Serrano <address@hidden>] Re: flyspell before and after-string
Date: 25 Jan 2002 17:08:41 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7


I recently sent a mail to Manuel Serrano about a problem with flyspell I 
while trying to add before and after-string properties to the flyspell-overlays.

This is what I got as an answer, and maybe one of you has additional 

In short, when I use flyspell-auto-correct-word with the modifications
quoted below, before and/or after-strings stay in the buffer instead
of getting removed. Try it yourself. Any idea why this happens (as manuel  said)
only in GNU Emacs, and not in XEmacs?

--- 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



--- End Message ---

   Mario <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]