I'm already used to press C-h f and type a function name to ask for help on that function. But if the function name is already under the cursor (e.g. while visiting the .emacs configuration file), is there a way to avoid typing the whole thing again?

  • 7
    This is the default… just press C-h f RET. Commented Oct 28, 2014 at 23:05
  • I feel quite stupid, I didn't try the obvious. Anyways, I learned a couple of very nice tricks from the answers below. Commented Oct 29, 2014 at 15:22

7 Answers 7


My current favorite reference defun (requires popup.el):

(require 'popup)

(defun describe-thing-in-popup ()
  (let* ((thing (symbol-at-point))
         (help-xref-following t)
         (description (save-window-excursion
                          (help-xref-interned thing)
    (popup-tip description
               :point (point)
               :around t
               :height 20
               :scroll-bar t
               :margin t)))

Use that with your key binding of choice for unobtrusive help reference for symbol-at-point.


From gnu.org:

If you type C-h f <RET>, it describes the function called by the innermost Lisp expression in the buffer around point, provided that function name is a valid, defined Lisp function. (That name appears as the default while you enter the argument.


Just hitting RET should be enough. Alternatively, try the following snippet to define a function that describes the function at point:

(defun my-describe-function-at-point ()
  (describe-function (function-called-at-point)))

As Sean Alfred commented above, the default for C-h f is to already preselect the function at point as the default.

But you could also use helm-apropos which is part of the standard helm package (available from package repositories, e.g. from MELPA). Helm apropos will preselect the function under the cursor, and I find it one of the nicest tool to locate documentation.


In addition to what others have said, if you use library help-fns+.el then the defaulting is a bit better - the cursor needs only to be near the symbol (e.g. function name) that you want to use.

(The vanilla Emacs behavior picks up only the symbol used for the function call surrounding the cursor, even if the cursor is on top of another function name that you want to investigate. Not too good for a language that passes functions around as arguments etc.)

There are also other enhancements to the Emacs help functions in help-fns+.el.


I get Elisp documentation with lispy. There, C-1 toggles the inline doc for current function. Here's how it looks:


If the docstring is very large, *Help* window is used instead.


You might want to have the documentation display immediately when you type C-h f on a command (that is, without having to press <RET>), while keeping the original behaviour of being able to type the function name when you're anywhere else.

That is not so trivial to do, because function-at-point is very greedy. Telling it to display its first suggestion will result in you being unable to use C-h f's prompt almost anywhere, because it will always find a neighbour suggestion.

So here's my solution, adapted from wasamasa's answer and EmacsWiki's brilliant Describe thing at point

(defun my-describe-function-at-point ()
  "Behaves like function-at-point, but removes the need to type <RET> 
when point is over a function."
  (let (sym)
    ;; sigh, function-at-point is too clever.  we want only the first half.
    (cond ((setq sym (ignore-errors
               (with-syntax-table emacs-lisp-mode-syntax-table
               (or (not (zerop (skip-syntax-backward "_w")))
                   (eq (char-syntax (char-after (point))) ?w)
                   (eq (char-syntax (char-after (point))) ?_)
                   (forward-sexp -1))
               (skip-chars-forward "`'")
               (let ((obj (read (current-buffer))))
                 (and (symbolp obj) (fboundp obj) obj))))))
       (describe-function sym))
        (call-interactively 'describe-function)))))

(define-key emacs-lisp-mode-map (kbd "C-h f") 'my-describe-function-at-point)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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