justinbarclay / parinfer-rust-mode

Simplifying how you write Lisp
https://shaunlebron.github.io/parinfer/
GNU General Public License v3.0
227 stars 16 forks source link

stops working after fast undo sequence #7

Closed andreyorst closed 4 years ago

andreyorst commented 4 years ago

indent the some multiline code by some amount of spaces, then undo all by holding undo shortcut and parinfer no longer does anything when indenting code again. No error messages are thrown.

Recording: https://asciinema.org/a/Wk6eSQ2ecVxgFTqFHPThVUEKh

justinbarclay commented 4 years ago

Hi @andreyorst thanks for submitting this issue, that recording was very helpful.

I was able to recreate your bug and I think I was able to fix it. At least, it's fixed on my machine 😅. I pushed it and a few other changes up under tag v0.5.4. Can you let me know if this fixes the issue for you?

andreyorst commented 4 years ago

this seems to be fixed, but still one problem persisted, that was observed in my recording as well, although I didn't mentioned it explicetly. In:

(defvar a
  '(:a 1
    :b 2))

add space before quote:

(defvar a
   '(:a 1
     :b 2))

Structure is preserved. Undo once:

(defvar a
   '(:a 1
    :b 2))

Structure is broken. Another undo will fix it, but If you've added more than one space structure will remain broken with each undo until final undo. Recording: https://asciinema.org/a/H5NdmLxw0j2Lm9N47z642veLM

I'm using undo-tree package, but it can be reproduced without any undo plugin as well.

justinbarclay commented 4 years ago

Unfortunately, that's kind of expected behavior within the Emacs Undo system. I've tried various work arounds so that Emacs treats a self-insert-command and the call to parinfer-rust--execute within the same undo boundary but I haven't had much luck, yet. I'll keep this issue open to track my progress with the undo system.

andreyorst commented 4 years ago

Maybe there are some facilities to group modifications into single undo item?

andreyorst commented 4 years ago

I'll keep this issue open to track my progress with the undo system.

I feel that this is a different issue, so let's close this, since the main issue is fixed, and I'll open a new one, explicitly for this undo problem