Subject: Re: bug#31240: 26.1; mouse-save-then-kill does not kill rectangles

From: Federico Tedin <[email-masked]>
Date: Sat, 13 Oct 2018 11:01:38 -0300

> Let's keep B) in mind for the case that someone comes up with a real
> use case where this would be needed.  Mine was just a constructed one
> that looked convincing to me to to be reported.

I agree that option B) seems better. Should I implement it now. or
would it be better to wait for other opinions?

> The only remaining problem I have now is that we are far beyond the 80
> columns limit for code.  I came up with truncating the assignment to
> 'drag-but-negligible' as follows
> ...
> but that's ugly.  If you have any ideas how to handle that better (for
> example, by moving the comment up by a few lines) I'll do that.
> Otherwise, I'll have to use that form above.

I started re-indenting some lines to see if I could make them fit in 80 columns,
but then I realized the results were exactly the same as yours. I just ended up
moving the comment instead:

            ;; Check if "drag but negligible".  Operation "drag but
            ;; negligible" is defined as drag-and-drop the text to
            ;; the original region.  When modifier is pressed, the
            ;; text will be inserted to inside of the original
            ;; region.
            ;; If the region is rectangular, check if the newly inserted
            ;; rectangular text would intersect the already selected
            ;; region. If it would, then set "drag-but-negligible" to t.
            ;; As a special case, allow dragging the region freely anywhere
            ;; to the left, as this will never trigger its contents to be
            ;; inserted into the overlays tracking it.
             (setq drag-but-negligible
                   (and (eq (overlay-buffer (car mouse-drag-and-drop-overlays))
                            buffer-to-paste)
                        (if region-noncontiguous
                            (let ((size (cons region-width region-height))
                                  (start-coordinates
                                   (rectangle-position-as-coordinates start))
                                  (point-to-paste-coordinates
                                   (rectangle-position-as-coordinates
                                    point-to-paste)))
                              (and (rectangle-intersect-p
                                    start-coordinates size
                                    point-to-paste-coordinates size)
                                   (not (<= (car point-to-paste-coordinates)
                                            (car start-coordinates)))))
                          (and (<= (overlay-start
                                    (car mouse-drag-and-drop-overlays))
                                   point-to-paste)
                               (<= point-to-paste
                                   (overlay-end
                                    (car mouse-drag-and-drop-overlays))))))))