From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: How can I undo a change from a modification-hook? Date: Thu, 27 Apr 2017 08:58:53 -0400 Message-ID: References: <2448005f-9fc4-78b2-3203-9fc8204f6f5b@mit.edu> <87fd6638-f46a-95f2-8b70-f271f5daeb63@gmail.com> <7f8bb205-c311-3360-ad0e-df205240199b@gmail.com> <2ee71c70-50a2-b054-ee87-5a28fc7776cb@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1493297947 25077 195.159.176.226 (27 Apr 2017 12:59:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 27 Apr 2017 12:59:07 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 27 14:59:04 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d3j0g-0006Pb-85 for ged-emacs-devel@m.gmane.org; Thu, 27 Apr 2017 14:59:02 +0200 Original-Received: from localhost ([::1]:60608 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3j0m-0006L5-0m for ged-emacs-devel@m.gmane.org; Thu, 27 Apr 2017 08:59:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3j0d-0006Jz-CQ for emacs-devel@gnu.org; Thu, 27 Apr 2017 08:59:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3j0Z-0001WC-HW for emacs-devel@gnu.org; Thu, 27 Apr 2017 08:58:59 -0400 Original-Received: from mail-qk0-x22d.google.com ([2607:f8b0:400d:c09::22d]:35229) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3j0Z-0001Vz-BH for emacs-devel@gnu.org; Thu, 27 Apr 2017 08:58:55 -0400 Original-Received: by mail-qk0-x22d.google.com with SMTP id f76so26311418qke.2 for ; Thu, 27 Apr 2017 05:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=2R5u7ws1E5j6xe2HrneqpD34o39mhbKfvluYHW5YNmw=; b=UitEIVYELvKGMQnfjIZL4T13ep4voviMdd9weTUfIZfgmWnIHReRReJ2RhKLdMsZ8d 6wp521LZRw4eNHnM8AxN9SUlKfOKaDYFaViS7nE1F1NbeEyD8bL7ouMNoKecYmglX0Vy qNHKTchsFdwXOod43jNF9fY+TiVW0w12DmrGCbomZ0PGBnDNG54XkQbHUtYggT/nsH1j dDzbUDWsOM903cpcUNGq+n1/Y8VxxYLq+bJXm1t/lzOomTd2g1XyfsLk9Hy0FUbTf52E wodXwmodviSuyLWm7hCmkSVD284Cx2tBswmQh6VXET94VhX/xxJpZFm/mfiuuYepr8vG S/Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=2R5u7ws1E5j6xe2HrneqpD34o39mhbKfvluYHW5YNmw=; b=NmGYpBHJ3mQnsA2NJ8UMxgdRHPvmYMh4GedbY8D52KRNzcbSf/R4bUo182h862SMDj csb/EFa19gyicJSXFbkPKFscI7iVqXX8eiJIeOxWOTSxfs2JORLA5UcfRa5aQ2QvIeEy SYzUCJxX4jRQjGdv9ZVw5QUpTSSR0BV5pOIMjY3Q5Svng2emDV2H1f108LMbpUIg2dr9 LLlbyD972i6BLh7uiuJyCMRMclE++jy9We9K5XXBFc2Mq7+X5fl6z5u0cEwwkrCZsvYH 6+CqtdkWYAgNaoYzGliv7q1H/uZMhv/z1rxvwUhFkA9zjosfHiosORXR4CwPOoibSPo7 TttQ== X-Gm-Message-State: AN3rC/51JKiKv1AvVv65/lOXRVyCRFowH8+hSP83o1QS6v+FeXIZJJdM mHpbXLqNAYO/X6Yu0Kk= X-Received: by 10.55.0.65 with SMTP id 62mr4478057qka.158.1493297934639; Thu, 27 Apr 2017 05:58:54 -0700 (PDT) Original-Received: from [18.189.26.125] (dhcp-18-189-26-125.dyn.MIT.EDU. [18.189.26.125]) by smtp.gmail.com with ESMTPSA id q30sm1583498qkh.39.2017.04.27.05.58.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:58:54 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::22d X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:214342 Archived-At: On 2017-04-27 08:48, Stefan Monnier wrote: >> Of course, I could rewrite the queuing logic to be more resilient to this >> kind of changes. But the question is about ways to prevent edits, and >> I think it's more general than this particular example. > > Then I woulnd't worry too much about it: the cases where the after-hook > is called "outside" of the before hook's beg/end are basically bugs and > IIUC there are no known remaining cases in Emacs-26 (IIRC there are some > known cases in Emacs-25 where this occurs, mostly in > insert-file-contents (i.e. revert-buffer)). Got it, thanks. I already have specialized code for revert-buffer, so that should be fine. What happens if a deletion causes an overlay to evaporate? The undo list doesn't record that, does it? Or will the evaporation be delayed until all modification hooks have run? Clément.