meow-edit / meow

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

Mode-specific thing table? #438

Closed MichaelXavier closed 1 year ago

MichaelXavier commented 1 year ago

Is it possible to append to meow's table of things for specific modes? For example, there may be some things that are particular to markdown-mode or org-mode. I wouldn't want to define them globally because they'll clutter the menu when I'm trying to select a thing. They may even be defined differently in different modes. Furthermore, putting everything in the global thing map means the character you use to indicate a thing will more likely already be taken.

DogLooksGood commented 1 year ago

Firstly, use make-variable-buffer-local to make variable meow-char-thing-table buffer-local. Then use major mode hooks and setq-local to set values separately.

MichaelXavier commented 1 year ago

Is the idea then to all of the things globally with meow-thing-register and then reference them selectively by making meow-char-thing-table buffer-local?

DogLooksGood commented 1 year ago

meow-thing-register will registry a thing with a NAME to meow--thing-registry. And meow-char-thing-table is the mapping from key char to NAME. So you don't have to use meow-thing-register until you want to create your own thing.

MichaelXavier commented 1 year ago

Thanks! I'll go ahead and close the ticket.