all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: bojohan+mail@dd.chalmers.xn--se, 675@debbugs.gnu.org
Subject: bug#675: 23.0.60; Edebugging track-mouse
Date: Sun, 20 Oct 2019 09:36:56 +0200	[thread overview]
Message-ID: <87r237g95z.fsf@gnus.org> (raw)
In-Reply-To: <yoijk5er1je7.fsf@remote5.student.chalmers.se> ("Johan \=\?utf-8\?Q\?\=5C\=22Bockg\=C3\=A5rd\=22's\?\= message of "Fri, 08 Aug 2008 19:55:28 +0200")

bojohan+mail@dd.chalmers.se (Johan "Bockgård)" writes:

> emacs -Q
>
> (defun foo ()
>   (track-mouse (ignore) (ignore)))
>
> Instrument the function with C-u C-M-x.
>
> Move the mouse. (Don't click.)
>
> Call (foo)
>
> Press "g". Edebug stops at each expresson inside track-mouse (repeat
> "g").
>
> Expected results: "g" should continue without stopping (only at
> breakpoints).
>
> If the last mouse action was a click the problem doesn't happen.

The code that's causing this is

            (when (input-pending-p)
	      (setq edebug-stop t)
	      (setq edebug-execution-mode 'step) ; for `edebug-overlay-arrow'
	      (edebug-stop))

because when you're tracking the mouse (and you move it), you'll have
input pending, I think?  Hm...  No, it's not that simple -- just moving
the mouse before calling (foo) also triggers this.

Hm!

This gets stranger and stranger.  Here's a simple test case:  Move the
mouse (don't click it), and then eval this:

(track-mouse (input-pending-p))

I get t.  If the last mouse action is a click, then it evaluates to nil.

Right.  Move the mouse (don't click) and then evaluate:

(track-mouse (when (input-pending-p) (read-event "foo: ")))
=> (mouse-movement (#<window 4824 on *unsent wide reply to Johan "Bockgård*> 892 (863 . 529) 1948101423 nil 892 (57 . 17) nil (398 . 19) (15 . 30)))

So `track-mouse' will give you the previous mouse movement?  OK, that's
fine I guess.

But back to the original problem:  (input-pending-p) is non-nil here,
but it's because of a mouse movement, which edebug doesn't care about.

I guess edebug really cares about unread-command-events here?  So
changing the call to just examine that instead might be the fix?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  parent reply	other threads:[~2019-10-20  7:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <yoijk5er1je7.fsf@remote5.student.chalmers.se>
2011-09-11 17:17 ` bug#675: 23.0.60; Edebugging track-mouse Lars Magne Ingebrigtsen
2014-02-26  9:16   ` Xue Fuqiao
2016-07-10 21:04     ` npostavs
2019-10-20  7:36 ` Lars Ingebrigtsen [this message]
2019-10-20 11:00   ` Eli Zaretskii
2019-10-20 11:21     ` Lars Ingebrigtsen
2019-10-20 11:38       ` Eli Zaretskii
2019-10-20 11:49         ` Lars Ingebrigtsen
2022-02-12  7:41 ` Lars Ingebrigtsen

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=87r237g95z.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=675@debbugs.gnu.org \
    --cc=bojohan+mail@dd.chalmers.xn--se \
    /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.