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 09:45:50 -0400 Message-ID: <87fd6638-f46a-95f2-8b70-f271f5daeb63@gmail.com> References: <2448005f-9fc4-78b2-3203-9fc8204f6f5b@mit.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1493214417 4794 195.159.176.226 (26 Apr 2017 13:46:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 26 Apr 2017 13:46:57 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 To: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 26 15:46:48 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 1d3NHL-0000yn-79 for ged-emacs-devel@m.gmane.org; Wed, 26 Apr 2017 15:46:47 +0200 Original-Received: from localhost ([::1]:55323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3NHQ-0000pB-TP for ged-emacs-devel@m.gmane.org; Wed, 26 Apr 2017 09:46:52 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3NGY-0000o7-TC for emacs-devel@gnu.org; Wed, 26 Apr 2017 09:46:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3NGT-0001kE-30 for emacs-devel@gnu.org; Wed, 26 Apr 2017 09:45:58 -0400 Original-Received: from mail-qk0-x22b.google.com ([2607:f8b0:400d:c09::22b]:35345) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3NGS-0001k9-UN for emacs-devel@gnu.org; Wed, 26 Apr 2017 09:45:53 -0400 Original-Received: by mail-qk0-x22b.google.com with SMTP id f76so739238qke.2 for ; Wed, 26 Apr 2017 06:45:52 -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=n3ybYQtYXtkExFk6UCn5L9kvviMwv7o2J0Y1rQeGV1E=; b=F3GUnG4315o1iGNyJea2MRFrnA43RjZ7S0BR0I6yHxkEocTxmTZSlhTMbyqWIWP7it o3mp80QFIk3sjHgrWsQiCjfsX3iq6OPoJkIYh5TCND1T73+HraGg/KqpTrfBsMy5wUgM XfJDpTkAaEY9XZFLjNcdZnVhj1bBsasZzbulIa9rrao7s8Aj7mAXkpE+91KGIE3ZNoFO I/rpf1yrN4f6IJt4OAfK4cyFgZyx2NrPlZIdVYM6p6EvMvtvXuMDaXBjQ6Wyt08HSaBe Hx/g56Kka+SKa+7nEmLuka125Opluva4Xol3wGf4irVtH9ObtPaGSWrCLTCDj7gMpGgw caGg== 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=n3ybYQtYXtkExFk6UCn5L9kvviMwv7o2J0Y1rQeGV1E=; b=PTSK0IM2JMI0P8uGGxUelHZ3JxNSX0rZ7L+c38/iE0Ed3dtI9q8Ds6jbtTFkptYb0q FEdKFlxe/To3q15ZO5w0WQrA9SPWg3PdCeG0JRdVRgTYvLZewBC7nyrvLqrrsO3g1Cde 5ueisH4ireyTo7LdCOo+eAo3+udTf9aN732tbD3U28vU8eX64hbogmakbZFptzXj3gAn zUWDLTjkQqqX4Ihm8Jz55PBH/8VcxR1UOEPrhbx4Ln+Hp8cjLKV7VDZHlbH+v9/AiKB4 aZ3Fx1aW46SodzmgyffvPHfrkGCnJB6X4FF4d4Fy0M5kj87+ihuInzpnyRlGnABlBzKp lKkg== X-Gm-Message-State: AN3rC/6HNKZ0hGUG94LvNk6lyPQzPpW29BnV3KDn95h13HPhubdmgVHj 2O3wa1RhzdhRbQ== X-Received: by 10.55.115.67 with SMTP id o64mr34252920qkc.216.1493214352200; Wed, 26 Apr 2017 06:45:52 -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 q45sm175008qtb.56.2017.04.26.06.45.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Apr 2017 06:45:51 -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::22b 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:214308 Archived-At: > Technically you can, but it's a bit messy and will likely not be > 100% reliable. Personally, in your case, I wouldn't bother doing it, > but here's how I'd do it otherwise: Thanks for the answer! The context is Proof General: it's very annoying that running whitespace-cleanup retracts what looks like arbitrary sections of the buffer. On 2017-04-26 08:26, 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? Not doing anything is risky, because it puts the buffer in an inconsistent state wrt the subprocess :/ Thanks!