bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26725: patch for mouse.el


From: Eli Zaretskii
Subject: bug#26725: patch for mouse.el
Date: Sat, 27 May 2017 15:00:39 +0300

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]