emacs-devel
[Top][All Lists]
Advanced

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

Re: [External] : Re: Fix for `use-region-p' problem [was: Elisp test f


From: address@hidden
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
User-agent: Mutt/1.5.21 (2010-09-15)

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: signature.asc
Description: Digital signature


reply via email to

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