unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Severe lossage from unread-command-events
Date: Thu, 06 Aug 2015 17:01:52 +0200	[thread overview]
Message-ID: <87k2t831gf.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <83pp30sd5l.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 06 Aug 2015 17:29:58 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: David Kastrup <dak@gnu.org>
>> Date: Wed, 05 Aug 2015 17:46:50 +0200
>> 
>> run the included test file using
>> 
>> emacs -Q -l timer-test.el
>> 
>> and then open the generated dribble file /tmp/mydrib.  On my computer,
>> it looks something like
>> 
>> 0000000000000000001111111111111111111222222222222222222223333333333333333444444444444444444555555555555555556666666666666666667777777777777777778888888888888888899999999999999999
>> 
>> which means that of 4000 events having an effect in the scratch buffer,
>> about 5% (a non-deterministic amount) are actually recorded in the
>> dribble file.  In particular, it looks like only the first of several
>> events placed into unread-command-events at one point of time will ever
>> see the dribble file.  While I am only moderately interested in actually
>> generating a useful dribble file, the same holds for macro recording.
>> And I have an actual application which is severely impacted here.
>> 
>> Note that _all_ of the events (usually) are actually processed as input
>> in the *scratch* buffer.  It is only the recording of them which falls
>> really, really flat on its face.
>
> My reading of the code in read_char is that when we consume events
> from unread-command-events, we don't always record the events we find
> there.

Well, according to how I read the variable description of
unread-command-events, some are bounced back there from input which has
already been recorded.  The description reads:

    Documentation:
    List of events to be read as the command input.
    These events are processed first, before actual keyboard input.
    Events read from this list are not normally added to ‘this-command-keys’,
    as they will already have been added once as they were read for the
    first time.
    An element of the form (t . EVENT) forces EVENT to be added to that list.

My test programs used (t . EVENT) after just using EVENT did not do the
trick either.  However, I don't think most of the other uses of
unread-command-events I have seen bother doing so.  It might or might
not be a red herring.

> Does the following naïve attempt at fixing this give good results?  If
> not, can you tell why not, or show a test case where it misbehaves?

I'll be giving it a try.  The code in keyboard.c is complex to a degree
where I do not trust myself to venture a guess regarding the nature of
the right fix.  Or whether the code is in need of reorganization before
one can hope to get it right anyway.

Thanks,

-- 
David Kastrup



  reply	other threads:[~2015-08-06 15:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 15:46 Severe lossage from unread-command-events David Kastrup
2015-08-06 14:29 ` Eli Zaretskii
2015-08-06 15:01   ` David Kastrup [this message]
2015-08-06 15:25     ` Eli Zaretskii
2015-08-06 15:46       ` David Kastrup
2015-08-06 16:21         ` Eli Zaretskii
2015-08-07 16:08       ` Stefan Monnier
2015-08-07 16:41         ` David Kastrup
2015-08-08 15:14           ` raman
2015-08-07 18:13         ` Eli Zaretskii
2015-08-06 15:33     ` David Kastrup
2015-08-06 16:10       ` Eli Zaretskii
2015-08-06 16:16         ` David Kastrup
2015-08-06 18:47     ` David Kastrup
2015-08-06 20:00       ` David Kastrup
2015-08-10 16:56         ` David Kastrup
2015-08-10 17:35           ` Eli Zaretskii
2015-08-10 17:47             ` David Kastrup
2015-08-10 18:17               ` Eli Zaretskii
2015-08-10 18:34                 ` David Kastrup

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=87k2t831gf.fsf@fencepost.gnu.org \
    --to=dak@gnu.org \
    --cc=eliz@gnu.org \
    --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).