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: Re: Calling Lisp from undo.c's record_* functions Date: Tue, 17 Nov 2015 21:02:49 +0000 Message-ID: <87fv04mj9i.fsf@russet.org.uk> 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 1447794195 26711 80.91.229.3 (17 Nov 2015 21:03:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 Nov 2015 21:03:15 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 17 22:03:06 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 1ZynP3-0000Vt-Iv for ged-emacs-devel@m.gmane.org; Tue, 17 Nov 2015 22:03:01 +0100 Original-Received: from localhost ([::1]:60640 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZynP2-0007tE-Oq for ged-emacs-devel@m.gmane.org; Tue, 17 Nov 2015 16:03:00 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZynOz-0007sV-8O for emacs-devel@gnu.org; Tue, 17 Nov 2015 16:02:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZynOy-00057s-5Q for emacs-devel@gnu.org; Tue, 17 Nov 2015 16:02:57 -0500 Original-Received: from cheviot22.ncl.ac.uk ([128.240.234.22]:35992) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZynOt-00056q-97; Tue, 17 Nov 2015 16:02:51 -0500 Original-Received: from smtpauth-vm.ncl.ac.uk ([10.8.233.129] helo=smtpauth.ncl.ac.uk) by cheviot22.ncl.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1ZynOs-0004tT-F8; Tue, 17 Nov 2015 21:02:50 +0000 Original-Received: from cpc6-benw10-2-0-cust45.gate.cable.virginm.net ([92.238.179.46] helo=localhost) by smtpauth.ncl.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1ZynOs-0004E3-Go; Tue, 17 Nov 2015 21:02:50 +0000 In-Reply-To: (Stefan Monnier's message of "Tue, 17 Nov 2015 11:49:04 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 128.240.234.22 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:194669 Archived-At: Stefan Monnier writes: > 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. I just wanted to see if it worked. I don't intend the branch to necessarily be the right fix. I would prefer not to be moving functionality back to C if possible. >>> 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? Actually, b-c-f is called by prepare_to_modify_buffer_1, so this conclusion isn't valid. As far as I can tell, changing a text property will result in changes to the undo list, but doesn't call prepare_to_modify_buffer. Rather modify_text_properties appears to call prepare_to_modify_buffer_1 directly. Bit surprising -- I wouldn't have expected a function called "blah_1" to be called directly from anywhere other than "blah". >> 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 ;-) I've pushed a branch which moves the run_undoable_change functionality to insdel.c instead. I've moved the entire function which seems to make more sense to me. All other functionality remains in lisp. Phil