syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.69k stars 4.9k forks source link

ivy-occur is no longer editable in evil #10290

Closed aaronjensen closed 4 years ago

aaronjensen commented 6 years ago

Description :octocat:

ivy-occur is no longer editable

Reproduction guide :beetle:

If you disable evil-mode, you can edit it

Observed behaviour: :eyes: :broken_heart: You can't edit the buffer, it uses the normal occur map which doesn't have any change commands in evil.

Expected behaviour: :heart: :smile: You can edit the buffer

System Info :computer:

aaronjensen commented 6 years ago

ping @abo-abo just in case you have an idea if anything has changed in this area.

aaronjensen commented 6 years ago

I believe the problem was introduced here: https://github.com/emacs-evil/evil/pull/985

(evil-set-initial-state 'ivy-occur-grep-mode 'normal) seems to work around it, but i'm not sure that's the right way.

abo-abo commented 6 years ago

(evil-set-initial-state 'ivy-occur-grep-mode 'normal) seems to work around it, but i'm not sure that's the right way.

Looks like a problem in evil config; I think above is the correct solution.

aaronjensen commented 6 years ago

Thanks for responding @abo-abo. Is there a hook for when ivy-occur-grep goes from read-only to writable and back? I may be able to set states in that case

abo-abo commented 6 years ago

Doesn't (evil-set-initial-state 'ivy-occur-grep-mode 'normal) solve your problem?

aaronjensen commented 6 years ago

Yes, it does, but ideally it would be in motion state unless the buffer is writable. So the idea is would be to have motion state be the default as it is now but change to normal when switching to non Read only.

abo-abo commented 6 years ago

I'm not very familiar with evil. But I think that ivy-occur buffers should be treated similarly to dired buffers. Both have ways of becoming editable, but they are primarily in their own normal modes with commands not related to evil.

aaronjensen commented 6 years ago

Thanks, I believe dired is "evilified". I'm not too familiar w/ how to set that up or what the right thing to do here is so I'll wait for @syl20bnr or someone else to have time to chime in. Thanks!

opsound commented 6 years ago

I am also having issues, even with (evil-set-initial-state 'ivy-occur-grep-mode 'normal). I remember my workflow below working previously.

For example,

Navigating to thingToEdit by moving manually with wbhjkl, followed by cw seems to work though.

EDIT: as described below, the above sequence never worked, and I was confused about the behavior of C-c C-o, C-x C-q and w.

aaronjensen commented 6 years ago

Hey @opsound, C-c C-o opens a read-only ivy-occur buffer. It is and never was expected that this would be editable. C-c C-e opens it editable or you could make it editable with C-x C-q or w after C-c C-o. This explains why navigating in a way that includes w makes it editable.

In other words, what you're describing is the expected behavior. Hope that helps.

opsound commented 6 years ago

@aaronjensen Ah - good call. w changing the buffer to be editable explains my confusion. I had thought that C-c C-o had new behavior that didn't require C-x C-q.

bmag commented 6 years ago

Should be solved by #10873 now, thanks for the report and for the help everyone.

et2010 commented 2 years ago

The issue is back now since that fix has been reverted

lebensterben commented 2 years ago

@et2010

can you elaborate when is it reverted? (in which commit)