GNU bug report logs -
#35536
27.0.50; Expose buffer's marker list to Elisp
Previous Next
Reported by: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Date: Thu, 2 May 2019 15:46:01 UTC
Severity: wishlist
Tags: patch, wontfix
Found in version 27.0.50
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #17 received at 35536 <at> debbugs.gnu.org (full text, mbox):
> I attach a patch implementing this based on BUF_MARKERS, as per Martin's
> suggestion. Any reasons not to expose such a function?
AFAIK the main reason for such a function is so that you can implement
"replace" functions which preserves markers better than "insert+delete"
does, right? Arguably `replace-buffer-contents` reduced this need, but
this is just one way to "guess" how to preserve the markers and for
specific replacements there are surely other approaches which would
work better, hence the desire to get access to the marker-list to write
ad-hoc solutions.
Random thoughts:
- I wouldn't expose a `(marker-list)` function but rather `(markers-in
BEG END)` so you're not bothered by unrelated markers outside of
the region of interest.
- The main problem I see is that some of the markers in BUF_MARKERS are
"proper" markers, while others are just the markers that we happen to
use in the current internal representation of overlays.
If you can get your hands on those markers, you might end up breaking
some invariants on which the C code relies (e.g. place the
overlay-start after the overlay-end, or in a different buffer).
- I think the serious risks (e.g. crashes) are solvable. E.g. there's
room for an additional boolean field `lisp_marker` which could be used
to distinguish those markers which can be safely returned (because
they're normal Lisp-level markers already accessible from Lisp anyway)
from the internal ones (such as those from overlays).
- Then we'd probably want to discussion whether markers used within
`save-excursion` and friends should be marked as `lisp_marker` or not.
This said, as you say later:
> I have yet to see a use-case for marker-list which can't be engineered
> in a different way
So, whether it's worth the trouble: I don't know.
Stefan
This bug report was last modified 5 years and 253 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.