From: David Kastrup <dak@gnu.org>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
Emacs Devel <emacs-devel@gnu.org>
Subject: Re: Retrieve front-advance from make-overlay
Date: Mon, 15 Jan 2007 10:59:44 +0100 [thread overview]
Message-ID: <86mz4kbofj.fsf@lola.quinscape.zz> (raw)
In-Reply-To: <45AB4702.6070908@gmail.com> (Lennart Borgman's message of "Mon\, 15 Jan 2007 10\:18\:58 +0100")
"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> David Kastrup wrote:
>> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> 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.
>
>
> Thanks David, I did not that one. I will try it.
It was untested, and naturally, it is wrong. Both calls to
move-overlay. You have to use
(move-overlay ov 1 1 (current-buffer))
and
(move-overlay ov start end buf)
instead, respectively. There are probably more errors: I still did
not test it.
It is basically just a sketch, but should be close to working.
--
David Kastrup
next prev parent reply other threads:[~2007-01-15 9:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-14 21:04 Retrieve front-advance from make-overlay Lennart Borgman (gmail)
2007-01-15 1:23 ` Stefan Monnier
2007-01-15 1:29 ` Lennart Borgman (gmail)
2007-01-15 7:20 ` David Kastrup
2007-01-15 9:18 ` Lennart Borgman (gmail)
2007-01-15 9:59 ` David Kastrup [this message]
2007-01-15 15:39 ` Stefan Monnier
-- strict thread matches above, loose matches on Subject: below --
2007-01-17 17:19 Stuart D. Herring
2007-01-17 18:57 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86mz4kbofj.fsf@lola.quinscape.zz \
--to=dak@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.