From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#17893: 24.4.50; (error "Marker does not point anywhere") Date: Mon, 20 Nov 2017 17:45:43 +0200 Message-ID: <83h8tpdkd4.fsf@gnu.org> References: <8facd635-be88-4990-8e7d-538db19c3e1a@default> <04af8576-c419-4d35-9c6e-7170828ac949@default> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1511192850 26870 195.159.176.226 (20 Nov 2017 15:47:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 20 Nov 2017 15:47:30 +0000 (UTC) Cc: 17893@debbugs.gnu.org, monnier@IRO.UMontreal.CA To: charles@aurox.ch (Charles A. Roelli) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 20 16:47:25 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eGoI1-0005s0-9R for geb-bug-gnu-emacs@m.gmane.org; Mon, 20 Nov 2017 16:47:17 +0100 Original-Received: from localhost ([::1]:57990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGoI0-0007PD-EO for geb-bug-gnu-emacs@m.gmane.org; Mon, 20 Nov 2017 10:47:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGoHq-0007P5-14 for bug-gnu-emacs@gnu.org; Mon, 20 Nov 2017 10:47:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGoHm-00014h-3e for bug-gnu-emacs@gnu.org; Mon, 20 Nov 2017 10:47:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40534) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eGoHl-00014d-Vw for bug-gnu-emacs@gnu.org; Mon, 20 Nov 2017 10:47:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eGoHl-0008MD-Pv for bug-gnu-emacs@gnu.org; Mon, 20 Nov 2017 10:47:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Nov 2017 15:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17893 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17893-submit@debbugs.gnu.org id=B17893.151119276532009 (code B ref 17893); Mon, 20 Nov 2017 15:47:01 +0000 Original-Received: (at 17893) by debbugs.gnu.org; 20 Nov 2017 15:46:05 +0000 Original-Received: from localhost ([127.0.0.1]:49214 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eGoGr-0008KD-Eg for submit@debbugs.gnu.org; Mon, 20 Nov 2017 10:46:05 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:39607) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eGoGn-0008JD-9F for 17893@debbugs.gnu.org; Mon, 20 Nov 2017 10:46:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGoGe-0000Wq-3s for 17893@debbugs.gnu.org; Mon, 20 Nov 2017 10:45:56 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42659) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGoGe-0000Wj-06; Mon, 20 Nov 2017 10:45:52 -0500 Original-Received: from [176.228.60.248] (port=2840 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eGoGd-00013L-B7; Mon, 20 Nov 2017 10:45:51 -0500 In-reply-to: (charles@aurox.ch) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:140142 Archived-At: > Date: Sun, 19 Nov 2017 20:31:06 +0100 > From: charles@aurox.ch (Charles A. Roelli) > Cc: 17893@debbugs.gnu.org > > > Yup, sounds like we have a bug in clone-buffer, at least. > > > > > > Stefan > > Right-o, here's a fix with respect to the emacs-26 branch: > > diff --git a/lisp/simple.el b/lisp/simple.el > index 7d47d0f..64b7bde 100644 > --- a/lisp/simple.el > +++ b/lisp/simple.el > @@ -8518,6 +8518,15 @@ clone-buffer > (error nil))) > lvars) > > + ;; Update markers in the copied mark ring to refer to the new buffer. > + (setq mark-ring > + (mapcar (lambda (m) > + (let ((new-marker)) > + (setq new-marker (copy-marker m)) > + (move-marker new-marker new-marker (current-buffer)) > + new-marker)) > + mark-ring)) > + > ;; Run any hooks (typically set up by the major mode > ;; for cloning to work properly). > (run-hooks 'clone-buffer-hook)) > > It fixes the minimal recipe to reproduce this bug: Bother: this is actually the tip of an iceberg. Buffer local variables that get cloned by clone-buffer could hold any number of markers pointing into the original buffer. 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. For mark-ring, I think it's easier to just reset it to nil in the new clone (it's arguably even more correct, since this is a fresh 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).