Open spiderbit opened 3 years ago
btw there might be better ways to detect it but mode-name for exwm buffers are cons not a string, so if mode-name is type cons it's a X buffer.
I guess 1 at least partial solution would be to put the xah-fly--define-keys expression in a function, and call it directly afterwards? Then you could call it from outside too, that could replace the else part of my solution.
I have succesfully changed the keymap for exwm (X) buffers, in command mode by removing the commands from the command-map when I switch to that buffers and setting it back when I entering a normal emacs buffer.
The Problem is that I create some sort of a whitelist, while in reality I would need more like a blacklist also it's not great to hardcode the rebinding of the buttons I don't want to be active in command mode in X buffers, because if upstream the mapping would change, I would have to update my code.
I thought about saving somewhere a backup of the "full" command-map and just reseting it when I enter a normal emacs buffer with something like that:
(setq sb/shadow-map (copy-keymap xah-fly-command-map))
and instead of the bind-key commands then:(setq xah-fly-command-map (copy-keymap sb/shadow-map))
But for some reason that does not work, then I looked at the Readme and tried to remap some keys:
(define-key exwm-mode-map [remap next-line] (lambda () (interactive) (insert-char ?t)))
But neither remap it to nil nor insert-char does work, because inserting is not the same as sending the key to the window/buffer, I think the remap does not work for my problem beacuse I need to "unset" the key not set it to something different.
what seems to reset the mapping pretty good is to evaluate the expression:
in xah-fly-keys-el, but that is no function so I can't directly call it.