Akshar Varma · @aksharvarma
64 followers · 562 posts · Server mathstodon.xyz

Another editing discovery. Every time my thought process goes along the lines of: "I can also do this!?!!"

Today's cast: , isearch, wgrep, and optionally keyboard macros, iedit and wdired.

(h/t This thread: emacs.ch/@ramin_hal9001/110933.
@ramin_hal9001 and @cwebber were mentioning many cools emacs tips and I learnt that I can *edit* what comes out of occur!)

TIL that you can switch from isearch to occur mid search! So you can do something like:
1. Start incremental (regexp) search in an editable buffer.
2. Once satisfied with the regex/search term, Do `M-s o` to have all matching lines end up in an occur buffer.
3. Press `e` to enable wgrep giving you an editable buffer with only matching lines.
4. Do whatever editing you like: iedit, regex replace, keyboard macros, whatever.
5. `C-c C-c` when done and the changes get reflected in *original buffer*.

Triggering occur after incremental search gets you the best of both worlds: the visual feedback on the regexp search helping to interactively adjust it. You jump to occur only when you're satisfied with the matches. It will be as if you had magically typed out that complex regexp free-hand.

#regex #occur #emacs

Last updated 1 year ago

WordofTheHour · @wordofthehour
2266 followers · 35797 posts · Server botsin.space

: to meet; to clash

- French: arrive

- German: auftreten

- Portuguese: ocorrer

- Spanish: ocurre

------------

See previous words @ wordofthehour.org/r/past

#occur

Last updated 1 year ago

WordofTheHour · @wordofthehour
2156 followers · 32771 posts · Server botsin.space

: to meet; to clash

- French: arrive

- German: auftreten

- Portuguese: ocorrer

- Spanish: ocurre

------------

See previous words @ wordofthehour.org/r/past

#occur

Last updated 2 years ago