Subject: Re: bug#21313: 25.0.50; Strange errors from dbus-handle-event

From: Tassilo Horn <[email-masked]>
Date: Sat, 03 Oct 2015 08:32:56 +0200

Tassilo Horn <[email-masked]> writes:

> My problem is that the search space is not so small.  Assuming that
> events are created correctly at first, I'd probably start recording
> events at kbd_buffer_store_event but then I'd want to track when, where,
> and how they are modified.  Well, just the first would be better than
> nothing I guess.  I'll try that out.

Can someone give me a hint what I'm doing wrong?  With the changes below
keyboard.c still compiles but the step

  ./temacs --batch --load loadup bootstrap

starts using up all my RAM and swap space until I kill it.

--8<---------------cut here---------------start------------->8---
modified   src/keyboard.c
@@ -3412,6 +3412,11 @@ kbd_buffer_nr_stored (void)
 void
 kbd_buffer_store_event (register struct input_event *event)
 {
+  Faset (Vth_event_buffer, Vth_event_buffer_idx, make_lispy_event (event));
+  if (Vth_event_buffer_idx == 99)
+    Vth_event_buffer_idx = 0;
+  else
+    Vth_event_buffer_idx++;
   kbd_buffer_store_event_hold (event, 0);
 }
 
@@ -11131,6 +11136,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(100, 0);
+
+  DEFVAR_LISP ("th-input-event-buffer-idx", Vth_event_buffer_idx,
+	       doc: /* Current index in th-event-buffer.  */);
+  Vth_event_buffer_idx = 0;
+
   DEFVAR_LISP ("last-command-event", last_command_event,
 		     doc: /* Last input event that was part of a command.  */);
 
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo