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

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

A macro for printing keymap bindings in a pretty fashion


From: Jonathan Ganc
Subject: A macro for printing keymap bindings in a pretty fashion
Date: Mon, 05 Sep 2011 15:20:08 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.21) Gecko/20110830 Thunderbird/3.1.13

I've been using emacs for a while now and I've found that some of the default keybindings are somewhat/very annoying. However, I found it was difficult to bind keys as I wanted to without being able to see the bindings in a table like a keyboard, whereas the only option I found for listing bindings was `describe-bindings', which just vomits up a list of all bindings.

So I wrote a macro "pkb" (for print key-bindings), which I've attached. It outputs the keybindings as a (somewhat) pretty html document. The simplified instructions: after loading the two .el files, run (pkb-html-save-keymap KEYMAP OUTPUT-FILE-NAME), where KEYMAP is the KEYMAP you want printed and OUTPUT-FILE-NAME is where the output will stored; e.g. (pkb-html-save-keymap (current-global-map) "~/test.html"). `pkb-html-save-keymap' has many other options that are described in the help function. I have placed an example of the output at http://www.ph.utexas.edu/~jonganc/emacs/example.html; note that the example is direct output from the macro.

If the attachment doesn't work, you can also use download the program from http://www.ph.utexas.edu/~jonganc/emacs.html.

I would be very interested in any comments people have (although I don't know that I'll have time to make any updates anytime soon, since I'm busy and the program currently does what I need).

Some notes about the program:
-- The output is not currently terribly pretty. This should be very easy to change; I haven't spent too much time on that since it otherwise does what I want. Also, if you are using an older browser that doesn't support CSS 3 (e.g. IE 6 or 7), the output will be particularly unattractive. -- The current default settings are aimed at me and my keyboard. However, by customizing the various default variables (e.g. `pkb-include-base-key-list', `pkb-html-event-replace-bk', `pkb-key-groups', etc.) it should be fairly straightforward to adapt the code for different keyboards. In fact, it would probably be possible to set these settings by detecting some system variables if someone were interested in implementing that.

--
Jonathan



__________ Information from ESET Smart Security, version of virus signature 
database 6439 (20110905) __________

The message was checked by ESET Smart Security.

http://www.eset.com

Attachment: pkb-0.2.zip
Description: Binary data


reply via email to

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