all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
Cc: eliz@gnu.org, tak.kunihiro@gmail.com, agrambot@gmail.com,
	emacs-devel@gnu.org
Subject: Re: mouse-drag-and-drop-region
Date: Tue, 28 Nov 2017 09:50:03 +0100	[thread overview]
Message-ID: <5A1D233B.1080803@gmx.at> (raw)
In-Reply-To: <20171127.221126.1551780406743300719.tkk@misasa.okayama-u.ac.jp>

 > I re-revised mouse-drag-and-drop-region.  I'm sending replay to
 > https://lists.gnu.org/archive/html/emacs-devel/2017-11/msg00589.html,
 > ChangeLog, and patch.

Thanks.  Kindly send patches always as attachments, this one choked here
because of a missing form feed near the end.

 > I got rid of usage of secondary-overlay.  I
 > define a new variable mouse-drag-and-drop-region-face.

Very good.

 >>> How to show insert point?
 >>
 >> I think that by default the insert point should be shown by the
 >> mouse cursor alone.  Optionally, I see no problem showing the normal
 >> cursor just as `mouse-drag-region' does, maybe with some
 >> customizable cursor type (I think "bar" would give a better feeling
 >> than "box").
 >
 > OK.  Only set point by mouse-set-point when
 > mouse-drag-and-drop-region-show-tooltip is non-nil with changing
 > cursor type.  I also changed the default of
 > mouse-drag-and-drop-region-show-tooltip to nil to be more stable
 > against accident during dragging.

This reverts too much from your initial proposal.  Basically, all your
initial ideas are fine, just that if on one or the other system they
don't work as intended or some user finds them annoying, there should be
options to turn them off.  And, if accidents happen during dragging with
any of the options non-nil, we should try to handle or fix them anyway.
So I would use three options instead of one:

`mouse-drag-and-drop-region-show-tooltip' to toggle the showing of
tooltips during dragging and nothing else.

`mouse-drag-and-drop-region-highlight-region' to toggle highlighting the
region with `mouse-drag-and-drop-region-face' (which gives the user the
feedback whether cutting may fail when dropping into the region itself,
which was your initial intention IIUC).

`mouse-drag-and-drop-region-show-cursor' which should synchronize the
cursor with the mouse cursor just as `mouse-drag-track' does.  This is
the only option I personally would default to nil but if you or others
like it on by default I certainly won't insist.

 >> More precisely, you should wrap 'track-mouse' and whatever you do
 >> after it terminates in a 'condition-case' form and in the error part
 >> restore everything to the saved values.  Like so:
 >>
 >> (... ; save the state here
 >>   (condition-case nil
 >>       (progn
 >>         (track-mouse
 >> 	 )
 >>         )
 >>     (error ... ; restore the state here
 >> 	  )))
 >>
 >> If you have any problems coding that, please ask.
 >
 > Even track-mouse is sandwiched by condition-case, I cannot catch a
 > error typing during dragging.

When I try to drop the region on the toolbar or another frame (things
some users might try out soon because they are not too far-fetched) I
currently get something like

Wrong type argument: windowp, #<frame emacs@MACHNO 05408d00>

Before your last patch this was a complaint about an overlay.  In either
case, users who don't know much about the internals of Emacs will wonder
what these messages are about and where they come from.  We should tell
them instead something like "Drop failed" or "Cannot drop into initial
region".  And, if such an error occurs, we should be sure to delete the
`mouse-drag-and-drop-overlay' and restore the initial region, if
necessary.

 > However, as inferred already, when
 > mouse-drag-and-drop-region-show-tooltip is nil, it is more stable even
 > typing key during dragging.

Yes.  But typing during dragging should be caught by us in some way.  It
should not defer us from showing tooltips by default.

One final remark: Stepping through every single character in

           ;; Check if selected text is read-only.
           (dolist (index (number-sequence start end))
             ;; (add-text-properties (region-beginning) (region-end) '(read-only t))
             (setq text-from-read-only (or text-from-read-only
                                           (get-text-property index 'read-only)))))
					
is not very efficient if the region is large.  Please consider using
`next-single-char-property-change' instead.

Thanks again, martin



  reply	other threads:[~2017-11-28  8:50 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14  9:54 mouse-drag-and-drop-region martin rudalics
2017-11-14 17:01 ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-14 18:29   ` mouse-drag-and-drop-region martin rudalics
2017-11-14 20:17 ` mouse-drag-and-drop-region Alex
2017-11-15  9:22   ` mouse-drag-and-drop-region martin rudalics
2017-11-15 18:22     ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-15 18:50       ` mouse-drag-and-drop-region martin rudalics
2017-11-15 20:01         ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-16  9:04           ` mouse-drag-and-drop-region martin rudalics
2017-11-15 19:46     ` mouse-drag-and-drop-region Alex
2017-11-15 20:15       ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-15 22:03         ` mouse-drag-and-drop-region Alex
2017-11-16 15:54           ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-17  6:33             ` mouse-drag-and-drop-region Alex
2017-11-17  7:33               ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-17 15:58                 ` mouse-drag-and-drop-region Stefan Monnier
2017-11-17 16:39                   ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-17 22:44                     ` mouse-drag-and-drop-region Stefan Monnier
2017-11-18  7:54                       ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-18 14:36                         ` mouse-drag-and-drop-region Stefan Monnier
2017-11-18 15:04                           ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-18 15:49                             ` mouse-drag-and-drop-region Stefan Monnier
2017-11-18  6:48                 ` mouse-drag-and-drop-region Alex
2017-11-18  9:07                   ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-18 21:58                     ` mouse-drag-and-drop-region Alex
2017-11-19 15:27                       ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-17  8:53               ` mouse-drag-and-drop-region martin rudalics
2017-11-18  6:49                 ` mouse-drag-and-drop-region Alex
2017-11-16  9:04       ` mouse-drag-and-drop-region martin rudalics
2017-11-17  6:02         ` mouse-drag-and-drop-region Alex
2017-11-17  8:53           ` mouse-drag-and-drop-region martin rudalics
2017-11-15 20:22   ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-16  0:28 ` mouse-drag-and-drop-region Tak Kunihiro
2017-11-16  9:11   ` mouse-drag-and-drop-region martin rudalics
2017-11-20 13:29     ` mouse-drag-and-drop-region Tak Kunihiro
2017-11-20 16:03       ` mouse-drag-and-drop-region Drew Adams
2017-11-20 16:09         ` mouse-drag-and-drop-region Alan Schmitt
2017-11-20 17:34         ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-20 18:17         ` mouse-drag-and-drop-region Paul Eggert
2017-11-21  9:24       ` mouse-drag-and-drop-region martin rudalics
2017-11-21 13:09         ` mouse-drag-and-drop-region Stefan Monnier
2017-11-21 14:05           ` mouse-drag-and-drop-region martin rudalics
2017-11-21 19:07             ` mouse-drag-and-drop-region Stefan Monnier
2017-11-22  8:26               ` mouse-drag-and-drop-region martin rudalics
2017-11-22 21:20                 ` mouse-drag-and-drop-region Stefan Monnier
2017-11-23  7:46                   ` mouse-drag-and-drop-region martin rudalics
2017-11-23 14:00                     ` mouse-drag-and-drop-region Stefan Monnier
2017-11-23 16:09                     ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-24  9:02                       ` mouse-drag-and-drop-region martin rudalics
2017-11-24  9:19                         ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-24  9:41                           ` mouse-drag-and-drop-region martin rudalics
2017-11-24 13:25                             ` mouse-drag-and-drop-region Stefan Monnier
2017-11-26 10:24                               ` mouse-drag-and-drop-region martin rudalics
2017-11-24 13:45                             ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-26 10:24                               ` mouse-drag-and-drop-region martin rudalics
2017-11-26 15:54                                 ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-27  8:48                                   ` mouse-drag-and-drop-region martin rudalics
2017-11-27 15:59                                     ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-21 15:45         ` mouse-drag-and-drop-region Eli Zaretskii
2017-11-22  8:22           ` mouse-drag-and-drop-region martin rudalics
2017-11-21 18:52         ` mouse-drag-and-drop-region Robert Weiner
2017-11-22  8:22           ` mouse-drag-and-drop-region martin rudalics
2017-11-23 23:28         ` mouse-drag-and-drop-region Tak Kunihiro
2017-11-24  9:02           ` mouse-drag-and-drop-region martin rudalics
2017-11-27 13:11             ` mouse-drag-and-drop-region Tak Kunihiro
2017-11-28  8:50               ` martin rudalics [this message]
2017-12-01 14:16                 ` mouse-drag-and-drop-region Tak Kunihiro
2017-12-02 10:16                   ` mouse-drag-and-drop-region martin rudalics
2017-12-03 10:06                     ` mouse-drag-and-drop-region martin rudalics
2017-12-03 13:36                       ` mouse-drag-and-drop-region martin rudalics
2017-12-05  4:57                       ` mouse-drag-and-drop-region Tak Kunihiro
2017-12-05  8:53                         ` mouse-drag-and-drop-region martin rudalics
2017-12-06  9:29                           ` mouse-drag-and-drop-region Tak Kunihiro
2017-12-07  9:26                             ` mouse-drag-and-drop-region martin rudalics
2017-12-07 21:45                               ` mouse-drag-and-drop-region Tak Kunihiro
2017-12-08 10:12                                 ` mouse-drag-and-drop-region martin rudalics
2017-12-08 16:14                                   ` mouse-drag-and-drop-region Robert Weiner
2017-12-09 10:35                                     ` mouse-drag-and-drop-region martin rudalics
2017-12-14 23:14                                       ` mouse-drag-and-drop-region Tak Kunihiro
2017-12-15  8:50                                         ` mouse-drag-and-drop-region martin rudalics
2017-12-15 13:25                                           ` mouse-drag-and-drop-region martin rudalics
2017-12-16  2:07                                             ` mouse-drag-and-drop-region Tak Kunihiro
2017-12-16  9:42                                               ` mouse-drag-and-drop-region martin rudalics
2017-12-17  4:40                                                 ` mouse-drag-and-drop-region Tak Kunihiro
2017-12-17 10:44                                                   ` mouse-drag-and-drop-region martin rudalics
2017-12-21  1:36                                                     ` mouse-drag-and-drop-region Tak Kunihiro
2017-12-22  8:43                                                       ` mouse-drag-and-drop-region martin rudalics
2017-12-22  9:25                                                       ` mouse-drag-and-drop-region Eli Zaretskii
2017-12-22 17:57                                                         ` mouse-drag-and-drop-region martin rudalics

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

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

  git send-email \
    --in-reply-to=5A1D233B.1080803@gmx.at \
    --to=rudalics@gmx.at \
    --cc=agrambot@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=tak.kunihiro@gmail.com \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.