> I don't know what happens in XEmacs--I only work on Emacs.
>
> The code you sent creates overlays. They would continue to exist and
> be displayed until something removes them with delete-overlay. There
> seems to be code in flyspell.el that tries to delete them, so the
> question is why it does not delete these overlays.
>
> Manuel, could you debug it?
I still think the problem is in Emacs or in the documentation about
overlay. In the section "Overlays properties" it is said:
-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----
`before-string'
This property's value is a string to add to the display at the
beginning of the overlay. The string does not appear in the
buffer in any sense--only on the screen.
`after-string'
This property's value is a string to add to the display at the end
of the overlay. The string does not appear in the buffer in any
sense--only on the screen.
-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----
So, I would have guessed that when a region using an overlay with
a before-string and an after-string properties is deleted, the before-string
and after-string disappear of the screen. That is, I have tried:
-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----
(require 'flyspell)
(defvar ov nil)
(defun add-ov (beg end)
(setq ov (make-overlay beg end nil t nil))
(overlay-put ov 'face 'flyspell-incorrect-face)
(overlay-put ov 'mouse-face 'highlight)
(overlay-put ov 'before-string "->")
(overlay-put ov 'after-string "<-"))
(defun del-ov ()
(delete-overlay ov))
-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----
Then, on a random buffer:
-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----
(add-ov 1 4)
(delete-region 1 4)
-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----
The strings "->" and "<-" are still on the screen. Is this really normal?
For your information, XEmacs 21.4 removes the strings.
Anyway, I will fix flyspell.el so that it runs correctly with Emacs 21.1.
--
Manuel
ps: I'm using Emacs 21.1.1 on a Linux box.