meow-edit / meow

Yet another modal editing on Emacs / 猫态编辑
GNU General Public License v3.0
1.2k stars 135 forks source link

act on selection #620

Open noncopyable opened 3 months ago

noncopyable commented 3 months ago

first, thanks for this awesome mode.

i am probably missing some functionality, probably exists in #-thing-# wouldn't it be great if meow had a binding that calls, "meow--act-on-selection" (like avy act) that switches to default modeless emacs (insert), keeping selected region. then we are free to call any ###-region command. after that command executed, automagically switches back to normal mode.

maybe, also adding a act-on-selection-modemap where we could do things like: act-modemap-leader s => surround act-modemap-leader i => string-inflection ...

DogLooksGood commented 1 month ago

Hey, the surrounding stuff can actually be built into a package, or built with a paren handling package. I think it's better to use an existing one instead of adding features in Meow.

noncopyable commented 2 weeks ago

hello, that is precisely what i want. instead of replicating every other package (evil-### way), we could create a temporary environment/state (in which meow-selected-regions remain) where any package (or ##-region command) can do its thing, and we then switch back to the original meow state that the call was issued.

DogLooksGood commented 2 weeks ago

Well, for a keymap on selection, there's a package available: selected.el. It gives you a keymap when region is active. Of course it works, but very few concepts built for region only. Most features in Emacs works in a Do-What-You-Mean way, so they work with/without a region. (e.g. builtin upcase-dwim, package smartparens). In order to use them whenever possible, we don't bind them to a selection specific keymap.

If you really need a keymap for selection, you probably want to take a look at meow-define-state.