[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: complete list of keybindings
From: |
Pascal J. Bourguignon |
Subject: |
Re: complete list of keybindings |
Date: |
Wed, 12 Aug 2009 01:17:51 +0200 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin) |
Brendan Miller <catphive@catphive.net> writes:
> Is there a complete list of keybindings somewhere, or a way to force
> emacs to give me a discription of every keybinding currently active?
>
> There's a lot of different partial lists online, but I want a complete list.
You will have to build the complete list yourself, because it is
different for each user. You may change the key bindings at will.
And even, the following code is not entirely correct, since it doesn't
take into account the various modes, which may overload the same key
chords.
(defmacro rloop (clauses &rest body)
(if (null clauses)
`(progn ,@body)
`(loop ,@(car clauses) do (rloop ,(cdr clauses) ,@body))))
(defun all-bindings ()
(interactive)
(message "all-bindings: wait a few seconds please...")
(let ((data
(with-output-to-string
(let ((bindings '()))
(rloop ((for C in '("" "C-")) ; Control
(for M in '("" "M-")) ; Meta
(for A in '("" "A-")) ; Alt
(for S in '("" "S-")) ; Shift
(for H in '("" "H-")) ; Hyper
(for s in '("" "s-")) ; super
(for x from 32 to 127))
(let* ((k (format "%s%s%s%s%s%s%c" C M A S H s x))
(key (ignore-errors (read-kbd-macro k))))
(when key
(push
(list k
(format "%-12s %-12s %S\n" k key
(or
;; (string-key-binding key)
;; What is this string-key-binding?
(key-binding key))))
bindings))))
(dolist (item
(sort bindings
(lambda (a b)
(or (< (length (first a))
(length (first b)))
(and (= (length (first a))
(length (first b)))
(string< (first a)
(first b)))))))
(princ (second item)))))))
(switch-to-buffer (format "Keybindings in %s" (buffer-name)))
(erase-buffer)
(insert data)
(goto-char (point-min))
(values)))
--
__Pascal Bourguignon__