unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: rpluim@gmail.com, michael.albinus@gmx.de, 21313@debbugs.gnu.org
Subject: bug#21313: 25.0.50; Strange errors from dbus-handle-event
Date: Sat, 03 Oct 2015 14:06:56 +0200	[thread overview]
Message-ID: <87y4fk5f6n.fsf@gnu.org> (raw)
In-Reply-To: <83k2r446sx.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 03 Oct 2015 12:53:18 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> I guess that naive approach won't work because make_lispy_event is not
>> free of side-effects.  It actually modifies the event so calling it
>> twice per event has negative consequences.
>
> Indeed, you probably should construct the Lisp object from the event
> by hand.  Especially since we suspect some events might be invalid.

Uh, well, does "by hand" mean reimplement make_lispy_event?  I've tried
cheating and calling that on a copy of the actual input_event.  At least
that compiles, emacs starts, and after some time my th-event-buffer will
have the number 7 at index 0, and eventually it'll segfault.

But I'm probably barking up the wrong tree anyway.
kbd_buffer_store_event doesn't seem to be called very frequently;
certainly not for every event.

--8<---------------cut here---------------start------------->8---
modified   src/keyboard.c
@@ -3412,6 +3412,15 @@ kbd_buffer_nr_stored (void)
 void
 kbd_buffer_store_event (register struct input_event *event)
 {
+  printf ("kbd_buffer_store_event: %d\n", event);
+  struct input_event event_copy = *event;
+  printf ("    copy:               %d\n", &event_copy);
+  Faset (Vth_event_buffer, Vth_event_buffer_idx, make_lispy_event (&event_copy));
+  if (Vth_event_buffer_idx == make_number (99))
+    Vth_event_buffer_idx = make_number (0);
+  else
+    Vth_event_buffer_idx = call2 (Qplus, Vth_event_buffer_idx, make_number (1));
+
   kbd_buffer_store_event_hold (event, 0);
 }
 
@@ -11131,6 +11140,14 @@ syms_of_keyboard (void)
   defsubr (&Sposn_at_point);
   defsubr (&Sposn_at_x_y);
 
+  DEFVAR_LISP ("th-input-event-buffer", Vth_event_buffer,
+	       doc: /* The last 100 events.  */);
+  Vth_event_buffer = Fmake_vector(make_number (100), Qnil);
+
+  DEFVAR_LISP ("th-input-event-buffer-idx", Vth_event_buffer_idx,
+	       doc: /* Current index in th-event-buffer.  */);
+  Vth_event_buffer_idx = make_number (0);
+
   DEFVAR_LISP ("last-command-event", last_command_event,
 		     doc: /* Last input event that was part of a command.  */);
 
--8<---------------cut here---------------end--------------->8---


>> Well, I now try following Michaels suggesting of reverting this one
>> commit about `unread-command-events'.
>
> That's okay, but only as a means of switching your attention to the
> alternative source of those bogus events (like unread-command-events).
> The commit mentioned by Michael is not going to go away, as it fixes a
> bad problem.  However, it might need some adjustments to prevent
> adverse side effects, if indeed reverting it will solve these
> problems.

Yeah, that commit seems to be unrelated anyway.

> > But looking at the changes of this commit, I think the functions it
> > touched are not used when editing in a message-mode buffer.
> 
> There's also 30a6b1f81412044aa7dda5573b0142a0a03c4fd3, although it was
> supposed to deal only with recording input events for the purposes of
> keyboard macros.

Ok, I'm running with that being reverted now.

Bye,
Tassilo





  reply	other threads:[~2015-10-03 12:06 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21 16:24 bug#21313: 25.0.50; Strange errors from dbus-handle-event Tassilo Horn
2015-09-09 20:43 ` Tassilo Horn
2015-09-11 12:28   ` Tassilo Horn
2015-09-11 12:39     ` Eli Zaretskii
2015-09-11 13:06       ` Tassilo Horn
2015-09-11 13:59         ` Eli Zaretskii
2015-09-15 15:37           ` Tassilo Horn
2015-09-15 16:01             ` Eli Zaretskii
2015-09-16 11:39               ` Tassilo Horn
2015-09-22  5:49               ` Tassilo Horn
2015-09-22  8:00                 ` Robert Pluim
2015-09-22  8:21                   ` Tassilo Horn
2015-10-02 18:36                     ` Tassilo Horn
2015-10-02 19:05                       ` Eli Zaretskii
2015-10-02 20:33                         ` Tassilo Horn
2015-10-02 21:10                           ` Eli Zaretskii
2015-10-02 21:26                             ` Michael Albinus
2015-10-03  5:40                               ` Tassilo Horn
2015-10-03  6:32                                 ` Tassilo Horn
2015-10-03  7:14                                   ` Eli Zaretskii
2015-10-03  8:10                                     ` Tassilo Horn
2015-10-03  9:53                                       ` Eli Zaretskii
2015-10-03 12:06                                         ` Tassilo Horn [this message]
2015-10-03  7:43                                 ` Michael Albinus
2015-10-03  8:13                                   ` Tassilo Horn
2015-10-03  9:38                                     ` Tassilo Horn
2015-10-03 10:53                                       ` Eli Zaretskii
2015-10-14  9:58                                         ` Tassilo Horn
2015-10-14 17:05                                           ` Eli Zaretskii
2015-10-14 19:37                                             ` Tassilo Horn
2015-10-14 19:43                                               ` Eli Zaretskii
2015-10-15 11:37                                                 ` Tassilo Horn
2015-10-15 16:56                                                   ` Eli Zaretskii
2015-10-15 17:35                                                     ` Tassilo Horn
2015-10-15 19:44                                                       ` Eli Zaretskii
2015-10-16  4:53                                                         ` Tassilo Horn
2015-10-16  7:02                                                           ` Eli Zaretskii
2015-10-16  7:45                                                             ` Tassilo Horn
2015-10-16  8:23                                                               ` Eli Zaretskii
2015-10-16  9:25                                                                 ` Tassilo Horn
2015-10-16 10:11                                                                   ` Eli Zaretskii
2015-10-16 10:22                                                                     ` Tassilo Horn
2015-10-29  7:43                                                                       ` Tassilo Horn
2015-10-29 16:19                                                                         ` 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=87y4fk5f6n.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=21313@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=michael.albinus@gmx.de \
    --cc=rpluim@gmail.com \
    /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).