You are viewing a single thread.
View all comments
1 point

Wow TIL about the occur behavior with prefix arg.

I usually call my own wrapper command that runs occur for the selected region (instead of limiting to region) or the symbol at point (the most common case when programming). Thanks to your video I added prefix arg support:

(defun hoagie-occur-sexp-or-region ()
  "Run occur for the sexp at point, or the active region.
By default, occur _limits the search to the region_ if it is active."
  (interactive)
  (occur (if (use-region-p)
             (buffer-substring-no-properties (region-beginning)
                                             (region-end))
           (thing-at-point 'sexp t))
         (when current-prefix-arg
	       (prefix-numeric-value current-prefix-arg))))

Thank you!!!

permalink
report
reply

Emacs

!emacs@communick.news

Create post

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

  • Windows
  • Mac OS X
  • GNU/Linux and BSD (Just get it from your distribution’s package manager)

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for “emacs” and “vi” link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

Community stats

  • 18

    Monthly active users

  • 562

    Posts

  • 2.4K

    Comments