[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Find bindings for all modes
From: |
Tim Johnson |
Subject: |
Re: Find bindings for all modes |
Date: |
Tue, 28 Oct 2014 14:00:24 -0800 |
User-agent: |
Mutt/1.4.2.3i |
* John Mastro <john.b.mastro@gmail.com> [141028 13:54]:
> Tim Johnson <tim@akwebsoft.com> wrote:
> > Is there a way to find out all mode - specific bindings for a given
> > key sequence?
>
> I think it depends on what your intended use is. For instance, you could
> do something like this:
I'd like to use C-j as a prefix key.
Note: I have limited mobility in my hands and always have the
control key to the left of my "A" key.
> (defun bindings-for (key)
> (let ((seen nil)
> (bindings nil))
> (dolist (buffer (buffer-list))
> (with-current-buffer buffer
> (unless (memq major-mode seen)
> (push major-mode seen)
> (push (cons major-mode (key-binding key))
> bindings))))
> bindings))
>
> (pp (bindings-for (kbd "C-j")))
This is very handy. Thank You!
> This will show you an alist mapping major mode names to the command
> bound to C-j in some active buffer of that mode.
>
> Unfortunately, this is far from perfect. The binding could well be
> associated with a minor mode rather than a major mode, but it shows the
> major mode's name anyway. And different `foo-mode' buffers could have
> different bindings for the same key, but it assumes they're all the
> same.
>
> I don't know a way to get a really definitive look at "what's bound
> where by whom", but hopefully someone else will chime in.
:) The more the merrier...
thanks again
--
Tim
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com, http://www.tj49.com
- Find bindings for all modes, Tim Johnson, 2014/10/28
- Re: Find bindings for all modes, John Mastro, 2014/10/28
- Re: Find bindings for all modes,
Tim Johnson <=
- Re: Find bindings for all modes, John Mastro, 2014/10/28
- Re: Find bindings for all modes, Tim Johnson, 2014/10/28
- Re: Find bindings for all modes, Robert Thorpe, 2014/10/28
- Re: Find bindings for all modes, Tim Johnson, 2014/10/29
- Re: Find bindings for all modes, John Mastro, 2014/10/29
- Re: Find bindings for all modes, Tim Johnson, 2014/10/29
- Re: Find bindings for all modes, Robert Thorpe, 2014/10/29
- Re: Find bindings for all modes, Tim Johnson, 2014/10/31