From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#31240: 26.1; mouse-save-then-kill does not kill rectangles Date: Sun, 30 Sep 2018 09:59:50 +0200 Message-ID: <5BB08276.1020309@gmx.at> References: <5BADDC88.7010206@gmx.at> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1538294375 13285 195.159.176.226 (30 Sep 2018 07:59:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 30 Sep 2018 07:59:35 +0000 (UTC) Cc: 31240@debbugs.gnu.org, charles@aurox.ch To: Federico Tedin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 30 09:59:31 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g6WdX-0003Kp-8V for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Sep 2018 09:59:31 +0200 Original-Received: from localhost ([::1]:54178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6Wfd-0007CX-VO for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Sep 2018 04:01:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6Wf5-0006ur-7V for bug-gnu-emacs@gnu.org; Sun, 30 Sep 2018 04:01:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6Wf0-0001dk-8t for bug-gnu-emacs@gnu.org; Sun, 30 Sep 2018 04:01:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55141) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g6Wf0-0001dZ-2F for bug-gnu-emacs@gnu.org; Sun, 30 Sep 2018 04:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g6Wez-00010A-Pg for bug-gnu-emacs@gnu.org; Sun, 30 Sep 2018 04:01:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 Sep 2018 08:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31240 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31240-submit@debbugs.gnu.org id=B31240.15382944053694 (code B ref 31240); Sun, 30 Sep 2018 08:01:01 +0000 Original-Received: (at 31240) by debbugs.gnu.org; 30 Sep 2018 08:00:05 +0000 Original-Received: from localhost ([127.0.0.1]:59393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g6We5-0000xV-8p for submit@debbugs.gnu.org; Sun, 30 Sep 2018 04:00:05 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:54127) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g6We3-0000wR-Gr for 31240@debbugs.gnu.org; Sun, 30 Sep 2018 04:00:04 -0400 Original-Received: from [192.168.1.101] ([213.162.73.174]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MGBdv-1fvJ1F150h-00FE1W; Sun, 30 Sep 2018 09:59:50 +0200 Original-Received: from [192.168.1.101] ([213.162.73.174]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MGBdv-1fvJ1F150h-00FE1W; Sun, 30 Sep 2018 09:59:50 +0200 In-Reply-To: X-Provags-ID: V03:K1:/dSXc8L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HNen9rSGEefD/dqj7KPr3 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:150790 Archived-At: > After trying out some solutions and reading these two suggestions, I've > decided to implement the feature like this. The problem of correctly handling > the cases where the dragged rectangular text would overlap with the original > one was more complex than I'd thought, and I have some doubts if the usefulness > of the feature justifies this added complexity. > > I'm attaching a new patch with all my changes to mouse.el (and rect.el) so far. > I've created two new helper functions in rect.el to avoid cluttering mouse.el > with more functions. > > So, the cases to test out are: > > 1) Dragging and dropping non-rectangular regions should be exactly the > same as before. > 2) Dragging and dropping a rectangle _outside_ of itself should insert > it in the new > position, and then delete the original. > 3) Dragging and dropping a rectangle _inside_ of itself should leave > everything unchanged. > > After evaluating "(setq mouse-drag-and-drop-region 'shift)": > > 4) Dragging and dropping a rectangle inside or outside of itself, while holding > the Shift key when dropping, should insert it there, without deleting > the original. > > When I say 'outside of itself' I mean that there shouldn't be any > overlapping at all > between the original and the newly inserted rectangles. Thank you. From what I can tell, the patch correctly addresses the cases enumerated. Since I don't use rectangle functions I'd urge someone who does use them on a more regular basis to test it. A few issues: I'd rewrite the doc-string of 'rectangle-position-as-coordinates' as something like (defun rectangle-position-as-coordinates (position) "Return cons of the column and line values of POSITION. POSITION specifies a position of the current buffer. The value returned is a cons of the current column of POSITION and its line number." because doc-strings have to describe all arguments of a functions. Also, (count-lines 1 position)))) should become (count-lines (point-min) position)))) And I'd rewrite the doc-string of 'rectangle-intersect-p' like (defun rectangle-intersect-p (pos1 size1 pos2 size2) "Return non-nil if two rectangles intersect. POS1 and POS2 specify the positions of the upper-left corners of the first and second rectangle as conses of their column and line values. SIZE1 and SIZE2 specify the dimensions of the first and second rectangle, as conses of their width and height measured in columns and lines." because the first line of a doc-string must be a complete sentence. Also I'd rewrite forms like (<= (+ x2 w2) x1) as (<= (+ x2 w2) x1) although this still won't make your patch short enough to qualify as "tiny change". So if you haven't done so already, please start the paperwork process so we can apply this patch. Thanks again for working on this, martin