Getting help from the `C-h k`-command for named extensions

Viewed 49

Is there an emacs command to get help with named-extensions?

Using C-h k generally gives help on the command that follows, but if the command that I'm trying to get help with begins with M-x, emacs gives me help with M-x, rather than waiting to hear the named-extension that I want help with.

I've attempted to read relevant sections of the included manual, but I've either not found the right sections, or misunderstood what I've read.

1 Answers

What you're looking for is certainly:

  • C-h f (describe-function: documentation of a M-x … command or of a noninteractive function)

Also, instead of doing C-h c, C-h f in a row, you can just as well use:

  • C-h k (describe-key: documentation of a keybinding)

Note that a subset of the functions / keys are documented in more depth in emacs' info manual, so you may also try typing:

  • C-h F (Info-goto-emacs-command-node)
  • C-h K (Info-goto-emacs-key-command-node)

before the function or keybinding you are interested in.

Side notes

You might also be interested in installing some modes to increase the discoverability of features, namely:

If you're a use-package user, installing them would amount to adding at the end of your .emacs:

(use-package which-key
  :ensure t
  :config
  (which-key-mode))

(use-package discover-my-major
  :ensure t
  :config
  (global-set-key (kbd "C-h C-m") #'discover-my-major)
  (global-set-key (kbd "C-h M-m") #'discover-my-mode))

;; Recall we also have the standard keybinding "C-h m".

(use-package helpful
  :ensure t
  :config
  (global-set-key (kbd "C-h f") #'helpful-callable)
  (global-set-key (kbd "C-h v") #'helpful-variable)
  (global-set-key (kbd "C-h k") #'helpful-key)
  ;;; Look up Functions (excludes macros).
  ;; (global-set-key (kbd "C-h F") #'helpful-function)
  ;;; Look up Commands (= keybindings).
  ;; (global-set-key (kbd "C-h K") #'helpful-command)
  ;;; COMMENTED-OUT as "Info-goto-emacs[-key]-command-node" are more useful.
  (add-hook 'emacs-lisp-mode-hook #'(lambda ()
    (local-set-key (kbd "C-c C-.") #'helpful-at-point))))

;; Note we can also type "C-h" after a prefix to list its expansions.
Related