From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Calling Lisp from undo.c's record_* functions Date: Tue, 17 Nov 2015 18:24:33 +0200 Message-ID: <83bnasbnlq.fsf@gnu.org> References: <83r3jpc2of.fsf@gnu.org> <87h9kkbz6k.fsf@russet.org.uk> <87d1v8bsbf.fsf@russet.org.uk> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1447777497 7472 80.91.229.3 (17 Nov 2015 16:24:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 Nov 2015 16:24:57 +0000 (UTC) Cc: emacs-devel@gnu.org, phillip.lord@russet.org.uk To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 17 17:24:48 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 1Zyj3k-0002EJ-Ro for ged-emacs-devel@m.gmane.org; Tue, 17 Nov 2015 17:24:44 +0100 Original-Received: from localhost ([::1]:59334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyj3k-0006fY-3v for ged-emacs-devel@m.gmane.org; Tue, 17 Nov 2015 11:24:44 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyj3g-0006fI-N9 for emacs-devel@gnu.org; Tue, 17 Nov 2015 11:24:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zyj3c-0000z7-ME for emacs-devel@gnu.org; Tue, 17 Nov 2015 11:24:40 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:52842) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyj3c-0000z2-Dl for emacs-devel@gnu.org; Tue, 17 Nov 2015 11:24:36 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0NXY00200W1CPM00@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Tue, 17 Nov 2015 18:24:34 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NXY002HVW8XM140@a-mtaout22.012.net.il>; Tue, 17 Nov 2015 18:24:34 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.172 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:194650 Archived-At: > From: Stefan Monnier > Cc: Eli Zaretskii , > Date: Tue, 17 Nov 2015 10:40:39 -0500 > > > 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. Even if run_undoable_change doesn't call Lisp, but instead conses the list by calling Fcons directly? That's what Phillip did on his branch. > 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. Why call this at such a low level? Why not at the level of general_insert_function, Fdelete_region, etc.? (Yes, that would be more places to change, but so what?)