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 11:49:04 -0500 Message-ID: References: <83r3jpc2of.fsf@gnu.org> <87h9kkbz6k.fsf@russet.org.uk> <87d1v8bsbf.fsf@russet.org.uk> <83bnasbnlq.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1447778971 860 80.91.229.3 (17 Nov 2015 16:49:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 Nov 2015 16:49:31 +0000 (UTC) Cc: emacs-devel@gnu.org, phillip.lord@russet.org.uk To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 17 17:49:22 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 1ZyjRV-0004qK-HY for ged-emacs-devel@m.gmane.org; Tue, 17 Nov 2015 17:49:17 +0100 Original-Received: from localhost ([::1]:59446 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyjRU-0000Ec-Vl for ged-emacs-devel@m.gmane.org; Tue, 17 Nov 2015 11:49:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyjRS-0000EL-5e for emacs-devel@gnu.org; Tue, 17 Nov 2015 11:49:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZyjRO-0007vB-3h for emacs-devel@gnu.org; Tue, 17 Nov 2015 11:49:14 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:64201) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyjRK-0007uC-5l; Tue, 17 Nov 2015 11:49:06 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BcFgA731xV/++ZWxdcgxCEAoVVu0CDY4NoBAICgTw6EwEBAQEBAQGBCkEFg10BAQMBViMFCws0EhQYDSQuiAkIzyMBAQEBBgEBAQEeizqFBQeELQWMMJ5LigkjgWYkHIFwIIJ4AQEB X-IPAS-Result: A0BcFgA731xV/++ZWxdcgxCEAoVVu0CDY4NoBAICgTw6EwEBAQEBAQGBCkEFg10BAQMBViMFCws0EhQYDSQuiAkIzyMBAQEBBgEBAQEeizqFBQeELQWMMJ5LigkjgWYkHIFwIIJ4AQEB X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="178488409" 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 11:49:04 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 78979627BD; Tue, 17 Nov 2015 11:49:04 -0500 (EST) In-Reply-To: <83bnasbnlq.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 17 Nov 2015 18:24:33 +0200") 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:194653 Archived-At: >> 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. > Even if run_undoable_change doesn't call Lisp, but instead conses the > list by calling Fcons directly? My answers were assuming that we want a solution that keeps using Elisp for run_undoable_change. > That's what Phillip did on his branch. Yes, I saw that branch, but that's a separate thread. >> 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. > Beware: prepare_to_modify_buffer is not always called. When would it not be called? You mean there are cases where we'd add stuff to the undo list but we don't run before-change-functions? Wouldn't that be a bug? > Why call this at such a low level? To me, prepare_to_modify_buffer is actually higher-level than record_insert. > Why not at the level of general_insert_function, Fdelete_region, etc.? > (Yes, that would be more places to change, but so what?) Yes, we could push it to an even higher level, but if prepare_to_modify_buffer works, it's preferable, I think. In any case, these are just suggestions, I don't have strong opinions on these issues now ;-) Stefan