From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#26725: patch for mouse.el Date: Sat, 13 May 2017 20:38:37 +0300 Message-ID: <83d1bc8xnm.fsf@gnu.org> References: <20170501.144308.327409523.tkk@misasa.okayama-u.ac.jp> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1494697218 10468 195.159.176.226 (13 May 2017 17:40:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 13 May 2017 17:40:18 +0000 (UTC) Cc: 26725@debbugs.gnu.org To: Tak Kunihiro Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 13 19:40:09 2017 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 1d9b1U-0002T6-A4 for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 May 2017 19:40:08 +0200 Original-Received: from localhost ([::1]:58406 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d9b1Z-0007Mp-LB for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 May 2017 13:40:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56862) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d9b1S-0007L9-53 for bug-gnu-emacs@gnu.org; Sat, 13 May 2017 13:40:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d9b1P-0000X1-0B for bug-gnu-emacs@gnu.org; Sat, 13 May 2017 13:40:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40540) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d9b1O-0000Wo-Tl for bug-gnu-emacs@gnu.org; Sat, 13 May 2017 13:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d9b1O-0005yq-L5 for bug-gnu-emacs@gnu.org; Sat, 13 May 2017 13:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 May 2017 17:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 26725-submit@debbugs.gnu.org id=B26725.149469715122923 (code B ref 26725); Sat, 13 May 2017 17:40:02 +0000 Original-Received: (at 26725) by debbugs.gnu.org; 13 May 2017 17:39:11 +0000 Original-Received: from localhost ([127.0.0.1]:43217 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9b0Y-0005xe-Sn for submit@debbugs.gnu.org; Sat, 13 May 2017 13:39:11 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9b0W-0005xS-OT for 26725@debbugs.gnu.org; Sat, 13 May 2017 13:39:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d9b0O-0008Hr-7P for 26725@debbugs.gnu.org; Sat, 13 May 2017 13:39:03 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d9b0O-0008Hg-4L; Sat, 13 May 2017 13:39:00 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1224 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1d9b0M-0006yY-LD; Sat, 13 May 2017 13:38:59 -0400 In-reply-to: <20170501.144308.327409523.tkk@misasa.okayama-u.ac.jp> (message from Tak Kunihiro on Mon, 01 May 2017 14:43:08 +0900 (JST)) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:132480 Archived-At: > Date: Mon, 01 May 2017 14:43:08 +0900 (JST) > From: Tak Kunihiro > Cc: tkk@misasa.okayama-u.ac.jp > > Drag and drop a file is already supported by Emacs. This patch > extends drag and drop to region (text). Thanks. Some comments below. > +When the region already exists and `mouse-drag-and-drop-region' > +is non-nil, this moves text on a region to point where mouse is ^^^^^^^^^^^^^^^^^^^^^^^^^^^ "this moves the entire region of text" > +(defcustom mouse-drag-and-drop-region nil > + "If non-nil, dragging mouse of the region moves text." "If non-nil, dragging the mouse drags the region, when that exists. > +(defun mouse-on-region-p (position &optional start end) > + "Return if POSITION is in between START and END in the current buffer. > +When START and END are nil but there is active region, those of > +active region is fed." > + (when (region-active-p) > + (setq start (or start (region-beginning))) > + (setq end (or end (region-end)))) > + (let ((point (posn-point position))) > + (and > + (numberp start) > + (numberp end) > + (numberp point) > + (<= start point) > + (<= point end)))) This algorithm will fail with bidirectional text, where buffer positions don't increase monotonically with screen coordinates. How about testing the face of the character under mouse instead? > +(defun mouse-drag-region-pasting (event) The function's name is confusing. Why not name it like the defcustom? > + "Move text on a region to point where mouse is dragged over to. ^^ "in" > +The transportation of text is also referred as `drag and drop'. > +When text is dragged over to different buffer, the text is copied ^ "a" is missing here. > +instead of cut. "instead of being cur". > This works similar to > +`mouse-drag-secondary-moving' but expects region on launch and > +specifies point later, by mouse. I'd lose this sentence, it doesn't add anything to the doc string. > +To try this function, evaluate the following line. > + (global-set-key [down-mouse-3] \\='mouse-drag-region-pasting) > +Then have a region and grab-and-drag it by mouse to point to move > +to." I think this is inappropriate for a doc string. Please add a NEWS entry and some minimal documentation in the user manual.