From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Calling Lisp from undo.c's record_* functions Date: Tue, 17 Nov 2015 10:40:39 -0500 Message-ID: References: <83r3jpc2of.fsf@gnu.org> <87h9kkbz6k.fsf@russet.org.uk> <87d1v8bsbf.fsf@russet.org.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1447774866 27198 80.91.229.3 (17 Nov 2015 15:41:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 Nov 2015 15:41:06 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org To: phillip.lord@russet.org.uk (Phillip Lord) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 17 16:40:57 2015 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 1ZyiNJ-0007Tf-7m for ged-emacs-devel@m.gmane.org; Tue, 17 Nov 2015 16:40:53 +0100 Original-Received: from localhost ([::1]:59170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyiNI-0005Mv-MO for ged-emacs-devel@m.gmane.org; Tue, 17 Nov 2015 10:40:52 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyiNC-0005Mm-PX for emacs-devel@gnu.org; Tue, 17 Nov 2015 10:40:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZyiNB-000541-R3 for emacs-devel@gnu.org; Tue, 17 Nov 2015 10:40:46 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:31631) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyiN7-00053B-0q; Tue, 17 Nov 2015 10:40:41 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BQEwA731xV/++ZWxdcgxCEAoVVuzcJg2ODaAQCAoE8ORQBAQEBAQEBgQpBBYNdAQEDAVYjBQsLNBIUGA2IWwjPIwEBAQEGAQEBAR6LOoUFB4QtBYwwnkuKCSOEFiCCeAEBAQ X-IPAS-Result: A0BQEwA731xV/++ZWxdcgxCEAoVVuzcJg2ODaAQCAoE8ORQBAQEBAQEBgQpBBYNdAQEDAVYjBQsLNBIUGA2IWwjPIwEBAQEGAQEBAR6LOoUFB4QtBYwwnkuKCSOEFiCCeAEBAQ X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="178479141" Original-Received: from 23-91-153-239.cpe.pppoe.ca (HELO pastel.home) ([23.91.153.239]) by ironport2-out.teksavvy.com with ESMTP; 17 Nov 2015 10:40:40 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 9BF09623CB; Tue, 17 Nov 2015 10:40:39 -0500 (EST) In-Reply-To: <87d1v8bsbf.fsf@russet.org.uk> (Phillip Lord's message of "Tue, 17 Nov 2015 14:42:44 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:194644 Archived-At: > In theory, therefore, we should already be safe? Or can the critical > section be longer than a single function call to undo.c? Could the > unsafe period cover several calls? The problem is not in undo.c but in the fact that insdel.c calls record_insert at a moment where Elisp code can't be run. So the call to record_insert would need to be moved. But of course, in reality it's not the whole record_insert that needs to be moved, only the run_undoable_change within it. So if it's difficult to move record_insert to safe spot, maybe we should take run_undoable_change out of it. E.g. maybe we could call run_undoable_change from prepare_to_modify_buffer instead. Stefan