From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: Behavior of evaporate Date: 26 Sep 2003 11:17:24 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <20030926.165808.260114910.jet@gyve.org> <20030926.175343.232772863.jet@gyve.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1064567941 18208 80.91.224.253 (26 Sep 2003 09:19:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 26 Sep 2003 09:19:01 +0000 (UTC) Cc: miles@lsi.nec.co.jp, emacs-devel@gnu.org, miles@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Sep 26 11:18:58 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A2okc-0004JE-00 for ; Fri, 26 Sep 2003 11:18:58 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1A2osB-0005gj-00 for ; Fri, 26 Sep 2003 11:26:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 1A2ojf-0008RD-3j for emacs-devel@quimby.gnus.org; Fri, 26 Sep 2003 05:17:59 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.22) id 1A2ojU-0008O3-VH for emacs-devel@gnu.org; Fri, 26 Sep 2003 05:17:48 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.22) id 1A2ojP-0008Mg-4z for emacs-devel@gnu.org; Fri, 26 Sep 2003 05:17:43 -0400 Original-Received: from [62.226.11.177] (helo=localhost.localdomain) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.22) id 1A2ojN-0008Lx-Ug; Fri, 26 Sep 2003 05:17:42 -0400 Original-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h8Q9HX4B027093 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 26 Sep 2003 11:17:33 +0200 Original-Received: (from dak@localhost) by localhost.localdomain (8.12.8/8.12.8/Submit) id h8Q9HPHS027088; Fri, 26 Sep 2003 11:17:25 +0200 Original-To: Masatake YAMATO In-Reply-To: <20030926.175343.232772863.jet@gyve.org> Original-Lines: 54 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:16669 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:16669 Masatake YAMATO writes: > > > > I was thinking of suggesting that but wasn't sure whether it'd work. > > > > Does it ? If it does, it's probably the simplest alternative, indeed. > > > > > > `evaporate' doesn't work I expect. So I introduced suboverlays > > > property to manage overlay deletion. > > > > I'm not sure exactly what you're saying, but the overlay > > `evaporate' feature definitely works (unless it's recently been > > broken)... > > (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. > Do I misunderstand? Yes. From the manual: `evaporate' If this property is non-`nil', the overlay is deleted automatically if it ever becomes empty (i.e., if it spans no characters). But the overlay does not become empty in your example. It _is_ already empty. Setting the overlay borders explicitly is not what this property is useful for catching. It is there for the case that the overlay becomes empty by side effect. Try (progn (setq xxx 1) (goto-char 1) (insert "x") (setq o (make-overlay 1 2)) (overlay-put o 'modification-hooks (list (lambda (ov dummy b e &optional l) (setq xxx 0)))) (overlay-put o 'evaporate t) (delete-char 1) xxx) And notice that modification-hooks takes a list of functions, not just a single function. And that the last argument of the function is optional. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum