News for hackers. Stuff that matters.
Re:Emacs for Professionals by planede on Tuesday May 03, 2022 @04:48AM (#31246117)
Am I the only one who doesn't get the multi-cursor hype? Having said that I never used it, so maybe I'm missing out.
Re:Emacs for Professionals by draxil on Tuesday May 03, 2022 @06:18AM (#31246601)
I used to think "surely this is just fancy find and replace".

But actually it's more like defining a keyboard macro. It's very powerful and quicker and easier than a macro for a lot of tasks.

Re:Emacs for Professionals by atsider on Tuesday May 03, 2022 @04:59AM (#31246177)
Yep, to me it's not far superior to find-replace: https://nullprogram.com/blog/2017/09/07/
Re:Emacs for Professionals by alpaca128 on Tuesday May 03, 2022 @09:06AM (#31247783)
With the right controls it might be a better (more flexible) version of Vim's block selection mode. Which I use almost daily, it's super useful but depends on lines being vertically aligned, which multiple cursors don't need to care about.

But I don't see another purpose for them; find-replace with regex support and macros only fail in rare cases where actual syntax parsing is needed.

Re:Emacs for Professionals by mtnygard on Tuesday May 03, 2022 @10:03AM (#31248452)
I think the utility is proportional to the degree of repetition in your files.
Re:Emacs for Professionals by kreetx on Tuesday May 03, 2022 @04:57AM (#31246167)
You are not. Perhaps people who use it can elaborate, but it seems to be an interactive search-and-replace with highlighting. Is it anything more?
Re:Emacs for Professionals by CraigJPerry on Tuesday May 03, 2022 @05:04AM (#31246206)
In vscode if my cursor is in a word, i Ctrl+D to select that, then Ctrl+D to select further matches, then begin typing over them. There's other modes too where you can just add more cursors to a line below/above but i find less use for that.

But in vim it's not much slower to do:

    /<search term>
    cgn  " change this this i just matched
    .    " find next occurance AND execute the change here too, i don't have to say "n ." because i used cgn above instead of something like cw
But i still end up relying on

    qq  " stick a macro in q register
    <complex edit sequence>
    @q / @@
For more gnarly stuff
Re:Emacs for Professionals by ckolkey on Tuesday May 03, 2022 @05:52AM (#31246459)
presuming you did a `/<search>` for the results you want, you can follow it up with:

  :%s//<replacement>/gc
Re:Emacs for Professionals by alex_smart on Tuesday May 03, 2022 @05:14AM (#31246261)
It is more like interactive editor macros where you can see the intermediate results on the fly.

The advantage over search-and-replace is that you get to work with a nice, familiar language (the interactive commands you send to your editor) rather than using regex.