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@debbugs.gnu.org
Subject: bug#26725: patch for mouse.el
Date: Sat, 13 May 2017 20:38:37 +0300	[thread overview]
Message-ID: <83d1bc8xnm.fsf@gnu.org> (raw)
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))

> Date: Mon, 01 May 2017 14:43:08 +0900 (JST)
> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
> 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.





  parent reply	other threads:[~2017-05-13 17:38 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 [this message]
2017-05-15  4:01   ` Tak Kunihiro
2017-05-19  2:07     ` Tak Kunihiro
2017-05-27 12:00       ` Eli Zaretskii
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=83d1bc8xnm.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=26725@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).