help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: complete list of keybindings


From: Lennart Borgman
Subject: Re: complete list of keybindings
Date: Wed, 12 Aug 2009 01:47:36 +0200

Does this really catch longer key bindings? And chars above 127?


> (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__
>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]