magnars/multiple-cursors.el — pull request #37 by Fuco1 (2012-10-27 18:47:19+00:00)
Title: mark-all-like-this-dwim (do what I mean)

The most oft usecase of this is when I'm inside a defun and I want to change some local variable to something else. Often, in many defuns you have the same local variables, so mark-all-like-this isn't very convenient. (by defun I'm assuming function in any mode that defines what a defun is, not only elisp).

This function is smart enough to only select stuff within the current defun. Also, if there is no active region, it selects the word under the cursor. So you can C-s, "mark-dwim" without the need to select the identifier, which makes it a few percent cooler (how much exactly is hard to tell ;)

When in html/sgml mode, if inside a tag (like this ), it will select the tag and its pair and allow you to change them both (similar to functionality from mark-multiple). If inside the tag.text space, it behaves as usual (so it only select the tag pair if point is inside the tag).

With prefix, it behaves exactly as mark-all-like-this.

It is also possible to add more specific features/heuristics for other modes. When I think of some, I'll update it :)

PS: You'd need to add this function to the run-once list, I forgot to include it in commit :(