unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Farblos" <AKFKQU.9DF7RP@vodafonemail.de>
Cc: 60817@debbugs.gnu.org
Subject: bug#60817: 28.2; `x-focus-frame' causes spurious input events causes edebug not showing intermediate results
Date: Sun, 15 Jan 2023 08:23:58 +0200	[thread overview]
Message-ID: <837cxo71tt.fsf@gnu.org> (raw)
In-Reply-To: <69384620685645c180d46d62042feb7d@vodafonemail.de> (bug-gnu-emacs@gnu.org)

> Date: Sat, 14 Jan 2023 22:55:15 +0100
> From:  "Farblos" via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> This is Emacs 28.2 from the Debian emacs-lucid package running on fvwm3
> on Xorg.  I guess that either the lucid toolkit or fvwm3 is part of the
> problem here, since I cannot reproduce this on a gtk3 Emacs.
> 
> To demonstrate the problem:
> 
>   emacs -Q
>   M-x find-function fundamental-mode RET
>   C-u C-M-x                           ; instrument function
>   C-x 4 b *Messages* RET              ; show message buffer
>   C-x o
>   M-x fundamental-mode RET            ; call function
> 
> Then step through function `fundamental-mode' in edebug using SPC.
> While doing so I do not get the intermediate evaluation results
> displayed, but rather only the message "Stop".  My message buffer looks
> like this after stepping through the function:
> 
>   fundamental-mode
>   Stop
> 
>   Result: nil
>   Stop
> 
>   Stop
> 
>   Result: nil
>   Stop
> 
> Meaning: These permanent "Stop" messages hide the intermediate
> results.  I haven't found much information on this on the net,
> only the following thread on gnu.emacs.help:
> 
>   https://groups.google.com/g/gnu.emacs.help/c/ojSN-PgNvxg
> 
> The cause seems to be the call to function `x-focus-frame' in
> function `edebug--display-1':
> 
>   (if (not (memq (framep (selected-frame)) '(nil t pc)))
>       (x-focus-frame (selected-frame)))
> 
> When I instrument that snippet to
> 
>   (when (not (memq (framep (selected-frame)) '(nil t pc)))
>     (message "input-pending-pre: %S" (input-pending-p))
>     (x-focus-frame (selected-frame))
>     (message "input-pending-pst: %S" (input-pending-p)))
> 
> my message buffer looks like this instead:
> 
>   fundamental-mode
>   input-pending-pre: t
>   input-pending-pst: t
>   Stop
> 
>   input-pending-pre: nil
>   input-pending-pst: t
>   Result: nil
>   Stop
> 
>   input-pending-pre: nil
>   input-pending-pst: t
>   Stop
> 
>   input-pending-pre: nil
>   input-pending-pst: t
>   Result: nil
>   Stop
> 
> That spurious pending input caused by `x-focus-frame' triggers
> the following snippet later in function `edebug--display-1':
> 
>   (when (input-pending-p)
>     (setq edebug-stop t)
>     (setq edebug-execution-mode 'step) ; for `edebug-overlay-arrow'
>     (edebug-stop))
> 
> which causes the "Stop" messages.

AFAIU, input-pending-p should filter out focus events, so I don't
think I understand why you see this.  Can you try this in Emacs 29 or
the master branch of the Emacs Git repository, so we make sure this
problem was not fixed already?  If it still happens in those newer
versions, maybe you can step with GDB through get_input_pending, when
it's called from input-pending-p, and through readable_events called
by get_input_pending, and see why focus events aren't filtered out?





  reply	other threads:[~2023-01-15  6:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-14 21:55 bug#60817: 28.2; `x-focus-frame' causes spurious input events causes edebug not showing intermediate results Farblos via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-15  6:23 ` Eli Zaretskii [this message]
2023-01-21 20:03   ` Farblos via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-21 21:36     ` Farblos via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-26  7:47       ` Eli Zaretskii

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=837cxo71tt.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=60817@debbugs.gnu.org \
    --cc=AKFKQU.9DF7RP@vodafonemail.de \
    /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).