From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Markus Triska Newsgroups: gmane.emacs.bugs Subject: bug#23906: 25.0.95; Undo boundary after process output is not consistent Date: Thu, 14 Jul 2016 10:34:57 +0200 Message-ID: <87zipkzkge.fsf@metalevel.at> References: <83r3b6lih2.fsf@gnu.org> <87h9bw5rfd.fsf@russet.org.uk> <87eg70i8k5.fsf@metalevel.at> <87d1mikef5.fsf@russet.org.uk> <874m7usn1m.fsf@metalevel.at> <8760sao9im.fsf@metalevel.at> <87mvllyypo.fsf@russet.org.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1468485386 7173 80.91.229.3 (14 Jul 2016 08:36:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Jul 2016 08:36:26 +0000 (UTC) Cc: Stefan Monnier , 23906@debbugs.gnu.org To: phillip.lord@russet.org.uk (Phillip Lord) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 14 10:36:16 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1bNc7w-0002a4-Oe for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Jul 2016 10:36:12 +0200 Original-Received: from localhost ([::1]:52270 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNc7w-0001sS-2L for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Jul 2016 04:36:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNc7q-0001sB-JV for bug-gnu-emacs@gnu.org; Thu, 14 Jul 2016 04:36:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNc7m-0007be-CJ for bug-gnu-emacs@gnu.org; Thu, 14 Jul 2016 04:36:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38174) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNc7m-0007bZ-9f for bug-gnu-emacs@gnu.org; Thu, 14 Jul 2016 04:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bNc7m-0007lY-2d for bug-gnu-emacs@gnu.org; Thu, 14 Jul 2016 04:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Markus Triska Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Jul 2016 08:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23906 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23906-submit@debbugs.gnu.org id=B23906.146848530229777 (code B ref 23906); Thu, 14 Jul 2016 08:36:02 +0000 Original-Received: (at 23906) by debbugs.gnu.org; 14 Jul 2016 08:35:02 +0000 Original-Received: from localhost ([127.0.0.1]:50511 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bNc6o-0007k2-0K for submit@debbugs.gnu.org; Thu, 14 Jul 2016 04:35:02 -0400 Original-Received: from metalevel.at ([78.46.218.83]:37795) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bNc6m-0007jk-2D for 23906@debbugs.gnu.org; Thu, 14 Jul 2016 04:35:00 -0400 Original-Received: by metalevel.at (Postfix, from userid 1000) id E7671A0269; Thu, 14 Jul 2016 10:34:57 +0200 (CEST) In-Reply-To: <87mvllyypo.fsf@russet.org.uk> (Phillip Lord's message of "Wed, 13 Jul 2016 23:12:19 +0100") User-Agent: Emacs/24.4 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:121059 Archived-At: phillip.lord@russet.org.uk (Phillip Lord) writes: > Emacs undo is already transactional in the sense that it inserts undo's > between commands. If Emacs is doing stuff, running functions, and so > forth, it will not add an undo boundary unless you tell it to. This is > even true for the timer based boundaries, IIRC. Timers can only run in > one point of the command loop. In the case I posted, these atomic operations are too finely grained for undo to revert all of them at once. I would like to state a transaction over all commands that happen during the interaction with the process. > This generalises the problem -- in this case, you are pretty much > guaranteed to get an undo-boundary between "Sleeping..." and "Awake!" > which you presumably want together. Yes, exactly! These should be together. > You can actually get this behaviour -- this patch achieves it. Thank you for looking into this! > Of course, this is pretty clunky and has global effect for the duration > of the let binding. Also easy to get wrong (as I did first time I tried > it). I suppose in the first try, you forgot to cancel the scheduled timer in addition to disabling its further invocation? As you mention, one drawback of this is the global effect. And there's also another drawback, which your example does not show: Please note that user input can also happen during the interaction, for example, please try: ?- read(T). and when asked, enter "test.": ?- read(T). %@ |: test. %@ %@ T = test. Again, I want the whole interaction to be undone when pressing C-/, not just up to the point the user was queried, i.e., after "|: ". > But, if this is the behaviour you want, I think it can be added. I'll > just add a new buffer-local variable to disable the effect of the timer > (rather than the timer itself, as I have done here). That's not sufficient to implement transactions in the way I need them. I hope the example above shows why: I really need them to span all buffer operations between two well defined points in time, not just text that is inserted by process filters. Thank you and all the best! Markus