Thank you for the comments. I revised English as suggested. >> +(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 not necessary anymore. (equal (mouse-posn-property (event-start start-event) 'face) 'region) (equal (mouse-posn-property (event-start start-event) 'face) 'secondary-selecton) >> +(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'. > Please add a NEWS entry and some minimal documentation in the user > manual. I add ChangeLog, NEWS, and Info as shown below. I think that all concerns were resolved for now. # ChangeLog 2017-05-16 Tak Kunihiro Support drag and drop region by the mouse (Bug#26725) * doc/emacs/frames.texi (Drag and Drop): Document support of drag and drop region by the mouse. * lisp/mouse.el (mouse-drag-region): Call mouse-drag-and-drop-region when start-event is against region. (mouse-drag-and-drop-region): Move the region by dragging the mouse. # NEWS ** Support drag and drop text by the mouse. You can start drag-and-drop text by customizing 'mouse-drag-and-drop-region'. # Info diff --git a/site-lisp/frames.252.texi b/site-lisp/frames.texi index 1611bd1..da140a6 100755 --- a/site-lisp/frames.252.texi +++ b/site-lisp/frames.texi @@ -1046,12 +1046,17 @@ Window Dividers, elisp, The Emacs Lisp Reference Manual}. @cindex drag and drop In most graphical desktop environments, Emacs has basic support for -@dfn{drag and drop} operations. For instance, dropping text onto an -Emacs frame inserts the text where it is dropped. Dropping a file -onto an Emacs frame visits that file. As a special case, dropping the -file on a Dired buffer moves or copies the file (according to the -conventions of the application it came from) into the directory -displayed in that buffer. +@dfn{drag and drop} operations. For instance, dragging region can move +the entire region of text to point where mouse is dragged over to. +Dropping text onto an Emacs frame inserts the text where it is dropped. +Dropping a file onto an Emacs frame visits that file. As a special +case, dropping the file on a Dired buffer moves or copies the file +(according to the conventions of the application it came from) into the +directory displayed in that buffer. + +@vindex mouse-drag-and-drop-region + If you prefer to move the entire region of text by mouse, customize +the variable @code{mouse-drag-and-drop-region}. @vindex dnd-open-file-other-window Dropping a file normally visits it in the window you drop it on. If