Refactoring
to
maintainability

Fixing keybinding stealing

2022-10-12
Emacs

The Setup

As I was working on my website as per the Some funkiness with iOS and CSS I realized that the keybinding that I use for Ace window(M-o) was instead being used by Facemenu whenever I was editing an html page (which uses the MHTML mode). Darn it! I use Ace Window a lot.

The Solution

It doesn’t seem that I can use use-package to modify modes that come with Emacs. Slightly annoying. So I have to add a standard hook to change what was happening.

(add-hook 'mhtml-mode-hook (lambda ()
                             (define-key html-mode-map (kbd "M-o") nil)
                             (define-key html-mode-map (kbd "C-c C-p") 'facemenu-keymap)
                             (define-key html-mode-map (kbd "M-o") 'ace-window)))

So undo the binding, make sure that we still have access to the facemenu keymap and reset the ace-window keybinding. I think the first one is not needed, now that I look at it, so will have a test after I publish this post.


Return to Index

Unless otherwise stated, all posts are my own and not associated with any other particular person or company.

For all code - MIT license
All other text - Creative Commons Attribution-ShareAlike 4.0 International License
Creative Commons BY-SA license image