this post was submitted on 19 Oct 2023
2 points (100.0% liked)

Emacs

314 readers
2 users here now

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

Get Emacs

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

founded 1 year ago
MODERATORS
top 2 comments
sorted by: hot top controversial new old
[–] sebhoagie@alien.top 1 points 1 year ago

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!!!

[–] cosmologica101@alien.top 1 points 1 year ago

Also a thank you from my side. At the moment I am scanning an org table with over 350 rows and looking for doubles. Next I have to reference the doubles to the first of the doubles. And I discovered thanks to this magnificent tutorial that I can edit all doubles in one place, the occur buffer. And add the references through the edit mode of the occur buffer. Wow... this is really great.