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, 27 May 2017 15:00:39 +0300 Message-ID: <838tliik60.fsf@gnu.org> References: <20170501.144308.327409523.tkk@misasa.okayama-u.ac.jp> <83d1bc8xnm.fsf@gnu.org> <20170515.130131.472087335.tkk@misasa.okayama-u.ac.jp> <20170519.110743.171510165.tkk@misasa.okayama-u.ac.jp> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1495886473 8832 195.159.176.226 (27 May 2017 12:01:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 27 May 2017 12:01:13 +0000 (UTC) Cc: 26725-done@debbugs.gnu.org To: Tak Kunihiro Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 27 14:01:08 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 1dEaP6-0002Bf-EB for geb-bug-gnu-emacs@m.gmane.org; Sat, 27 May 2017 14:01:08 +0200 Original-Received: from localhost ([::1]:40627 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dEaPB-0005gV-Vp for geb-bug-gnu-emacs@m.gmane.org; Sat, 27 May 2017 08:01:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57554) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dEaP5-0005en-87 for bug-gnu-emacs@gnu.org; Sat, 27 May 2017 08:01:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dEaP0-0003D6-Qd for bug-gnu-emacs@gnu.org; Sat, 27 May 2017 08:01:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37305) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dEaP0-0003D1-JY for bug-gnu-emacs@gnu.org; Sat, 27 May 2017 08:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dEaP0-00015p-DI for bug-gnu-emacs@gnu.org; Sat, 27 May 2017 08:01:02 -0400 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sat, 27 May 2017 12:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 26725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Mail-Followup-To: 26725@debbugs.gnu.org, eliz@gnu.org, tkk@misasa.okayama-u.ac.jp Original-Received: via spool by 26725-done@debbugs.gnu.org id=D26725.14958864534177 (code D ref 26725); Sat, 27 May 2017 12:01:02 +0000 Original-Received: (at 26725-done) by debbugs.gnu.org; 27 May 2017 12:00:53 +0000 Original-Received: from localhost ([127.0.0.1]:39981 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dEaOq-00015H-V0 for submit@debbugs.gnu.org; Sat, 27 May 2017 08:00:53 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38217) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dEaOo-000155-OR for 26725-done@debbugs.gnu.org; Sat, 27 May 2017 08:00:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dEaOf-00036m-5j for 26725-done@debbugs.gnu.org; Sat, 27 May 2017 08:00:45 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:59105) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dEaOf-00036f-2R; Sat, 27 May 2017 08:00:41 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2805 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dEaOd-0004rF-Rp; Sat, 27 May 2017 08:00:40 -0400 In-reply-to: <20170519.110743.171510165.tkk@misasa.okayama-u.ac.jp> (message from Tak Kunihiro on Fri, 19 May 2017 11:07:43 +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:132916 Archived-At: > Date: Fri, 19 May 2017 11:07:43 +0900 (JST) > Cc: 26725@debbugs.gnu.org, tkk@misasa.okayama-u.ac.jp, > tkk@misasa.okayama-u.ac.jp > From: Tak Kunihiro > > Thank you for the comments. > > * English > > I revised English as suggested. > > > * Algorithm in detection of clicking region > > >> +(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? > > I revised the code using following statements. Accordingly, > `mouse-on-region-p' is deleted. > > (equal (mouse-posn-property (event-end event) 'face) 'region) > (member 'secondary-selection(mapcar (lambda (xxx) (overlay-get xxx 'face)) > (overlays-at (posn-point (event-end event))))) > > > * Name of function > > >> +(defun mouse-drag-region-pasting (event) > > > > The function's name is confusing. Why not name it like the defcustom? > > I changed the name from `mouse-drag-region-pasting' to > `mouse-drag-and-drop-region'. As a consequence, variable and function > have the same name. I suppose it is OK. > > > * NEWS, ChangeLog, and Info > > > Please add a NEWS entry and some minimal documentation in the user > > manual. > > I add ChangeLog, NEWS, and Info as shown below. > > > * Copy on Drag and Drop with meta key pressed > > I found that sometimes I want to copy on drop (instead of cut) even > when source buffer and destination buffer are the same. > > I added a logic to let me do so. When modifier key is pressed on > drop, the function does not delete the original region. > > The modifier key is specified by the variable > `mouse-drag-and-drop-region' that is used as flag. I did not create a > new variable. Thanks, pushed to master.