[Top][All Lists]

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

bug#17893: 24.4.50; (error "Marker does not point anywhere")

From: Eli Zaretskii
Subject: bug#17893: 24.4.50; (error "Marker does not point anywhere")
Date: Mon, 20 Nov 2017 19:55:23 +0200

> From: Stefan Monnier <address@hidden>
> Cc: address@hidden (Charles A. Roelli),  address@hidden
> Date: Mon, 20 Nov 2017 11:51:45 -0500
> > E.g., info.el itself maintains a per-buffer marker in
> > Info-tag-table-marker; evaluate it after M-n and see what it
> > tells you.
> And for that reason, clone-buffer runs `clone-buffer-hook`, which
> Info-mode uses to do:

If so, it doesn't work well enough:

 emacs -Q
 C-u C-h i elisp.info RET
 M-: Info-tag-table-marker RET
  => #<marker at 3901363 in *info*>
 M-: Info-tag-table-marker RET
  => #<marker in no buffer>

> > but in general this is a ticking bomb, unless I'm missing something.
> > If I'm right, the only solution is to walk all the markers that point
> > to the parent buffer and clone them to point to the cloned buffer
> > (this has to be done in C).
> This can't be done in C because after creating those new markers, where
> would we store them?  E.g. cloning all the markers that are in
> `mark-ring` would just create new markers but it would fail to create
> a new list holding those markers, stored in the new buffer-local value
> of `mark-ring` (walking the markers doesn't tell us that they're
> referred to from `mark-ring`).

I guess we will have to walk all the local variables and find markers
in them, like GC does.  Is there any other way?

> Hence clone-buffer-hook, which doesn't solve the problem in itself, but
> makes it possible to fix it manually where needed.

I think this kind of problems is impossible to solve from Lisp, as we
don't expose enough information about markers, and for a good reason.
For starters, that hook assumes that every mode knows exactly what
local variables could need special handling, but that's an illusion.
For example, the user could have set all kinds of local variables
behind the back of Emacs which hold markers.

As another data point, there are 6 users of clone-buffer in Emacs
core, and only one of them bothers to set up a clone-buffer-hook.

reply via email to

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