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: Mon, 16 Nov 2015 21:51:49 +0000 Message-ID: <87fv053956.fsf@russet.org.uk> References: <83r3jpc2of.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1447722240 32369 80.91.229.3 (17 Nov 2015 01:04:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 Nov 2015 01:04:00 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 17 02:03:53 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 1ZyUgH-0006Cv-VH for ged-emacs-devel@m.gmane.org; Tue, 17 Nov 2015 02:03:34 +0100 Original-Received: from localhost ([::1]:53893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyUgH-0004iL-I8 for ged-emacs-devel@m.gmane.org; Mon, 16 Nov 2015 20:03:33 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47344) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZySAA-0007kc-Q2 for emacs-devel@gnu.org; Mon, 16 Nov 2015 17:22:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZySA9-0001SM-W6 for emacs-devel@gnu.org; Mon, 16 Nov 2015 17:22:14 -0500 Original-Received: from cheviot12.ncl.ac.uk ([128.240.234.12]:37744) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZySA6-0001QQ-6U; Mon, 16 Nov 2015 17:22:10 -0500 Original-Received: from smtpauth-vm.ncl.ac.uk ([10.8.233.129] helo=smtpauth.ncl.ac.uk) by cheviot12.ncl.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1ZyRgs-0001fx-9u; Mon, 16 Nov 2015 21:51:58 +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 1ZyRgq-0004lu-Vu; Mon, 16 Nov 2015 21:51:57 +0000 In-Reply-To: <83r3jpc2of.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 16 Nov 2015 18:46:40 +0200") 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.12 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:194608 Archived-At: Eli Zaretskii writes: > Question #1: do we really need to call Lisp from so deep inside the > bowels of buffer manipulation routines? Is that safe? Perhaps we > should reimplement undo-auto--undoable-change inC? > > Question #2: one solution is inhibit GC in run_undoable_change. But > since that could run arbitrary Lisp, is that a good idea? what if we > run out of memory? > > Question #3: another possible solution is to set the current buffer's > inhibit_shrinking flag around the call to Lisp in run_undoable_change > -- is this better? Note that this won't prevent GC in general, so the > follow-up question is can insdel.c functions afford a GC while they > run? > > Comments? Suggestions? Bah. I spent ages getting that working, and then you go and break it! My immediate response would be a variation on #1. All undo-auto--undoable-change really does is a "add-to-list" call. Easy to reimplement this into C, I think. The second thing it does is ensure that a timer is being run, which seems a bit harder. Using an idle timer (the timer only does anything when there are no commands happening) would solve the problem, although (obviously) the timer would run when Emacs is entirely idle. I'd be happy for Stefan to comment, as well. Phil