I wrote an elisp function for myself at the weekend:

(defun rr-occur ()                                                                                                                                                                                                                                                                        
  "Run occur using the `word-at-point'."
  (let ((term (thing-at-point 'word t)))                                                                                                                                                                                                                                                  
    (occur term))) 

This seems such an obvious use-case, I am now wondering if this duplicates a "standard" function.

  • Simplify it: (defun rr-occur () (occur (thing-at-point 'word t))). BTW, This has been requested of the emacs developers in the past; maybe try again, maybe this time they'll do it, eg. C-u M-s o Jun 28, 2018 at 21:52

2 Answers 2


There are a number of Emacs commands for which M-n at the input prompt (next-history-element) will insert a reasonable default if there is no next history element available. For occur that happens to be the symbol at point.

So this might do what you want: M-s o M-n

(You might have to hit M-n twice if you have a recent occur search provided as the first 'default').


A common workflow is:

  • 3
    You can also use isearch-forward-symbol-at-point for the first two steps, so the whole sequence would be: M-s-. M-s-o.
    – glucas
    Jun 26, 2018 at 17:24

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.