unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
Cc: 26725-done@debbugs.gnu.org
Subject: bug#26725: patch for mouse.el
Date: Sat, 27 May 2017 15:00:39 +0300	[thread overview]
Message-ID: <838tliik60.fsf@gnu.org> (raw)
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))

> 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 <tkk@misasa.okayama-u.ac.jp>
> 
> 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.





  reply	other threads:[~2017-05-27 12:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-01  5:43 bug#26725: patch for mouse.el Tak Kunihiro
     [not found] ` <handler.26725.B.1493617426654.ack@debbugs.gnu.org>
2017-05-06 22:06   ` Tak Kunihiro
2017-05-07 17:08     ` Eli Zaretskii
2017-05-07 22:46       ` Tak Kunihiro
2017-05-13 17:38 ` Eli Zaretskii
2017-05-15  4:01   ` Tak Kunihiro
2017-05-19  2:07     ` Tak Kunihiro
2017-05-27 12:00       ` Eli Zaretskii [this message]
2017-05-15  9:53   ` Tak Kunihiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=838tliik60.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=26725-done@debbugs.gnu.org \
    --cc=tkk@misasa.okayama-u.ac.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).