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 12:34:08 -0500 Message-ID: References: <83r3jpc2of.fsf@gnu.org> <87h9kkbz6k.fsf@russet.org.uk> <87d1v8bsbf.fsf@russet.org.uk> <83bnasbnlq.fsf@gnu.org> <836110blpb.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1447781683 15694 80.91.229.3 (17 Nov 2015 17:34:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 Nov 2015 17:34:43 +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 18:34:34 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 1Zyk9J-00063a-Lg for ged-emacs-devel@m.gmane.org; Tue, 17 Nov 2015 18:34:33 +0100 Original-Received: from localhost ([::1]:59917 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyk9J-0000IN-2q for ged-emacs-devel@m.gmane.org; Tue, 17 Nov 2015 12:34:33 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyk95-0008Te-OI for emacs-devel@gnu.org; Tue, 17 Nov 2015 12:34:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zyk94-0003ui-RK for emacs-devel@gnu.org; Tue, 17 Nov 2015 12:34:19 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:24227) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyk8w-0003tb-86; Tue, 17 Nov 2015 12:34:10 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BbFgA731xV/++ZWxdcgxCEAoVVu0CDY4NoBAICgTw6EwEBAQEBAQGBCkEFg10BAQMBViMQCzQSFBgNJC6ICQjPIwEBAQEGAQEBAR6LOoUFB4QtBYwwnkuKCSOEFiCCeAEBAQ X-IPAS-Result: A0BbFgA731xV/++ZWxdcgxCEAoVVu0CDY4NoBAICgTw6EwEBAQEBAQGBCkEFg10BAQMBViMQCzQSFBgNJC6ICQjPIwEBAQEGAQEBAR6LOoUFB4QtBYwwnkuKCSOEFiCCeAEBAQ X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="178493508" 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 12:34:08 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id BE0CE627BD; Tue, 17 Nov 2015 12:34:08 -0500 (EST) In-Reply-To: <836110blpb.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 17 Nov 2015 19:05:36 +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:194659 Archived-At: >> When would it not be called? > E.g., in insert_from_gap. Also, in many insdel.c functions when they > are called with the PREPARE argument false. AFAIK these are cases where prepare_to_modify_buffer has already been called earlier. >> You mean there are cases where we'd add stuff to the undo list but >> we don't run before-change-functions? > I don't know. I don't think we have such bugs, but thinking is one > thing and convincing yourself it's true by looking at the callers is > something entirely different... That's OK, then: I believe that failing to call run_undoable_change is not more serious than failing to run before-change-functions. So I think moving the call to run_undoable_change into prepare_to_modify_buffer is n attractive solution to this problem, since it preserves the use of Elisp, and it probably also simplifies the code (since we can remove most/all other calls to run_undoable_change). Stefan