Emacs kaizen: helm-swoop and editing

Posted: - Modified: | emacs

Continuing on this quest to focus on one tiny little workflow change at a time, so that I can get even better at using Emacs…

One of those packages I installed but never got around to trying out was all, which lets you interactively edit all lines matching a given regular expression. It’s like an editable occur, sorta.

It turns out that helm-swoop lets you use C-c C-e to edit matching lines interactively (so you can use keyboard macros or replace-regexp or whatever). You can type C-x C-s to save it back to the buffer.

On a related note, I’m still tickled pink every time I use dired-toggle-read-only (C-x C-q) to make a Dired buffer editable so that I can batch-rename filenames.

You can view 11 comments or e-mail me at sacha@sachachua.com.

11 comments

Grant Rettke

2015-01-27T00:30:32Z

Have you tried using `multiple-cursors' and if so how does it compare to `all'?

The nice thing about 'all' is that it brings all the lines you are interested in editing into a smaller buffer than the original. In many cases, this will now fit entirely in the frame. I've occasionally run into trouble with mc/mark-all-like-this where I started editing something I didn't intend to and couldn't see at the current frame position.

Matthew M. Keeler

2015-01-28T00:49:55Z

When you have multiple active cursors, if you hit C-' it will hide lines that don't have an active cursor.

Oh! I didn't know that. Neat. =)

Grant Rettke

2015-01-28T18:33:54Z

Nice!

milkypostman

2015-01-28T19:15:57Z

wow, amazing!

I like helm-swoop for that too; the overview is helpful. Also, having an editable buffer means I can make slightly-different tweaks to each line. I use multiple-cursors if the changes that I want to make are identical across lines. =)

Grant Rettke

2015-01-28T18:33:45Z

Nice to know, thanks.

milkypostman

2015-01-28T19:16:50Z

Can you use `multiple-cursors` inside the swoop buffer?

Yup, sure can!

You can just press the `e' key in occur mode? or does this do something different?