[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Listing markers in buffer
From: |
ian.tegebo |
Subject: |
Re: Listing markers in buffer |
Date: |
Thu, 02 Jun 2016 15:20:49 -0000 |
User-agent: |
G2/1.0 |
On Friday, April 29, 2016 at 10:13:27 AM UTC-7, Pascal J. Bourguignon wrote:
> "ian.tegebo" <ian.tegebo@gmail.com> writes:
>
> > Looking at the C source, I can see that buffer to buffer_text structs
> > point to a singly linked list of Lisp_marker structs [...]
>
> Markers belong to their owners, and it would be very dangerous if you
> could get them and set or reset them behind the back of their owners.
Could you provide an example?
Here's where I'm coming from:
While writing a yas-snippet, I wanted to modify previous text depending on some
event within a field. I found that by doing so, it broke because I didn't
understand how overlays and markers were being used [1]. Naively, I thought I
could get a list of markers in the buffer, like one can get the text properties
and overlays for at least the purposes of learning/debugging.
Instead, I read the code to determine exactly what was going on. In
retrospect, I might have saved myself some time if I'd have been able to see
the details of the markers in the affected region. Now, I see where the
markers are being held in yas-snippet, so I can still get at them and muck
about.
When you say "dangerous", is it the same kind of danger I'm exposed to when
changing the internal state elisp libraries *in general*? Or do you mean
"danger" in a specific sense, e.g. that some monstrous GC bug is hiding behind
the scenes once a buffer's markers are exposed?
[1]: I'm aware that this is a known no-no