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

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

Re: elisp question


From: Niels Giesen
Subject: Re: elisp question
Date: Mon, 13 Oct 2008 20:11:24 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Seweryn Kokot <sewkokot@gmail.com> writes:

> Hello,
>
> I would like to get a list of functions for keybindings from C-x C-a to
> C-x C-z etc.
>
> Since (key-binding (kbd "C-x C-f")) gives find-file
>
> I try to write something like this:
>
> (defun my-list-keybindings ()
>   (interactive)
>   (let* (keyb
>                (char-a 97)
>                (char-z 122)
>                (n (- char-z char-a)))
>       (dotimes (i n)
>         (setq keyb (concat "C-x C-" (char-to-string (+ char-a i))))
>         (key-binding (kbd keyb)))))
>
> but unfortunately it doesn't work because kbd doesn't accept variable
> string. How to modify this function to get it work?

Dig harder:

(defmacro kbd (keys)
  "Convert KEYS to the internal Emacs key representation.
KEYS should be a string constant in the format used for
saving keyboard macros (see `edmacro-mode')."
  (read-kbd-macro keys))
   ^^^^^^^^^^^^^^

;)




reply via email to

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