unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: phillip.lord@russet.org.uk (Phillip Lord)
To: Markus Triska <triska@metalevel.at>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, 23906@debbugs.gnu.org
Subject: bug#23906: 25.0.95; Undo boundary after process output is not consistent
Date: Wed, 13 Jul 2016 23:23:27 +0100	[thread overview]
Message-ID: <87inw9yy74.fsf@russet.org.uk> (raw)
In-Reply-To: <87zipl7gru.fsf@metalevel.at> (Markus Triska's message of "Wed, 13 Jul 2016 16:29:41 +0200")

Markus Triska <triska@metalevel.at> writes:

> phillip.lord@russet.org.uk (Phillip Lord) writes:
>
>>> about it, but what I think would work in this particular case is to
>>> record it as "Emacs, to undo this, you need to remove all text between X
>>> and Y", and Y simply increases as more text is inserted into the buffer.
>>> This would keep the length of the undo list constant throughout the
>>> whole interaction with the subprocess, at least in this concrete
>>> case. Can I do this in ediprolog myself? If so, then I will do it.
>>
>>
>> And what happens if the prolog process spams and never stops? Y, gets
>> longer and longer. Eventually, Emacs signals an error with a "this is
>> probably a bug" message.
>
> The way I imagine it, Y does not get "longer and longer", but is simply
> an integer that gets higher and higher when more output arrives. That
> would be one way to merge subsequent insertions in the undo list.

Sorry, I didn't put that well. My point was, simply, that if the prolog
output is too long, you have to put an boundary sooner or later, or
Emacs is going to complain.


>> I think you are doing two things -- one is telling the user that
>> something has happened and one is storing the result. I think that this
>> is the problem.
>>
>> My suggestion is add the %@ into the buffer when the result comes
>> through. If you want %@ to *appear* before this, then insert an overlay
>> with a display string.
>
> Please let us consider the more general issue of making *all*
> insertions, the first _and also subsequent ones_ that happen during the
> interaction with the Prolog process (and which can stem either from
> process output *or* from user input) *atomic* in the sense that they are
> all undone as a single unit. Please try out ediprolog to see what I
> mean. In my view, the transaction concept that Stefan has proposed is a
> very good solution for this and would benefit also other parts of Emacs.
> It is this general issue that I would like to address and solve with a
> suitable (likely: new) Emacs mechanism, not only the first %@.

Already replied to this, in my other response. It's easy to add.


> This seems completely normal and correct to me. Undo boundaries are
> currently inserted without my control over them. I understand that this
> is for efficiency reasons, to allow Emacs to trim the undo list.

Just to be clear; it's not for reasons of efficiency. Emacs has to trim
the undo list or Emacs has a memory leak. It currently has heuristic
checks in place, which make Emacs produce a user visible error when it
forcibly discards undo information.

> I would like to have more control over this, for example, by removing
> these undo boundaries when the whole interaction is over. At that
> point, we know that Emacs has not raised an error, so it should be
> very safe.

That's true, but only for a defined set of prolog output.

Still, I guess, hitting the undo limits is not a problem for ediprolog
in general use, or you would have hit it already (as I say, it's pretty
obvious when you do hit it!)

> Several other solutions would also fit this particular case, such as
> merging subsequent insertions in the undo list to keep its length
> constant. These solutions should not depend on the timing of
> insertions.
>
> We have found one case where I could prevent the undo boundary with
> special-case code (for the initial %@), but a more general solution
> would be much more welcome and work for all parts of the interaction.

No worries, I'll add to master.

Phil






      reply	other threads:[~2016-07-13 22:23 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-06 17:56 bug#23906: 25.0.95; Undo boundary after process output is not consistent Markus Triska
2016-07-06 18:38 ` Eli Zaretskii
2016-07-11 11:45   ` Phillip Lord
2016-07-11 13:54     ` Markus Triska
2016-07-12 16:29       ` Phillip Lord
2016-07-12 17:03         ` Stefan Monnier
2016-07-12 18:56         ` Markus Triska
2016-07-12 20:22           ` Stefan Monnier
2016-07-12 21:02             ` Markus Triska
2016-07-12 21:20               ` Stefan Monnier
2016-07-12 22:35                 ` Markus Triska
2016-07-12 22:51                   ` Stefan Monnier
2016-07-12 22:45                 ` Markus Triska
2016-07-13 22:12               ` Phillip Lord
2016-07-14  8:34                 ` Markus Triska
2016-07-14 13:33                   ` Phillip Lord
2016-07-14 15:10                     ` Markus Triska
2016-07-14 20:25                       ` Phillip Lord
2016-07-14 22:12                         ` Stefan Monnier
2016-07-18  4:18                       ` Stefan Monnier
2016-07-18 19:03                         ` Markus Triska
2016-07-19  0:41                           ` Stefan Monnier
2016-07-19  1:05                         ` Stefan Monnier
2016-07-24 15:45                         ` Phillip Lord
2016-07-24 21:36                           ` Stefan Monnier
2020-09-04 13:55                         ` Lars Ingebrigtsen
2016-07-13  8:09           ` Phillip Lord
2016-07-13 14:29             ` Markus Triska
2016-07-13 22:23               ` Phillip Lord [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87inw9yy74.fsf@russet.org.uk \
    --to=phillip.lord@russet.org.uk \
    --cc=23906@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=triska@metalevel.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).