From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Johnson Newsgroups: gmane.emacs.help Subject: Re: Find bindings for all modes Date: Tue, 28 Oct 2014 14:00:24 -0800 Organization: AkWebsoft Message-ID: <20141028220024.GE7374@mail.akwebsoft.com> References: <20141028175824.GD7374@mail.akwebsoft.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1414533655 10419 80.91.229.3 (28 Oct 2014 22:00:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Oct 2014 22:00:55 +0000 (UTC) To: Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 28 23:00:50 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XjEoq-0001zh-0e for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Oct 2014 23:00:48 +0100 Original-Received: from localhost ([::1]:41560 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjEop-0007co-93 for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Oct 2014 18:00:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjEoY-0007aq-Sg for Help-gnu-emacs@gnu.org; Tue, 28 Oct 2014 18:00:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XjEoU-0006g0-5C for Help-gnu-emacs@gnu.org; Tue, 28 Oct 2014 18:00:30 -0400 Original-Received: from 191-232-4-64.mtaonline.net ([64.4.232.191]:52159 helo=tj49.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjEoT-0006fu-TR for Help-gnu-emacs@gnu.org; Tue, 28 Oct 2014 18:00:26 -0400 Original-Received: by tj49.com (Postfix, from userid 501) id 725D551B7136; Tue, 28 Oct 2014 14:00:24 -0800 (AKDT) Mail-Followup-To: Emacs Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-detected-operating-system: by eggs.gnu.org: Mac OS X 10.x X-Received-From: 64.4.232.191 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:100639 Archived-At: * John Mastro [141028 13:54]: > Tim Johnson 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