unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David <dajo@Rednose.Rhubarb>
Cc: emacs-devel@gnu.org
Subject: Re: input-pending-p
Date: Mon, 27 May 2002 17:02:11 -0600	[thread overview]
Message-ID: <200205272302.g4RN2Bm06859@Rednose.Rhubarb> (raw)
In-Reply-To: <200203102132.g2ALWnX04173@wijiji.santafe.edu> (message from Richard Stallman on Sun, 10 Mar 2002 14:32:49 -0700 (MST))

I think that I have found out the cause of this problem.  I *have*
found out how to solve the problem from my point of view.  Currently I
am testing to the extent possible.  Please be aware that I do not have
a comfortable grasp of what is happening in Emacs; what I write and
what I have done is inspired guesswork.

If you have any commentary I shall be pleased to receive it.  I am
especially interested in knowing if this problem will be addressed in
future releases.

It seems that Gnome/sawfish is fond of generating FOCUS_IN_EVENT
events (and other stuff - Emacs gets quite busy).  These events then
are put into the Emacs event queue and result in a positive yield from
input-pending-p when really there is nothing there.  The problem does
not arise with fvwm, twm, etc because they do not generate the
FOCUS_IN_EVENT events.

So far this patch has solved the problem for me.

patch for 21.2 keyboard.c

6245,6250c6245,6253
<       kbd_buffer_store_event (&buf[i]);
<       /* Don't look at input that follows a C-g too closely.
< 	 This reduces lossage due to autorepeat on C-g.  */
<       if (buf[i].kind == ascii_keystroke
< 	  && buf[i].code == quit_char)
< 	break;
---
>       if (buf[i].kind != FOCUS_IN_EVENT)
>         {
>           kbd_buffer_store_event (&buf[i]);
>           /* Don't look at input that follows a C-g too closely.
>              This reduces lossage due to autorepeat on C-g.  */
>           if (buf[i].kind == ascii_keystroke
>               && buf[i].code == quit_char)
>             break;
>         }

dajo

>  - Function: input-pending-p
>      This function determines whether any command input is currently
>      available to be read.  It returns immediately, with value `t' if
>      there is available input, `nil' otherwise.  On rare occasions it
>      may return `t' when no input is available.
> 
> You might like to know that this function is, newly, giving me trouble
> so that the "rare occasions" occur exactly 50% of the time.  I am
> calling the function in small (1-5) bursts and the value yielded by
> input-pending-p is predictably and reliably nil on the odd-numbered
> calls and t on the even numbered calls.  Under the conditions that
> pertain the value always should be nil.
> 
> The code that, now, is failing is years old, has been in use
> sucessfully for years, and, what is interesting, now performs like
> this.
> 
> Emacs 20.7, window managers twm, fvwm, Gnome:  works properly
> Emacs 21.1, window managers twm, fvwm:         works properly
> Emacs 21.1, window managers Gnome, KDE:        fails as indicated
> It is difficult for me to check KDE and 20.7 at the moment.

  parent reply	other threads:[~2002-05-27 23:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200203070326.g273Q6A02247@Rednose.Rhubarb>
2002-03-10 21:32 ` input-pending-p Richard Stallman
2002-03-24 23:50   ` input-pending-p David
2002-03-25  6:24     ` input-pending-p Eli Zaretskii
2002-03-25 12:01     ` input-pending-p Richard Stallman
2002-05-27 23:02   ` David [this message]
2002-06-05 22:00     ` input-pending-p Kim F. Storm
2002-06-09 16:16       ` input-pending-p David

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=200205272302.g4RN2Bm06859@Rednose.Rhubarb \
    --to=dajo@rednose.rhubarb \
    --cc=dajo@a-vip.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).