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.devel Subject: undo refactoring Date: Tue, 05 Jul 2016 09:46:46 +0100 Message-ID: <8760skcw09.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 1467709517 7871 80.91.229.3 (5 Jul 2016 09:05:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Jul 2016 09:05:17 +0000 (UTC) Cc: Emacs-Devel devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 05 11:05:05 2016 Return-path: Envelope-to: ged-emacs-devel@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 1bKMHu-0005sy-W6 for ged-emacs-devel@m.gmane.org; Tue, 05 Jul 2016 11:05:03 +0200 Original-Received: from localhost ([::1]:53293 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKMHu-0000Ag-Dh for ged-emacs-devel@m.gmane.org; Tue, 05 Jul 2016 05:05:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKM0L-0004RL-DU for emacs-devel@gnu.org; Tue, 05 Jul 2016 04:46:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKM0G-0006VR-8m for emacs-devel@gnu.org; Tue, 05 Jul 2016 04:46:52 -0400 Original-Received: from cloud103.planethippo.com ([31.216.48.48]:45114) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKM0G-0006VH-1K for emacs-devel@gnu.org; Tue, 05 Jul 2016 04:46:48 -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=is/D7+bjMj/Zkx/kE9oGgG+KlXzOm0JDPerQHyU1KK4=; b=eASqNXDafTRyMUMbhB6Eg1tpVm U0ieohTM0YGh7OU5UePFb3bMCpXVHt96Md5vd2UhMF+mOTEWWitw1ptgKXFj7U5A02YnPed9GtzRy QtWFOfP+FdJ7b+79LA7iUX3Rjqq3k8n2ePxf3TrLqfoxlwZymJJY5K6PqHJWVpx5GimQdcDQXk2Vk 45EeUgj8dCykXC58dNBCcx1j28MJWdmxhm58ZJec/2s998nQJcvMvoKQOSDmUlX5R8MtVGeQEnSKr RFN/sVFE0c3Uj8BKiMRJrNBebnoeMEXQMFB3TWRQOCaqa+xvxIx9R+W8KXmnnbTwZuxU7zqAA8IXs Pp6Bq3jw==; Original-Received: from cpc1-benw10-2-0-cust373.gate.cable.virginm.net ([77.98.219.118]:52245 helo=russet.org.uk) by cloud103.planethippo.com with esmtpsa (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.86_1) (envelope-from ) id 1bKM0F-004NZO-99; Tue, 05 Jul 2016 09:46:47 +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 - 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-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 31.216.48.48 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:205168 Archived-At: I thought to move this to emacs-devel rather than #23781 since it's not directly relevant. I'll think about the FIXME, that I've just added to undo.c, and see if I can update that on master. But also, while reading the code again, I've realised that I don't understand the reason for pre-allocating the boundary, since when it actually used we do this: /* One way or another, cons nil onto the front of the undo list. */ if (!NILP (pending_boundary)) { /* If we have preallocated the cons cell to use here, use that one. */ XSETCDR (pending_boundary, BVAR (current_buffer, undo_list)); bset_undo_list (current_buffer, pending_boundary); pending_boundary = Qnil; } else bset_undo_list (current_buffer, Fcons (Qnil, BVAR (current_buffer, undo_list))); Why not just do bset_undo_list (current_buffer, Fcons (Qnil, BVAR (current_buffer, undo_list))); and remove all references to pending_boundary (and therefore `prepare_record` which is now rather badly named)? Or am I missing something Phil