unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "tomas@tuxteam.de" <tomas@tuxteam.de>
To: Drew Adams <drew.adams@oracle.com>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: [External] : Re: Fix for `use-region-p' problem   [was: Elisp test for whether `mouse-1' is pressed?]
Date: Tue, 9 Nov 2021 12:29:03 +0100	[thread overview]
Message-ID: <20211109112903.GC13092@tuxteam.de> (raw)
In-Reply-To: <SJ0PR10MB54882DDA47E55DA1BBF5EE08F3919@SJ0PR10MB5488.namprd10.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 2839 bytes --]

On Mon, Nov 08, 2021 at 06:32:41PM +0000, Drew Adams wrote:
> Thanks for replying, Tomas.
> 
> > > I got no response to my question of how to tell
> > > whether `mouse-1' is still pressed during a click.
> > 
> > [...]
> > 
> > I read twice through your text and I'm still trying
> > to wrap my head around the gist of it.
> 
> Sorry for any confusion or difficulty.

Come on. No need to apologise.

> I can't tell if you mean that you had difficulty with
> (1) the original post, asking how to tell when mouse-1
> is pressed (the text you quoted) or with (2) my last
> message (with changed Subject), which is what you
> replied to.  Or perhaps you had difficulty with both?

The direct ref would be (2), but my confusion is so
diffuse that I'd take everything with its grain of
salt :)

> > My feeling (it mitght be totally wrong [...])

[...]

> The problem I described is only with the implementation
> of predicate `use-region-p'.  Its (minor) failing is
> only with a corner case: returning true between mouse-1
> down and up events during a click action (down & up at
> the same place).

Oh, I think I get it now. So I did the following experiment:

  (setq my-timer
        (run-with-timer 0 0.05
                        (lambda()
                          (message "%s  REG=%s"
                                   (current-time-string)
                                   (use-region-p)))))

The antidote is:

  (cancel-timer my-timer)

...I keep it around in the same buffer.

Now while the above is running, when I click with mouse-1, REG
says "nil" /until/ I move the mouse far enough that the region
is at least one char wide: then REG says t. If I go back to the
starting point (while keeping mouse-1 down all the time), REG
says nil again.

I'm not a heavy mouse user (TBH, I'm a reluctant mouse user),
but the above behaviour looks reasonable to me.

> Event `down-mouse-1' (button-down) activates the region,
  [...]

This doesn't happen for me. I've to drag the mouse a bit for
the region to become active (a bit: one char width, as far as
I can discern).

FWIW, that's "my" Emacs:

    This is GNU Emacs, one component of the GNU/Linux operating system.

    GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.32,
    cairo version 1.16.0) of 2021-09-30

I haven't tried with -Q, but I would, if you think that
might shed more light on the topic.

> and event `mouse-1' (button-up) either (1) leaves it
> activated, if the positions of down & up differ, or (2)
> deactivates it, if those positions are the same.  (See
> function `mouse-drag-track' for details.)

I think we're seeing different things, so there might
still be a gap between what I think I've understood
and what I've actually understood :)

Cheers
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2021-11-09 11:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-07 23:26 Fix for `use-region-p' problem [was: Elisp test for whether `mouse-1' is pressed?] Drew Adams
2021-11-08  8:28 ` tomas
2021-11-08 18:32   ` [External] : " Drew Adams
2021-11-09 11:29     ` tomas [this message]
2021-11-09 16:17       ` Drew Adams
2021-11-09 16:58         ` tomas

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=20211109112903.GC13092@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /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).