describe binding filtering in emacs - emacs

Is there a way to filter the list of available bindings (C-h b), so it will not show all the possible bindings but just the relevant ones for the used mode?
For example on org-mode, I get all the general C-x list plus all the bindings of the modes that have general key bindings plus all the major mode bindings, followed by all the org mode ones, followed by global bindings... 1369 lines in total... I'm using this view for learning my way around, perhaps there is a way to filter so as to find my way around.

I think you are looking for C-h m which runs the command describe-mode.
You will find more goodies in C-h C-h which runs the command help-for-help.

C-h m shows the doc for the current major mode, as well as currently enabled minor modes.
Often C-h m lists some of the more important local key bindings, that is, some of the bindings made for the current major mode. But not always, and typically it does not list all of the local bindings.
If you use library help-fns+.el then you can use command describe-keymap to list all of the local key bindings:
M-: (describe-keymap (current-local-map))
If you know the name of the local keymap variable (e.g. emacs-lisp-mode) then you can invoke describe-keymap interactively using C-h M-k, providing the map name at the prompt.
If you use Icicles then you can see all of the currently available key bindings using S-TAB (key completion). By default, the local bindings (i.e, those for the current major mode) are shown first, and are highlighted specially. (You can use C-, to sort the candidate bindings in other ways (by key name, prefix keys first; by command name).

After C-h b switch into Help-buffer and call M-xoccurRETorgRET which will display all lines containing "org".

Related

Emacs prefix justifications?

Do any old-school emacs-ers know the justification for the prefix key's C-c and C-x? I'm binding my own keys for some custom functions, and I'm wondering if there's any sort of "standard" that defines consistency for these prefixes.
So far the only thing I've noticed is that C-x is used for manipulating buffers (C-x C-f, C-x C-s, etc), but I haven't found a general theme for C-c yet. Thoughts?
If you look at the manual, C-c followed by a single key is conventionally reserved for user-defined bindings, along with some other prefixes, which see.
I think people have a lot of strategies for managing their personal bindings, for example, I remap CapsLock to F2 and root most of my personal keymaps from there.

Emacs Helm: what actions can I do in a helm buffer?

I have 2 questions:
In a helm buffer like helm mini or helm ag, there are usually too much candidates. In evil mode I can use C-d or C-u to scroll down or up. Can I do such things in helm buffer?
Sometimes when I enter a file path/name, there is only a default one in the buffer but not the one I entered. Whenever I hit enter the default path/file will be visit. What actions can I do in the input bar (where you input characters)?
Would you please provide the document describing these kind of keymaps? I can't find them because I don't what's my question :(
If you are using spacemacs, try M-x describe-keymap helm-map, it's bound to SPC h d K.
Sadly emacs itself doesn't have such a nice describe-keymap function. In this case you may either:
copy describe-keymap from spacemacs
use describe-bindings (it's not so smooth to read and misses some keymaps)
C-h v helm-map to browse the keymap as a variable (hard to read because the keys are in the form of something like unicode code points, but if you config all your key bindings yourself without framework-defaults, this is fine for "what's my bindings?" and debugging)
You can use describe-bindings or helm-descbinds to find the currently active bindings. The latter allows you to interactively search them through helm.

org mode - how to disable some keybindings?

I started using Emacs (currently for org mode only). I don't use priorities in my TODOs, hence I'd like to disable S-UP and S-DOWN key bindings (which loop through the priorities). How can I do this?
#lawlist gave you the recipe in his comment. Here's how to find this out for yourself.
See if there is a keymap variable for the mode in question - typically there is one. In this case, try C-h v org-mode-map. If you find no such variable, fish around a little, using the apropos commands - for example, M-x apropos-variable org-mode.
Bind the key(s) in question to nil in that keymap:
(define-key org-mode-map (kbd "S-<up>") nil)
C-h m gives you info about the current mode. Sometimes it lists the important key bindings for the mode. And C-h b (anywhere) lists lots of key bindings for the current context.
If you want to see all of the key bindings that belong to a given keymap variable (in human-readable form), then load library help-fns+.el and then use C-h M-k followed by the keymap variable name (e.g. org-mode-map). See Help+.

Finding all the functions in various modes assigned to a specific shortcut

I'd like to find all the modes which do assign a function to some specific shortcut.
For example if I'm not mistaken a stock Emacs simply assigns (or defaults to) newline for S-return but while in org-mode S-return does invoke org-table-copy-down.
Is there an easy way to figure out which modes (both major and minor) do map a function to a specific shortcut? I can find all the shortcuts of one major mode using describe-mode but I'd like to find those for all the various modes. I don't mind if it were to only work for all the currently loaded modes.
Basically I'd like to find "free" or "relatively rarely re-mapped" key shortcuts, which are also easy to type (i.e. I'm not after doing "C-c a" because for a start C-c is a very convoluted key to reach and then having to then hit another key is one key too many for me. I'm more after re-mapping C-o, S-return, M-/ and other combo trivial and fast to reach).
You can find the current-mode bindings using C-h b.
You can get all of the keymaps currently available, using accessible-keymaps. You can find all the features loaded via variable features. But you would have to work to find all possible bindings for all possible modes from all files that you have loaded so far.
I recommend that you do it for a particular mode, one mode at a time. It's easy to check a given mode's key bindings.
You can even check the bindings of keymaps (such as minibuffer maps or the Isearch map) that are hard to see otherwise, if you use command C-h M-k (describe-keymap) from library `help-fns+.el. I use that when I want to see what keys are still available in a given keymap etc.
You can use
M-x describe-unbound-keys
to find out the free keys.
This is from third party library as said in comments.
I don't know the answer to your specific question, but I can give you my solution to getting easy-to-type keybindings that don't conflict with other modes.
In my set up, I've remappped CAPS-LOCK to Alt. Most people map it to CTRL, but I can hit CTRL relatively easily, while ALT is difficult. With this set-up, one of the easiest key combos to hit is M-space. So I use this as my own private keymap:
(define-prefix-command 'ty-keymap)
(global-set-key "\M- " ty-keymap)
(define-key ty-keymap " " 'just-one-space)
(define-key ty-keymap "j" 'join-next-line)
(define-key ty-keymap "s" 'mark-sexp)
(define-key ty-keymap "c" 'org-capture)
...
Note: by default, M-space is bound to just-one-space, which is useful. I've moved that to M-space-space. Bouncing my thumb twice on the spacebar is only a fraction slower than hitting it once, so it's not a big loss.
Since M-space isn't a keymap by default, this setup allows me to use all the keys on the keyboard, without further modification. That's a lot of real-estate, guaranteed to be free of any conflict with other packages - since well-behaved packages won't clobber a basic Emacs keybinding.
You might prefer another key combo, but the idea is the same. You could even use a function key as your prefix-command, so you could do <f5> followed by a letter for your commands.

List all Keybindings for a certain emacs mode

I know that I can list all the keybindings available in emacs by using C-h b, but is it possible to list only the keybindings that apply to a certain mode, say dired-mode.
In dired+, I can do
?
h
and it shows me all the applicable dired mode keybindings.
Thanks
use C-h m or M-x describe-mode
Not sure what the question is. C-h b shows you all of the key bindings currently available (i.e., in the current mode).
If you want to see only the key bindings provided by a mode's own keymap, then use library help-fns+.el and hit C-h M-k. You are prompted for the keymap variable (e.g. dired-mode-map).
http://www.emacswiki.org/emacs/help-fns%2b.el