emacs-devel
[Top][All Lists]
Advanced

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

Re: Retrieve front-advance from make-overlay


From: David Kastrup
Subject: Re: Retrieve front-advance from make-overlay
Date: Mon, 15 Jan 2007 08:20:25 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"Lennart Borgman (gmail)" <address@hidden> writes:

> Stefan Monnier wrote:
>>> Is it possible to retrieve from an overlay the parameters front-advance and
>>> rear-advance that was given to make-overlay?
>>
>>> Without that it is not possible to make a new copy of an overlay AFAICS.
>>
>> The source code of `copy-overlay' answers this question.
>
> Thanks. Indeed it does ;-)  -- BTW copy-overlay is not mentioned in Info.

(defun overlay-polarities (ov)
  (let ((buf (overlay-buffer ov))
        (start (overlay-start ov))
        (end (overlay-end ov)))
     (unwind-protect
        (with-temp-buffer
           (move-overlay ov 1 1)
           (insert " ")
           (list (> (overlay-start ov) 1)
                 (> (overlay-end ov) 1)))
       (move-overlay ov buf start end))))

This at least has the advantage of not touching the original buffer.
But it is tasteless nevertheless.

-- 
David Kastrup




reply via email to

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