0

The minor-mode show-paren-mode does not have a keymap. Is there a way to add such a keymap so that I can define some key-bindings that depend on this minor mode?

I saw a solution here which involves modifying minor-mode-map-alist, with a comment saying that the solution is "rather hacky". Is there a better solution in my case?

5
  • 1
    there are a couple of ways to do that, what do you want to do? show-paren-mode has no more interactive functionality than (de)active it . – Muihlinn Apr 24 '20 at 12:43
  • I just want to assign a particular functionality to a key when show-paren-mode is active. I don't understand the second part of your answer. – Tohiko Apr 24 '20 at 13:13
  • Rather than hacking on minor-mode-map-alist which probably will bite back more often than not, I'd write my own minor mode with the keybindings I'd like just cheking if show-parens-mode is active. – Muihlinn Apr 24 '20 at 13:29
  • Thanks! Wouldn't this also mean that I have to enable my minor mode when show-paren-mode is enabled by adding a hook? In any case, defining a minor mode for just a a single key-binding seem to me an overkill. Is there a way to "apply"/"remove" a keymap in show-paren-mode-hook? – Tohiko Apr 24 '20 at 13:34
  • 1
    you could, if it exists. Or you could add a keybinding to prog-mode-map or whatever relevant mode which will cover your use case for show-paren-mode. – Muihlinn Apr 24 '20 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.