From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@russet.org.uk (Phillip Lord) Newsgroups: gmane.emacs.bugs Subject: bug#23871: 25.1.50; Undo unexpectedly leads to blank buffer Date: Tue, 05 Jul 2016 09:43:47 +0100 Message-ID: <87d1mscw58.fsf@russet.org.uk> References: <83h9cavdgj.fsf@gnu.org> <87poqyy2tc.fsf@metalevel.at> <87vb0qqrkz.fsf@russet.org.uk> <87h9c9zx75.fsf@metalevel.at> <834m89vmyv.fsf@gnu.org> <878txlsbdb.fsf@russet.org.uk> <87furtccdv.fsf@metalevel.at> <877fd5q9te.fsf@russet.org.uk> <83bn2gtruk.fsf@gnu.org> <87k2h37pvb.fsf@russet.org.uk> <87vb0lta67.fsf@russet.org.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1467708544 24817 80.91.229.3 (5 Jul 2016 08:49:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Jul 2016 08:49:04 +0000 (UTC) Cc: 23871@debbugs.gnu.org, triska@metalevel.at To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 05 10:48:52 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bKM2E-0005Zw-DB for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Jul 2016 10:48:50 +0200 Original-Received: from localhost ([::1]:53184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKM2D-0005ok-JT for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Jul 2016 04:48:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44775) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKLyc-0002Ux-37 for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2016 04:45:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKLyY-0006AN-Ds for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2016 04:45:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53605) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKLyY-0006AJ-9g for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2016 04:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bKLyY-0000uC-1Z for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2016 04:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: phillip.lord@russet.org.uk (Phillip Lord) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Jul 2016 08:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23871 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23871-submit@debbugs.gnu.org id=B23871.14677082433392 (code B ref 23871); Tue, 05 Jul 2016 08:45:01 +0000 Original-Received: (at 23871) by debbugs.gnu.org; 5 Jul 2016 08:44:03 +0000 Original-Received: from localhost ([127.0.0.1]:37709 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKLxb-0000se-7r for submit@debbugs.gnu.org; Tue, 05 Jul 2016 04:44:03 -0400 Original-Received: from cloud103.planethippo.com ([31.216.48.48]:48750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKLxY-0000s1-Ox for 23871@debbugs.gnu.org; Tue, 05 Jul 2016 04:44:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=russet.org.uk; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:Cc:To:From; bh=NNPRJg5j7K6MtDQcPQ/mE1S+dzBCcP53TsdSgXcLREs=; b=LFJvW7kFkCGCKVxCr2+qLkU2CY WleXvGw/dESHvlt0T4qo/quxLcqix75gsEOD1FNtHEz+Kqpug5uxFhzB9U3qwCQLQ+yvuYQHOkfcT IC7xXT4Ccgaue9iKfzs1isNwEB4QlGNnwbhegVnYO4cpO4tCsxaoMEIJwKNGYQBWckHWsZxHY9lBS D7cr/zvLmcIOZ0RenhIik+kt8dvTJyvl9uvh55jfNynqqrpYHX/uBskVoagTFPgXtxj+y+PURzvNV v9N0DRCqy3apyYEoW+6Cvp5mGs1BxCu5xwHqulRK+/X3zDweg6hyNlec940xWWWXskelduz30Pa13 sP1AzEYw==; Original-Received: from cpc1-benw10-2-0-cust373.gate.cable.virginm.net ([77.98.219.118]:52242 helo=russet.org.uk) by cloud103.planethippo.com with esmtpsa (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.86_1) (envelope-from ) id 1bKLxR-004N6o-T5; Tue, 05 Jul 2016 09:43:54 +0100 In-Reply-To: (Stefan Monnier's message of "Mon, 04 Jul 2016 17:32:45 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95 (gnu/linux) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cloud103.planethippo.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - russet.org.uk X-Get-Message-Sender-Via: cloud103.planethippo.com: authenticated_id: phillip.lord@russet.org.uk X-Authenticated-Sender: cloud103.planethippo.com: phillip.lord@russet.org.uk 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:120429 Archived-At: Stefan Monnier writes: >>> BTW, I notice that in the current code (emacs-25), there's one other >>> call to record_first_change (in record_property_change), and it could be >>> replaced with a call to prepare_record, so it begs the question whether >>> the above hunk should also apply to record_property_change as well. > >> Don't understand. > > In record_property_change we have (among other things) the exact same > code as in prepare_record (i.e. there's code duplication). So we > could/should replace those 4 lines of code with a call to > prepare_record. But if we do, then your (previous) patch changes the > behavior of record_property_change, whereas if we don't, your (previous) > patch doesn't change its behavior. > Anyway, your new patch addresses this. Good! > > More complex but more robust. I think it'd be worthwhile to put a FIXME > comment in there, at least. E.g. the above explanation should be put > inside the code. Done. > I think the comment should explain the intention better. > It is currently too close to a simple paraphrase of the code. Yeah, I tell my students off for doing that. > I suggest "If it's the first change since the last boundary, and the > upcoming undo record wouldn't restore point correctly, then record where > it was". I've updated it (with a something a bit longer). > Other than that it looks good, thank you for the detailed explanation. I have pushed this to emacs-25, since Eli was happy with the last version, and you're happy with this. Phil