[Top][All Lists]

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

Re: Behavior of evaporate

From: Miles Bader
Subject: Re: Behavior of evaporate
Date: 26 Sep 2003 18:05:15 +0900

Masatake YAMATO <address@hidden> writes:
> (progn (setq xxx 1)
>        (setq o (make-overlay 0 0))
>        (overlay-put o 'modification-hooks (lambda (ov dummy b e l)
>                                           (setq xxx 0)))
>        (overlay-put o 'evaporate t)
>        xxx)
> => 1
> Result I expected is 0.
> So I can know an overlay is dead.

I don't think modification hooks are called in this case -- since the
overlay had an initial size of 0 (and illegal begin/end values for that
matter), it was never really part of the buffer at all.

The following works as you expect:

   (progn (setq xxx 1)
          (setq o (make-overlay 1 2))
          (overlay-put o 'modification-hooks (list (lambda (ov b e l)
                                                      (setq xxx 0))))
          (overlay-put o 'evaporate t)
          (delete-region 1 2)
=> 0

You can also detect whether an overlay's been evaporated or not by
seeing if it has a null buffer, e.g., (overlay-buffer o) => nil.

`There are more things in heaven and earth, Horatio,
 Than are dreamt of in your philosophy.'

reply via email to

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