unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tim Johnson <tim@akwebsoft.com>
To: Emacs <Help-gnu-emacs@gnu.org>
Subject: Re: Find bindings for all modes
Date: Tue, 28 Oct 2014 14:00:24 -0800	[thread overview]
Message-ID: <20141028220024.GE7374@mail.akwebsoft.com> (raw)
In-Reply-To: <CAOj2CQSRgNK1vVOkZ_5yNYsodtT_563X79rigoN-rQyfgcQJoA@mail.gmail.com>

* 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



  reply	other threads:[~2014-10-28 22:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-28 17:58 Find bindings for all modes Tim Johnson
2014-10-28 21:53 ` John Mastro
2014-10-28 22:00   ` Tim Johnson [this message]
2014-10-28 22:18     ` John Mastro
2014-10-29  0:31       ` Tim Johnson
2014-10-29  3:09       ` Robert Thorpe
2014-10-29 18:19         ` Tim Johnson
2014-10-29 23:05         ` John Mastro
2014-10-30  1:46           ` Tim Johnson
2014-10-30  2:04           ` Robert Thorpe
2014-10-30 18:25             ` Tim Johnson
2014-11-01 21:00               ` Robert Thorpe
2014-11-04  0:04                 ` Tim Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141028220024.GE7374@mail.akwebsoft.com \
    --to=tim@akwebsoft.com \
    --cc=Help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).