Lisp_Object print_help ();
static Lisp_Object kbd_buffer_get_event ();
+static void record_char ();
/* read a character from the keyboard; call the redisplay if needed */
/* commandflag 0 means do not do auto-saving, but do do redisplay.
int count;
jmp_buf save_jump;
int key_already_recorded = 0;
+ Lisp_Object also_record;
+ also_record = Qnil;
if (CONSP (Vunread_command_events))
{
XSETINT (c, XSTRING (Vkeyboard_translate_table)->data[XFASTINT (c)]);
}
- total_keys++;
- XVECTOR (recent_keys)->contents[recent_keys_index] = c;
- if (++recent_keys_index >= NUM_RECENT_KEYS)
- recent_keys_index = 0;
-
- /* Write c to the dribble file. If c is a lispy event, write
- the event's symbol to the dribble file, in <brackets>. Bleaugh.
- If you, dear reader, have a better idea, you've got the source. :-) */
- if (dribble)
+ /* If this event is a mouse click in the menu bar,
+ return just menu-bar for now. Modify the mouse click event
+ so we won't do this twice, then queue it up. */
+ if (EVENT_HAS_PARAMETERS (c)
+ && CONSP (XCONS (c)->cdr)
+ && CONSP (EVENT_START (c))
+ && CONSP (XCONS (EVENT_START (c))->cdr))
{
- if (INTEGERP (c))
- {
- if (XUINT (c) < 0x100)
- putc (XINT (c), dribble);
- else
- fprintf (dribble, " 0x%x", XUINT (c));
- }
- else
- {
- Lisp_Object dribblee;
+ Lisp_Object posn;
- /* If it's a structured event, take the event header. */
- dribblee = EVENT_HEAD (c);
+ posn = POSN_BUFFER_POSN (EVENT_START (c));
+ /* Handle menu-bar events:
+ insert the dummy prefix event `menu-bar'. */
+ if (EQ (posn, Qmenu_bar))
+ {
+ /* Change menu-bar to (menu-bar) as the event "position". */
+ POSN_BUFFER_POSN (EVENT_START (c)) = Fcons (posn, Qnil);
- if (SYMBOLP (dribblee))
- {
- putc ('<', dribble);
- fwrite (XSYMBOL (dribblee)->name->data, sizeof (char),
- XSYMBOL (dribblee)->name->size,
- dribble);
- putc ('>', dribble);
- }
+ also_record = c;
+ Vunread_command_events = Fcons (c, Vunread_command_events);
+ c = posn;
}
-
- fflush (dribble);
}
- store_kbd_macro_char (c);
-
- num_nonmacro_input_chars++;
+ record_char (c);
+ if (! NILP (also_record))
+ record_char (also_record);
from_macro:
reread_first:
/* Don't echo mouse motion events. */
if (! (EVENT_HAS_PARAMETERS (c)
&& EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qmouse_movement)))
- echo_char (c);
+ {
+ echo_char (c);
+ if (! NILP (also_record))
+ echo_char (also_record);
+ }
/* Record this character as part of the current key. */
add_command_key (c);
+ if (! NILP (also_record))
+ add_command_key (also_record);
/* Re-reading in the middle of a command */
reread:
return c;
}
+/* Record the input event C in various ways. */
+
+static void
+record_char (c)
+ Lisp_Object c;
+{
+ total_keys++;
+ XVECTOR (recent_keys)->contents[recent_keys_index] = c;
+ if (++recent_keys_index >= NUM_RECENT_KEYS)
+ recent_keys_index = 0;
+
+ /* Write c to the dribble file. If c is a lispy event, write
+ the event's symbol to the dribble file, in <brackets>. Bleaugh.
+ If you, dear reader, have a better idea, you've got the source. :-) */
+ if (dribble)
+ {
+ if (INTEGERP (c))
+ {
+ if (XUINT (c) < 0x100)
+ putc (XINT (c), dribble);
+ else
+ fprintf (dribble, " 0x%x", XUINT (c));
+ }
+ else
+ {
+ Lisp_Object dribblee;
+
+ /* If it's a structured event, take the event header. */
+ dribblee = EVENT_HEAD (c);
+
+ if (SYMBOLP (dribblee))
+ {
+ putc ('<', dribble);
+ fwrite (XSYMBOL (dribblee)->name->data, sizeof (char),
+ XSYMBOL (dribblee)->name->size,
+ dribble);
+ putc ('>', dribble);
+ }
+ }
+
+ fflush (dribble);
+ }
+
+ store_kbd_macro_char (c);
+
+ num_nonmacro_input_chars++;
+}
+
Lisp_Object
print_help (object)
Lisp_Object object;