I use C-h f heavily, but this is all functions in Emacs. I'm often only interested in interactive functions, i.e. commands.
Is there an equivalent for commands? Ideally I'd like ido completion too.
I use C-h f heavily, but this is all functions in Emacs. I'm often only interested in interactive functions, i.e. commands.
Is there an equivalent for commands? Ideally I'd like ido completion too.
Yes. Library help-fns+.el defines command describe-command.
And it redefines describe-function so that it does describe-command if you give it a prefix arg.
The library binds describe-command to C-h c (describe-key-briefly is moved to C-h C-c).
The same library defines other help commands, such as describe-file, describe-buffer, describe-keymap, and describe-option-of-type. Here is more info about the library.
apropos-command might be sufficiently close.
It doesn’t offer describe-function’s tab completion, but it lets you
search only through commands, and it takes you
to their doc page.
if you have smex installed, just call smex. Start to type, when the right one comes up, press C-h f.
I can't find this built-in. It is fairly easy to make a wrapper around describe-function that only completes command names when called interactively. In the implementation below, I duplicated the interactive form from describe-function and changed the fboundp test to commandp. As an added bonus, this function offers all function names when called with a prefix argument. Change if current-prefix-arg to if (not current-prefix-arg) to make describing all functions the default.
(defun describe-command (function &optional all-functions)
"Display the full documentation of FUNCTION (a symbol).
When called interactively with a prefix argument, prompt for all functions,
not just interactive commands, like `describe-function'."
(interactive (if current-prefix-arg
(eval (car (cdr (interactive-form 'describe-function))))
(list (let ((fn (function-called-at-point))
(enable-recursive-minibuffers t)
val)
(setq val (completing-read (if (and fn (commandp fn))
(format "Describe command (default %s): " fn)
"Describe command: ")
obarray 'commandp t nil nil
(and fn (commandp fn)
(symbol-name fn))))
(if (equal val "") fn (intern val)))
current-prefix-arg)))
(describe-function function))
I haven't tested this with ido but it should integrate normally.
If you are using helm and helm-M-x, you can press C-j on the commands to pop up their documentation.