From: David <dajo@Rednose.Rhubarb>
Cc: emacs-devel@gnu.org
Subject: Re: input-pending-p
Date: Sun, 24 Mar 2002 16:50:43 -0700 [thread overview]
Message-ID: <200203242350.g2ONoh122379@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 have re-looked at this issue today with the following results.
* Problem Summary: input-pending-p yields an incorrect value 50% of the time
in emacs 21.1 and emacs-21.2 under some window managers.
* Result Summary: I have been unsuccessful in solving the problem. I have
made all the efforts that I can think of, with result that it appears that
the problem lies in code called by get_input_pending in keyboard.c. The
problem only occurs when running under some window managers. Truly simple
demonstration code is not obvious. The complex demonstration code is
available to anyone; this complex code is simple to install and uninstall.
* My procedure was as follows.
** run under Gnome
** run one copy of emacs-21.1 as the testpiece
** run another emacs (which was emacs-21.2) running gdb, and attach the
testpiece via its pid.
** do not use the mouse at all
* Following this procedure gives the sequence of outputs from input-pending-p
as t t t t t ...
* Running the emacs-21.1 without gdb gives the sequence t nil t nil t ...
* The sequence from emacs-21.1 running under twm is nil nil nil nil nil ...
and this is correct under the test conditions.
* The sequence from emacs-20.7 running under Gnome is nil nil nil nil nil ...
and this is correct under the test conditions.
* Thus (my) using gdb modifies the problem so that I am unable to make
comparisons.
* I put the following code into keyboard.c. This gives entirely consistent
results with what is seen in lisp. I conclude that the problem lies in
get_input_pending.
/* this function is used below */
void
FYS (str)
char *str;
{
Lisp_Object dummy;
Lisp_Object * dumref;
dummy = build_string (str);
dumref = &dummy;
Fmessage (1, dumref);
}
DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 0, 0,
"T if command input is currently available with no waiting.\n\
Actually, the value is nil only if we can be sure that no input is available.")
()
{
if (!NILP (Vunread_command_events) || unread_command_char != -1)
return (Qt);
get_input_pending (&input_pending, 1);
input_pending > 0 ? FYS("true") : FYS("false");
return input_pending > 0 ? Qt : Qnil;
}
* It is possible to upset the t nil t nil t ... sequence by using "tricks", in
particular by inputting two keystrokes in rapid succession
("double-clicking" on the keyboard). But this leads me to no conclusion
except to re-inforce the idea that the problem is a timing isue. I think
that interrupt_input always is 1, causing the return from get_input_pending,
at least in the attached emacs-21.1 case.
static void
get_input_pending (addr, do_timers_now)
int *addr;
int do_timers_now;
{
/* First of all, have we already counted some input? */
*addr = !NILP (Vquit_flag) || readable_events (do_timers_now);
/* If input is being read as it arrives, and we have none, there is none. */
if (*addr > 0 || (interrupt_input && ! interrupts_deferred))
return;
/* Try to read some input and see how much we get. */
gobble_input (0);
*addr = !NILP (Vquit_flag) || readable_events (do_timers_now);
}
* Also I again looked into producing a simple example; I do not see how to do
that. I can demonstrate, what really is deducible anyway, that the problem
only occurs when I involve X: I have a toggle on the code that uses either
popup frames or windows in the parent emacs; the latter continues to work
perfectly.
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2002-03-24 23:50 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 ` David [this message]
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 ` input-pending-p David
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=200203242350.g2ONoh122379@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).