Emacs: multiple-cursors-mode vs plain emacs

By Xah Lee. Date: .

2017-07-04 this page is work in progress. I wanted to demonstrate emacs key macros and other commands can do what multiple cursors does.

from my analysis, the benefit of multiple cursor is that the concept is intuitive. But does not add any real editing power.

no need multi-cursor package

answer to a reddit question https://www.reddit.com/r/emacs/comments/6koktn/use_multiplecursors_and_wish_some_commands/djnvf8z/

not an answer to your question, but here's a way to do without multi-cursor, and i think it's superior.

what you want to do is zap-to-char to f on each line.

  1. put cursor on first line. Alt+x zap-to-char f
  2. move down, M-x repeat-complex-command
  3. repeat for each line.

by default, repeat-complex-command has key Ctrl+x Alt+:. Rather handful. Just make it a single key such as F8, or a simple combo e.g. Ctrl+8

and if there are hundreds of lines, just record a key macro. Then select the lines, Alt+x apply-macro-to-region-lines

Demo of the power of multiple cursor.

Emacs Rocks! Episode 13: multiple-cursors

what it does is just multiple cursors.

insert • at each place, then just M-x replace-string

at 0m25s, those can be easily done with query-replace-regexp. what he's doing is interactively changing his mind. we can do first in one spot to experiment.

at 0m49s, he's relying on end of line to copy, which is not multi-cursor feature.

basically, multi-cursor does not add anything. all it does is visual. The problem of select random places isn't solved unless there's a pattern.

the problem introduced by multi-cursor is risk of erroring on non-uniform places

when places have pattern for multi-cursor to edit uniformly, then no need cuz kmacro, repeat-complex-command, query-replace-regexp, … solves.