Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(u)ndo doesn't always do what it should #4

Open
AnttiNykanen opened this issue Jul 25, 2019 · 4 comments
Open

(u)ndo doesn't always do what it should #4

AnttiNykanen opened this issue Jul 25, 2019 · 4 comments
Labels

Comments

@AnttiNykanen
Copy link

AnttiNykanen commented Jul 25, 2019

Hello! @ryanprior recently e-mailed me about this amazing repository. While my original CVS repository of this thing is probably gone for good (and with that the TODO file that I once had), I spent a while trying to remember what "original" issues still might persist.

The only relevant one is that ed-cmd-undo doesn't work like in other implementantions of ed. This is mentioned in the docstring, but to clarify, here's one example I managed to think of:

In standard ed I can do this:

i
this is the first line
.
a
this is the second line
this is the third line
.
1,$p
this is the first line
this is the second line
this is the third line
u
1,$p
this is the first line

So the undo reverts the changes made to the buffer by the previous command. However, in ed-mode.el this happens:

i
this is the first line
.
a
this is the second line
this is the third line
.
1,$p
this is the first line
this is the second line
this is the third line

u
1,$p
this is the first line
this is the second line

So calling the Emacs undo doesn't revert everything that was appended by the second command but just the last line - which, now that I think about it, is quite logical since we are just doing line-by-line inserts into the buffer.

I'm not 100 % sure if this is just an issue with input mode commands (i, a and c) - but if that is the case, the fix might be a lot easier than what I thought 14 years ago: just build an intermediate buffer string while doing input mode, then insert it all in one go when . is used to exit. If everything gets inserted in one go, then I think undo should also work properly.

If someone can think of other cases than i / a / c where undo messes up, then we might need to think of something more elaborate 😄

Other than this, I just had some commands missing, and it looks like @echosa already has a pull request for adding placeholders. Nice!

@echosa
Copy link
Contributor

echosa commented Jul 25, 2019

@AnttiNykanen Are you the original creator/maintainer of ed-mode?

@AnttiNykanen
Copy link
Author

@echosa yup

@echosa
Copy link
Contributor

echosa commented Jul 25, 2019

@AnttiNykanen Awesome! Cool to have you chiming in. :-) Hopefully my PR gets merged in. We discussed if this should be the "official" repo for the project. I'm ok with that, but with you being the original author, you should weigh in, I think.

@AnttiNykanen
Copy link
Author

AnttiNykanen commented Jul 25, 2019

@echosa yeah, as I wrote to @ryanprior, I'm totally fine with this being the official repository from now on, and have no qualms about "giving up" "maintainership" (not that much to give up). Guess I might hang around, who knows. At least today this has made my day :-)

Actually, I went ahead and edited EmacsWiki to use the new name and point here: https://www.emacswiki.org/emacs/EdMode

@ryanprior ryanprior added the bug label Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants