From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 17893@debbugs.gnu.org, charles@aurox.ch
Subject: bug#17893: 24.4.50; (error "Marker does not point anywhere")
Date: Mon, 20 Nov 2017 13:59:12 -0500 [thread overview]
Message-ID: <jwv3758ssei.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <837eukesxg.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 20 Nov 2017 19:55:23 +0200")
>> > 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-n
> M-: Info-tag-table-marker RET
> => #<marker in no buffer>
Maybe there's a bug, indeed. Does the above lead to undesired behavior?
[ It's been a while since I last looked at those things. ]
> I guess we will have to walk all the local variables and find markers
> in them, like GC does. Is there any other way?
I don't think it can be done reliably: whether a marker needs to be
cloned or not may depend on what the marker is used for; and some of the
markers that need to be cloned could be stored elsewhere than in
buffer-local vars.
And in order to clone such a marker, we'd need to clone all objects
found on the "spine" between the local var and the marker. In some
cases such a "clone" is again difficult to do automatically and
reliably, because what needs to be done again will depend on semantic
details to which such a generic code at the C level doesn't have access.
>> 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.
No. It just assumes that whichever package owns a marker that needs
special treatment should register itself on that hook. Maybe that's too
much to ask, but it's definitely not "impossible".
> For example, the user could have set all kinds of local variables
> behind the back of Emacs which hold markers.
Then it's his responsibility to add a function to clone-buffer-hook to
handle those (in the unlikely case that she actually cares about
interaction between those vars and clone-buffer, that is).
> 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.
Do these suffer from problems? When I introduced clone-buffer
(motivated by Info-mode), I also introduced the Info-clone-buffer hook
function because it was simply indispensable to get it working.
But I remember using it in other cases where such a hook didn't
seem necessary.
Stefan
next prev parent reply other threads:[~2017-11-20 18:59 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-01 21:10 bug#17893: 24.4.50; (error "Marker does not point anywhere") Drew Adams
2014-07-01 22:42 ` Stefan Monnier
2014-07-02 1:17 ` Drew Adams
2014-07-02 2:11 ` Stefan Monnier
2014-07-02 2:49 ` Drew Adams
2014-07-02 14:09 ` Stefan Monnier
2014-07-02 14:22 ` Drew Adams
2014-07-02 14:58 ` Stefan Monnier
2014-07-02 16:08 ` Drew Adams
2014-07-02 18:24 ` Stefan Monnier
2014-07-02 18:39 ` Drew Adams
2014-07-02 18:58 ` Stephen Berman
2014-07-15 16:19 ` Drew Adams
2017-11-12 10:41 ` Charles A. Roelli
2017-11-12 21:03 ` Stefan Monnier
2017-11-14 19:56 ` Charles A. Roelli
2017-11-14 20:08 ` Stefan Monnier
2017-11-19 19:31 ` Charles A. Roelli
2017-11-20 15:45 ` Eli Zaretskii
2017-11-20 16:51 ` Stefan Monnier
2017-11-20 17:55 ` Eli Zaretskii
2017-11-20 18:59 ` Stefan Monnier [this message]
2017-11-20 19:32 ` Eli Zaretskii
2017-11-20 19:49 ` Andreas Schwab
2017-11-20 20:01 ` Charles A. Roelli
2017-11-20 20:29 ` Eli Zaretskii
2017-11-24 20:18 ` Charles A. Roelli
2017-11-24 20:39 ` Eli Zaretskii
2017-11-25 14:13 ` Charles A. Roelli
2017-11-25 16:06 ` Eli Zaretskii
2017-11-25 16:48 ` Stefan Monnier
2017-11-25 17:20 ` Eli Zaretskii
2017-11-25 18:30 ` Andreas Schwab
2017-11-25 19:23 ` Eli Zaretskii
2017-11-25 20:47 ` Andreas Schwab
2017-11-26 10:26 ` martin rudalics
2017-11-26 16:07 ` Eli Zaretskii
2017-11-27 8:50 ` martin rudalics
2017-11-27 9:54 ` Andreas Schwab
2017-11-27 10:02 ` martin rudalics
2017-11-24 21:22 ` 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv3758ssei.fsf-monnier+emacsbugs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=17893@debbugs.gnu.org \
--cc=charles@aurox.ch \
--cc=eliz@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).