Solved! helm-descbinds solved the problem.


Thank you for your help.

I was trying to work out if I could build a simple script to narrow down key bindings, somewhat similar to IDO. I know of Icicle, but for some reason I didn't like it.

During my search I ran into many problems and beging to think that the only way out is to run:


and then try to parse Help buffer.

Is there a way to get pre-parsed flat list of biding? I got lost trying to understand the keymap structure.

I guess recursively parsing the keymap structure is too much work. Is there a simple solution?

This is example of my early progress.


After a while of trying, looks like getting the info from Help buffer didnt work. I got some strange structures with the string and when I tried to use print, it didn't print what I wanted. Perhaps I will have to parse the keymap?

After playing with keymap for a while, I think this is the way to go. More in my github link.

My last attempt.

;;; run in ielm like this: (my-list-bindings 11)
;;; n=11 for global
(defun my-list-bindings (n)
  "almost clean way of listing key bindings"
   (lambda (x y)
     (print "!!!!!!!!!!!!!!!!!!!!!")
     (princ x)
     (if (eq x 'menu-bar)
         (print "*** skipping menu bar ***")
       (print y)))
   (elt (current-active-maps) n )))
  • 1
    Can you clarify what you mean by "narrow down"? – Dan Jan 1 '16 at 22:31
  • M-x describe-bindings will show you all bindings. C-h m (M-x describe-mode) is also handy to list bindings by mode. – ReneFroger Jan 2 '16 at 0:14
  • descibe-bindings gives me many thousands of bindings that I'm not interested at the moment. I wonder if there's a better way to search than using C-s – ruby_object Jan 2 '16 at 3:05

If I understand correctly, you're trying to see what key bindings are available at any instant in time.

In that case, try helm-descbinds, which works with helm. Key bindings are organized by major mode, minor modes, and the global map. You can then use a regular expression to narrow down your choice, e.g. ^C-x\ [a-z] to find all bindings that begin with C-x and are followed by a letter from a-z.

You can also try discover-my-major, which lists all the key bindings of your current major mode, along with an apropos-like description of what they do. I find that it is useful when I'm trying to learn a new major mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.