all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Basil L. Contovounesios" <contovob@tcd.ie>
Cc: 35536@debbugs.gnu.org, Mauro Aranda <maurooaranda@gmail.com>
Subject: bug#35536: 27.0.50; Expose buffer's marker list to Elisp
Date: Thu, 02 May 2019 15:59:38 -0400	[thread overview]
Message-ID: <jwvimusvenm.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87lfzo274b.fsf@tcd.ie> (Basil L. Contovounesios's message of "Thu, 02 May 2019 16:44:52 +0100")

> 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





  parent reply	other threads:[~2019-05-02 19:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-02 15:44 bug#35536: 27.0.50; Expose buffer's marker list to Elisp Basil L. Contovounesios
2019-05-02 16:07 ` Eli Zaretskii
2019-05-02 16:51   ` Basil L. Contovounesios
2019-05-02 17:41     ` Eli Zaretskii
2019-05-03 15:50       ` Basil L. Contovounesios
2019-05-03 16:38         ` Drew Adams
2019-05-03 17:22           ` Basil L. Contovounesios
2019-05-03 17:31             ` Drew Adams
2019-05-03 17:39             ` Stefan Monnier
2019-05-03 17:53               ` Drew Adams
2019-05-03 18:13                 ` Stefan Monnier
2019-05-03 20:05                   ` Drew Adams
2019-05-04 21:25                   ` Richard Stallman
2019-09-16 21:07                     ` Lars Ingebrigtsen
2019-05-03 23:01     ` Mauro Aranda
2019-05-04 17:34       ` martin rudalics
2019-05-02 19:59 ` Stefan Monnier [this message]
2019-05-02 20:05   ` Eli Zaretskii
2019-05-03 15:50   ` Basil L. Contovounesios
2019-05-03 17:09     ` 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=jwvimusvenm.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=35536@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --cc=maurooaranda@gmail.com \
    /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.