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

iedit-state and evil-change/evil-delete #3193

Closed
jdwaterson opened this issue Sep 29, 2015 · 6 comments
Closed

iedit-state and evil-change/evil-delete #3193

jdwaterson opened this issue Sep 29, 2015 · 6 comments
Labels
- Forum - Iedit Not a bug 8-) Reported upstream stale marked as a stale issue/pr (usually by a bot)

Comments

@jdwaterson
Copy link

It looks to me like there is a problem when using iedit-state when words are space-delimited (ie, most, but not all of the time).

Specifically, in these cases, the evil-change and evil-delete commands (on keys c and d) drop out of iedit altogether, so my changes are applied at the current cursor position only, and all of the iedit highlighting disappears (although the cursor remains red, so iedit-state still thinks it is active).

Here is an example, showing both working and non-working behaviour. My initial buffer (in fundamental mode) contains just:

foobar.qux
foobar.qux

I move to the "b" in the first foobar, and then hit SPC s e d w. In this case, everything works fine and I end up with:

foo.qux
foo.qux

...which is what I want. On the other hand, if my starting buffer is just one character different, and I replace that first period with a space, viz:

foobar qux
foobar.qux

...and then, once again I hit SPC s e d w then I get dumped out of iedit (highlights disappear) and my buffer looks like this:

fooqux
foobar.qux

I get essentially the same problem if I use c w instead of d w. It looks like a bug to me, but not sure if I'm the only person seeing this behaviour?

My spacemacs setup:

System Info

  • OS: darwin
  • Emacs: 24.5.1
  • Spacemacs: 0.104.1
  • Spacemacs branch: master (rev. 2cfc9a5)
  • Distribution: spacemacs
  • Layers:
(emacs-lisp git markdown osx themes-megapack clojure html auto-completion :variables auto-completion-return-key-behaviour 'complete auto-completion-tab-key-behaviour 'complete)
@TheBB
Copy link
Collaborator

TheBB commented Sep 29, 2015

You should probably report this to https://github.com/syl20bnr/evil-iedit-state for completeness.

@bmag
Copy link
Collaborator

bmag commented Sep 29, 2015

I've tested a bit and turns out it's a bug in iedit itself: victorhge/iedit#53

@PierreR
Copy link
Contributor

PierreR commented Nov 6, 2015

Same issue for me while using c-w.

@namdnguyen
Copy link

According to the issue @bmag posted to iedit, it's not a bug but expected behavior. c-w and d-w are deleting the space in your example between "foobar" and "qux" because "foobar" is the selection when iedit is triggered. Since the space is outside of the selection, iedit aborts.

Try using M-x query-replace-regex instead? M-x pcre-query-replace-regex is currently bound to SPC R %. There's also M-x replace-regex if you don't want to be prompted for each occurrence.

I like using visual-regexp, which gives you incremental highlighting updates, so I made a private layer for it. It's good for people like me who are still learning regex. I pretty much copied this configuration.

@jdwaterson
Copy link
Author

Ah, that makes sense. And in that case, there is a much simpler solution than using query-replace-regexp or similar: just use SPC s e d e instead of SPC s e d w. That's still a bit tricky, because the d w command to delete the current word is not something I really think about, it's a muscle-memory response in my fingers. But I guess I can train myself out of that.

Two thoughts on remaining problems though:

1 - If iedit aborts, then either iedit or spacemacs itself should provide a message in the echo area, to explain what happened. Something like "iedit failed because a command affected text outside of iedit scope" would make it instantly clear to the user what has gone wrong.

2 - The fact that the spacemacs cursor remains red when iedit aborts (ie, indicating that it still thinks iedit is active) is clearly still a bug. It's fairly minor, since pressing escape will fix it. But still, it's definitely misreporting the internal state of the application.

Thoughts on this?

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Forum - Iedit Not a bug 8-) Reported upstream stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests

6 participants