magnars/expand-region.el — pull request #121 by purcell (2013-10-28 11:20:03+00:00)
Title: Smarter expansion of ruby heredoc contents

Heredocs in ruby are considered strings, but `er/expand-inside-quotes` leaves the terminating string (e.g. "END_DATA") selected, which is not very helpful. That function assumes that string delimiters will always be a single character. This commit adds smarter handling for heredocs in ruby, in which language the terminator can optionally be indented by whitespace.

Obviously this shortcoming will affect other major modes, e.g. perl and php, so a better solution still would be to make `er/expand-inside-quotes` handle heredocs. Unfortunately, I don't think there's a general way to do that, because the `syntax-ppss` info doesn't include the delimiter, and heredoc formatting varies from language to language.

Similarly, ruby (like Perl) has alternate string-quoting syntaxes which are not handled by `er/expand-inside-quotes`, such as `%Q(my magic string here)` -- this commit does not change that.