cabbage icon indicating copy to clipboard operation
cabbage copied to clipboard

e-max binding api (define bindings like color themes)

Open senny opened this issue 12 years ago • 15 comments

I'm currently working on a new binding-system. This is work in progress an nowhere close to being finished. I've tried a few different approaches to design the new binding system and I like the current approach. It only supports "sticky" bindings, which are active in every buffer and can't be hidden behind local-keymaps. Earlier versions of sticky-bindings led to a loss of the "base" emacs bindings and you couldn't turn-off the binding api. The current version is sensible and can very easily be deactivated.

@jone please have a look and let me know what you think. Please let me know if you got any ideas how to support global and local-bindings. these are the next tasks on my list.

senny avatar Jan 22 '12 18:01 senny

I like it :) the theme definition looks really clean and understandable.

I'm not sure about the global map, that's a little tricky..

jone avatar Jan 22 '12 21:01 jone

@jone please check out the latest version! I got major-mode bindings working. I fail at special cases like isearch though :(

senny avatar Jan 23 '12 21:01 senny

Looks nice!

Are you sure the name of the major mode hook is always mode-name-hooke? I think I there are some exceptions, but I do not remember which mode that was :/ There are also multiple lisp major modes, e.g. the scratch buffer has lisp-mode and .el files have emacs-lisp-mode. For those one had to define the same binding for each mode, right? But this might be too academic..

global bindings: is the emulation-mode-map-alist ordered? Would it be possible to add another low priority global map?

jone avatar Jan 23 '12 21:01 jone

@jone I'm aware of the issues you mentioned but I wont adress them until we got a serious solution for global bindings and special cases like isearch. Especially modes, which are only operating in the minibuffer are hard to crack.

global-bindings can't be put into the emulation-mode-map-alist because they shadow every defined binding by emacs. The Idea behind global-bindings is, that they are shadowed by local bindings.

senny avatar Jan 24 '12 07:01 senny

I see..

What is the problem with the minibuffer? isearch has a isearch-mode-hook which is activated. Has the minibuffer a seperate binding lookup mechanism?

jone avatar Jan 24 '12 08:01 jone

I don't know... it just doesn't work.

senny avatar Jan 24 '12 08:01 senny

@jone I currently don't see a way to get completely switchable themes working. I'll leave the current approach in the code-base to resume the work on it laters but I'll implement a much simpler approach of themes for the first release. This means that you have to restart Emacs to switch themes though.

senny avatar Jan 28 '12 11:01 senny

Ergoemacs-mode now supports keyboard themes. They are switchable on the fly. I have submitted a request to support cabbage keybindings.

https://github.com/ergoemacs/ergoemacs-mode/issues/33

However, I'm unsure how you wish to handle the control keys on keyboard layouts other than qwerty. If you base them on keyboard position they may collide with C-x or C-c. That would take some thinking on my part, though not unachievable.

Let me know if you think this is a good idea.

mattfidler avatar Aug 02 '13 05:08 mattfidler

@mlf176f2 this sounds amazing :yellow_heart: ! We haven't made any progress on this issue and never got over the "hack" phase. If ergoemacs support for keyboard themes allows cabbage to have the same functioning bindings as we have now. I'm all for having it as a dependency and do our keys over such a theme.

senny avatar Aug 02 '13 07:08 senny

I have added a keyboard theme for cabbage.

I have assumed all C- keys are fixed keys and all M- or M-C- keys depend on the keyboard you have. The windmove commands didn't really work for this, so I also added M-C- for all the windmove commands.

I haven't checked the isearch functionality; I'm not sure if you had anything different than ergoemacs. Let me know.

Also note there are multiple functions defined for a key. Ergoemacs-mode uses the first function it finds that is defined. If no functions are found, it doesn't bind the key at all. Therefore, since I don't have the cabbage functions installed, I can't really test these keys (unless I assign a fallback).

mattfidler avatar Aug 02 '13 18:08 mattfidler

I have updated the ergoemacs website to list the cabbage keybindings. I don't believe that all of them are listed, but a majority of them are; See:

http://ergoemacs.github.io/ergoemacs-mode/key-setup.html

mattfidler avatar Aug 09 '13 03:08 mattfidler

@mlf176f2 this is freaking amazing :yellow_heart: :green_heart: :heart: :blue_heart: :purple_heart: ! Can you please make the theme selection from the dropdown available via the URL? I totally want to link to that page from the cabbage README as documentation.

senny avatar Aug 09 '13 06:08 senny

Also we use the Apple Key (⌘) as meta, it would be great if there was a possibility to change the legend, or have it say meta instead of Alt.

senny avatar Aug 09 '13 06:08 senny

Wow @mlf176f2 thank you very much for that! This is very, very helpful for beginners :heart:

jone avatar Aug 09 '13 07:08 jone

Note the key descriptions below are currently wrong...

https://github.com/ergoemacs/ergoemacs-mode/issues/43

mattfidler avatar Aug 09 '13 15:08 mattfidler