Subject: bug#19829: 25.0.50; Design of commands operating on rectangular regions

From: Juri Linkov <[email-masked]>
Date: Wed, 08 Jul 2015 01:15:45 +0300

>   > +(defvar region-insert-function
>   > +  (lambda (lines)
>   > +    (let ((first t))
>   > +      (while lines
>   > +        (or first
>   > +            (insert ?\n))
>   > +        (insert-for-yank (car lines))
>   > +        (setq lines (cdr lines)
>   > +              first nil))))
>   > +  "Function to insert the region's content.
>   > +Called with one argument LINES.
>   > +Insert the region as a list of lines.")
>
> What is the meaning of a list of lines as the region
> if it is NOT a rectangle?  What would that kind of region mean,
> and when would it be used?

Actually this function is not intended for a rectangle.  It's a generic
implementation that works like `insert-for-yank' currently does.

But it uses a list of lines as its argument for compatibility with
the existing `cua--insert-rectangle' and the new proposed
`rectangle--insert-region' (that uses the existing `insert-rectangle')
and that both of them accept a list of lines as their argument.

> (I ask because there's a different function for rectangles,
> so this function won't be used with a list of lines for rectangles.)

The generic `region-insert-function' needs to have the same argument
(i.e. a list of lines) for the case when it's overridden by one of the
rectangle-handling functions.  But its generic implementation inserts
a list of lines the same way as `insert-for-yank' inserts a single
string where lines are separated by newlines.