From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: charles@aurox.ch (Charles A. Roelli) Newsgroups: gmane.emacs.bugs Subject: bug#17893: 24.4.50; (error "Marker does not point anywhere") Date: Fri, 24 Nov 2017 21:18:36 +0100 Message-ID: References: <8facd635-be88-4990-8e7d-538db19c3e1a@default> <04af8576-c419-4d35-9c6e-7170828ac949@default> <83h8tpdkd4.fsf@gnu.org> <83o9nwd77g.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1511554693 23975 195.159.176.226 (24 Nov 2017 20:18:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 24 Nov 2017 20:18:13 +0000 (UTC) Cc: 17893@debbugs.gnu.org, monnier@IRO.UMontreal.CA To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 24 21:18:09 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 1eIKQI-0005kB-0R for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Nov 2017 21:18:06 +0100 Original-Received: from localhost ([::1]:50950 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIKQP-0003T7-ER for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Nov 2017 15:18:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIKQK-0003T2-7o for bug-gnu-emacs@gnu.org; Fri, 24 Nov 2017 15:18:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIKQF-000239-H1 for bug-gnu-emacs@gnu.org; Fri, 24 Nov 2017 15:18:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47720) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eIKQF-00021u-Cn for bug-gnu-emacs@gnu.org; Fri, 24 Nov 2017 15:18:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eIKQE-0004Rw-1C for bug-gnu-emacs@gnu.org; Fri, 24 Nov 2017 15:18:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: charles@aurox.ch (Charles A. Roelli) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Nov 2017 20:18: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.151155465617073 (code B ref 17893); Fri, 24 Nov 2017 20:18:01 +0000 Original-Received: (at 17893) by debbugs.gnu.org; 24 Nov 2017 20:17:36 +0000 Original-Received: from localhost ([127.0.0.1]:56401 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIKPo-0004RJ-43 for submit@debbugs.gnu.org; Fri, 24 Nov 2017 15:17:36 -0500 Original-Received: from sinyavsky.aurox.ch ([37.35.109.145]:51800) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIKPl-0004R2-L5 for 17893@debbugs.gnu.org; Fri, 24 Nov 2017 15:17:34 -0500 Original-Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 4CD20225D5 for <17893@debbugs.gnu.org>; Fri, 24 Nov 2017 20:10:09 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= references:subject:subject:in-reply-to:to:from:from:message-id :date:date; s=dkim; t=1511554206; x=1512418207; bh=IX6JGxG/egSAN ZkhFl9yqimUtWyHaSGqekNz82p/4fM=; b=wV8JRywEld3effV4scl4HMovlaOZH myrOnqWZkqWmIUvshEH9lRosjxkgxNyzkmnWrgucD4QY3zqHyV/EFtfUnjbmwBb6 Pyrx5rhUpl37vV3vZgv4kouXXJY8B2USFMsDRqd6ESUCRikUBHsg1b7koi5kM9lG m6LLIP76dXFfA0= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Original-Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Z_yCeT1mdA3A for <17893@debbugs.gnu.org>; Fri, 24 Nov 2017 20:10:06 +0000 (UTC) Original-Received: from gray (125.85.192.178.dynamic.wline.res.cust.swisscom.ch [178.192.85.125]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id A20A4225CD; Fri, 24 Nov 2017 20:10:04 +0000 (UTC) In-reply-to: <83o9nwd77g.fsf@gnu.org> (message from Eli Zaretskii on Mon, 20 Nov 2017 22:29:55 +0200) 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:140336 Archived-At: > Date: Mon, 20 Nov 2017 22:29:55 +0200 > From: Eli Zaretskii > CC: monnier@IRO.UMontreal.CA, 17893@debbugs.gnu.org > Reply-to: Eli Zaretskii > > > Date: Mon, 20 Nov 2017 21:01:58 +0100 > > From: charles@aurox.ch (Charles A. Roelli) > > CC: monnier@IRO.UMontreal.CA, 17893@debbugs.gnu.org > > > > > 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). > > > > By C, do you mean the function `clone-buffer'? > > No, I meant what's in marker.c. I suppose the main issue is fixed in master now: > branch: master > commit 197dd690112e8eef6457b16adbe6e2c1d801c849 > Date: Thu, 23 Nov 2017 13:33:34 -0500 (EST) > Author: Stefan Monnier > Commit: Stefan Monnier > > * lisp/simple.el (clone-buffer): Adjust `mark-ring' > --- > lisp/simple.el | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/lisp/simple.el b/lisp/simple.el > index fde6669..41f22b2 100644 > --- a/lisp/simple.el > +++ b/lisp/simple.el > @@ -8516,13 +8516,16 @@ after it has been set up properly in other respects." > > ;; Set up other local variables. > (mapc (lambda (v) > - (condition-case () ;in case var is read-only > + (condition-case () > (if (symbolp v) > (makunbound v) > (set (make-local-variable (car v)) (cdr v))) > - (error nil))) > + (setting-constant nil))) ;E.g. for enable-multibyte-characters. > lvars) > > + (setq mark-ring (mapcar (lambda (mk) (copy-marker (marker-position mk))) > + mark-ring)) > + > ;; Run any hooks (typically set up by the major mode > ;; for cloning to work properly). > (run-hooks 'clone-buffer-hook)) To solve the problem more generally, maybe clone-buffer could look for local variables with a non-nil symbol property (called, say, `clone-buffer-update-function'), the value of which would be a function that updates the "cloned" variable properly. So with mark-ring, you would do something like: (put 'mark-ring 'clone-buffer-update-function (lambda (sym old-buf new-buf) (with-current-buffer new-buf (set sym (with-current-buffer old-buf (mapcar (lambda (mk) (copy-marker (marker-position mk))) mark-ring))))))