meow icon indicating copy to clipboard operation
meow copied to clipboard

More initial state choices, including "disable"

Open emacsomancer opened this issue 2 years ago • 8 comments

There is a meow-mode-state-list for setting initial meow states, but insert is not an option here, it seems (though I'm not sure why). It could be useful for start some modes in insert state.

Also, for some major modes, it is preferable just to disable meow (so as to "stick" in the insert state and not accidentally leave it).

For both of these, I think I can see how to set custom hooks to do what I want (the latter probably making use of meow--disable), but I wondered if there was some built-in functionality I was missing.

emacsomancer avatar Sep 01 '22 00:09 emacsomancer

I assume you read the docstring on the variable in emacs, which seems to be out of date. I've just fixed that. You can use any value in that list, including insert.

As for disable, I think this could be a pretty good idea!

I'm not sure what your tolerance for hacky solutions is, but you could do something like this currently:

(meow-define-state disable "dummy state")
(add-to-list 'meow-mode-state-list '(xxx-mode . disable))

And it should work pretty nicely, using a nil keymap, effectively disabling meow without having to globally disable it (and deal with the shims etc).

eshrh avatar Sep 01 '22 01:09 eshrh

Thanks!

I'm not opposed to hacky solutions, but maybe I'm misunderstanding how to apply this one, or am mis-describing what I was thinking of. The nil keymap seems to just block any input; I was just thinking of the equivalent of buffer-/mode-locally disabling meow.

emacsomancer avatar Sep 02 '22 00:09 emacsomancer

hmm, how did you try out the code? when i run it to disable lisp-interaction-mode any new scratch buffer still lets me input. Maybe we can debug from there.

The meow-state's keymap should be nil, but the other keymaps should still work fine.

eshrh avatar Sep 02 '22 04:09 eshrh

Hmm... let me do some more testing then. Perhaps something else is conflicting.

emacsomancer avatar Sep 02 '22 04:09 emacsomancer

Check out the documentation on meow-define-state, you can also pass in your own keymap, as well as your own code that is run when the state is turned on and off. Maybe you'll be able to make it work by playing with one of those two.

eshrh avatar Sep 02 '22 04:09 eshrh

Ok, I'm not sure I understand why it's happening, but if I make sure to include (meow-global-mode) in my init, then the "disable mode" seems to work as you suggest.

But if I don't include (meow-global-mode) in my init, and I enable it manually afterwards with M-x meow-global-mode, then the initial states don't seem to be well-respected for insert and the disable ones seem to lack any keymap.

I'm not sure if this is expected or not?

emacsomancer avatar Sep 02 '22 20:09 emacsomancer

That must have been a nightmare to debug! I can reproduce this, but to be honest I have no clue why this would happen right now. I'll take a closer look at it soon if someone else doesn't nail it down by then. If i had to guess, it probably has something to do with keymap/mode ordering or something like that, and that the disable mode relies on keys falling through to self insert.

eshrh avatar Sep 05 '22 07:09 eshrh

If you disable meow in some mode, then commands are not available after SPC key.

It will be annoying in the real case. For example, I switch between windows via SPC w. Then I would like to have this keybinding no matter where I am.

DogLooksGood avatar Sep 07 '22 06:09 DogLooksGood

I can no longer reproduce the startup bug (besides, having global mode on all the time is the recommended way), i think the disable mode workaround is good enough, and i don't think there's a reason to add the disable mode to the project.

eshrh avatar Dec 17 '23 22:12 eshrh

Even if you don't want to add the disable mode as a built-in, i think this issue should be linked somewhere in the documentation, maybe in the FAQ.

tamwile avatar Mar 10 '24 20:03 tamwile