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: Wed, 26 Apr 2017 10:23:23 -0400 Message-ID: <7f8bb205-c311-3360-ad0e-df205240199b@gmail.com> References: <2448005f-9fc4-78b2-3203-9fc8204f6f5b@mit.edu> <87fd6638-f46a-95f2-8b70-f271f5daeb63@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 1493216671 1817 195.159.176.226 (26 Apr 2017 14:24:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 26 Apr 2017 14:24:31 +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 Wed Apr 26 16:24:28 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 1d3Nrl-0000Lz-UE for ged-emacs-devel@m.gmane.org; Wed, 26 Apr 2017 16:24:26 +0200 Original-Received: from localhost ([::1]:55521 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3Nrr-00012q-Ln for ged-emacs-devel@m.gmane.org; Wed, 26 Apr 2017 10:24:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3Nqr-00011R-L4 for emacs-devel@gnu.org; Wed, 26 Apr 2017 10:23:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3Nqn-00019W-QB for emacs-devel@gnu.org; Wed, 26 Apr 2017 10:23:29 -0400 Original-Received: from mail-qk0-x233.google.com ([2607:f8b0:400d:c09::233]:34000) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3Nqn-000197-JW for emacs-devel@gnu.org; Wed, 26 Apr 2017 10:23:25 -0400 Original-Received: by mail-qk0-x233.google.com with SMTP id y63so1915048qkd.1 for ; Wed, 26 Apr 2017 07:23:25 -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=+cOl1Twg8AVxNqiCPZUtAHAyrXFd78TZPTTB9dUZx30=; b=oU+Iv7j21iseRhoIfEGfzn3xojFNLdUdp8RKAlOcNte3ZyUcbUayVXBuE6FUTU4ePS HhHJ3A5cIkwESkNHCU9zRzvpzqwRQJM6siucfVRR0gnczjxM5raCQUpX9lturXmKwyAJ nBTtfDmWf84UlNBYxYTfk1fiG8P5gO8Zf0xhUYGsUXdWT2nPnS69GMqCcZuLa6GJxErv VlEcc0EPVTW4lHSLojSQgA9FI0cGAsyMcmR7usaKFONxVa96nskK3BtyiFzbggQZHpS3 9QqXFh/N2xLHT35S4tyacaiSXFXz0NMYVRysDBMSpRuqU5uLKiWwQil/6Cc7d41mhzPn 0Aew== 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=+cOl1Twg8AVxNqiCPZUtAHAyrXFd78TZPTTB9dUZx30=; b=nTh1/MSv7r7cq9TVajRAACKE3XOjlpq0KX+z+Vwz/Cc30yMtm1r3T3+kn3kBoun17E eQ8djCKSC8d3j3WOCtIEHGKHsVFIac6Lv6x9455zLGvNjlQ3SbWe32DFRE7TYDRzaElT tZgzPevu8ysIcypv4tN0vXWthu8MrbTSVIKri/QWbgAaNpvyowvdTcG5MdXXA7KFtpaJ tz67S0M8TCcJn1SvAwqYHNKgbeRzwNoFHGI/5YCnE/x2ELi47t8mwifKxVSFj35EOjuk cnijQXZ9pEAcLb/LpZNJan3GXWvUI+Er6dwBOvtsimXFRKkSz5y/2RB31OBmvcK8wsjF m2Rg== X-Gm-Message-State: AN3rC/6xsiMcP+E42UcJq9sDCb+I0jX0M5svLghKdaj3h9DzdMbXh3Ad cmaeaOKsl/7IyeyKh5w= X-Received: by 10.55.180.197 with SMTP id d188mr56077qkf.70.1493216604881; Wed, 26 Apr 2017 07:23:24 -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 r129sm259170qkb.16.2017.04.26.07.23.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Apr 2017 07:23:24 -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::233 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:214310 Archived-At: On 2017-04-26 09:52, Stefan Monnier wrote: >>> [ and while you're there, check that the beg/end/len is within the >>> announces beg/end stashed earlier, and if it's not just don't do >>> anything since it means the stash buffer-undo-list is likely >>> unrelated. ] >> This part worries me. Could you clarify when this would happen? > > In rare corner cases (most of them bugs). > >> Not doing anything is risky, because it puts the buffer in an inconsistent >> state wrt the subprocess :/ > > In the case of PG, I'd suggest you treat such a case as > a non-whitespace change. But I can't, can I? The damage (the change) is already done at that point, and I can't revert it. Am I missing something? Clément.