Solved! helm-descbinds solved the problem.
https://github.com/emacs-helm/helm-descbinds
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:
(describe-bindings)and then try to parseHelp 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.
https://github.com/bigos/Pyrulis/blob/master/Emacs/key-bindings-lister/lisp/key-bindings-lister.el
After a while of trying, looks like getting the info fromHelp 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" (map-keymap (lambda (x y) (print "!!!!!!!!!!!!!!!!!!!!!") (princ x) (if (eq x 'menu-bar) (print "*** skipping menu bar ***") (print y))) (elt (current-active-maps) n )))- 1Can you clarify what you mean by "narrow down"?Dan– Dan2016-01-01 22:31:06 +00:00CommentedJan 1, 2016 at 22:31
M-x describe-bindingswill show you all bindings. C-h m(M-x describe-mode)is also handy to list bindings by mode.ReneFroger– ReneFroger2016-01-02 00:14:56 +00:00CommentedJan 2, 2016 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-sruby_object– ruby_object2016-01-02 03:05:04 +00:00CommentedJan 2, 2016 at 3:05
1 Answer1
If I understand correctly, you're trying to see what key bindings are available at any instant in time.
In that case, tryhelm-descbinds, which works withhelm. 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 withC-x and are followed by a letter froma-z.
You can also trydiscover-my-major, which lists all the key bindings of your current major mode, along with anapropos-like description of what they do. I find that it is useful when I'm trying to learn a new major mode.
Explore related questions
See similar questions with these tags.