/* If this flag is non-nil, we check mouse_moved to see when the
mouse moves, and motion events will appear in the input stream.
Otherwise, mouse motion is ignored. */
-static Lisp_Object do_mouse_tracking;
+Lisp_Object do_mouse_tracking;
/* Symbols to head events. */
Lisp_Object Qmouse_movement;
void
echo_prompt (str)
- char *str;
+ Lisp_Object str;
{
- int len = strlen (str);
+ int nbytes = STRING_BYTES (XSTRING (str));
+ int multibyte_p = STRING_MULTIBYTE (str);
- if (len > ECHOBUFSIZE - 4)
- len = ECHOBUFSIZE - 4;
- bcopy (str, current_kboard->echobuf, len);
- current_kboard->echoptr = current_kboard->echobuf + len;
- *current_kboard->echoptr = '\0';
+ if (nbytes > ECHOBUFSIZE - 4)
+ {
+ if (multibyte_p)
+ {
+ /* Have to find the last character that fit's into the
+ echo buffer. */
+ unsigned char *p = XSTRING (str)->data;
+ unsigned char *pend = p + ECHOBUFSIZE - 4;
+ int char_len;
- current_kboard->echo_after_prompt = len;
+ do
+ {
+ PARSE_MULTIBYTE_SEQ (p, pend - p, char_len);
+ p += char_len;
+ }
+ while (p < pend);
+
+ nbytes = p - XSTRING (str)->data - char_len;
+ }
+ else
+ nbytes = ECHOBUFSIZE - 4;
+ }
+
+ nbytes = copy_text (XSTRING (str)->data, current_kboard->echobuf, nbytes,
+ STRING_MULTIBYTE (str), 1);
+ current_kboard->echoptr = current_kboard->echobuf + nbytes;
+ *current_kboard->echoptr = '\0';
+ current_kboard->echo_after_prompt = nbytes;
echo_now ();
}
echo_char (c)
Lisp_Object c;
{
- extern char *push_key_description ();
-
if (current_kboard->immediate_echo)
{
char *ptr = current_kboard->echoptr;
if (INTEGERP (c))
{
+ int ch = XINT (c);
+
if (ptr - current_kboard->echobuf
> ECHOBUFSIZE - KEY_DESCRIPTION_SIZE)
return;
- ptr = push_key_description (XINT (c), ptr);
+ ptr = push_key_description (ch, ptr, 1);
}
else if (SYMBOLP (c))
{
if ((ptr - current_kboard->echobuf) + STRING_BYTES (name) + 4
> ECHOBUFSIZE)
return;
- bcopy (name->data, ptr, STRING_BYTES (name));
- ptr += STRING_BYTES (name);
+ ptr += copy_text (name->data, ptr, STRING_BYTES (name),
+ name->size_byte >= 0, 1);
}
if (current_kboard->echoptr == current_kboard->echobuf
echoing = 1;
message2_nolog (current_kboard->echobuf, strlen (current_kboard->echobuf),
- ! NILP (current_buffer->enable_multibyte_characters));
+ 1);
echoing = 0;
/* Record in what buffer we echoed, and from which kboard. */
while (!input_pending)
{
if (help_echo_showing_p && !EQ (selected_window, minibuf_window))
- redisplay_preserve_echo_area ();
+ redisplay_preserve_echo_area (5);
else
redisplay ();
record_char (c)
Lisp_Object c;
{
- Lisp_Object help;
-
/* Don't record `help-echo' in recent_keys unless it shows some help
- message. */
- if (!CONSP (c)
- || !EQ (XCAR (c), Qhelp_echo)
- || (help = Fnth (make_number (2), c),
- !NILP (help)))
+ message, and a different help than the previoiusly recorded
+ event. */
+ if (CONSP (c) && EQ (XCAR (c), Qhelp_echo))
+ {
+ Lisp_Object help;
+
+ help = Fnth (make_number (2), c);
+ if (STRINGP (help))
+ {
+ int last_idx;
+ Lisp_Object last_c, last_help;
+
+ last_idx = recent_keys_index - 1;
+ if (last_idx < 0)
+ last_idx = NUM_RECENT_KEYS - 1;
+ last_c = AREF (recent_keys, last_idx);
+
+ if (!CONSP (last_c)
+ || !EQ (XCAR (last_c), Qhelp_echo)
+ || (last_help = Fnth (make_number (2), last_c),
+ !EQ (last_help, help)))
+ {
+ total_keys++;
+ ASET (recent_keys, recent_keys_index, c);
+ if (++recent_keys_index >= NUM_RECENT_KEYS)
+ recent_keys_index = 0;
+ }
+ }
+ }
+ else
{
total_keys++;
ASET (recent_keys, 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. :-) */
redisplay. */
if (!readable_events (1))
{
- redisplay_preserve_echo_area ();
+ redisplay_preserve_echo_area (6);
get_input_pending (&input_pending, 1);
}
}
if (NILP (obj))
{
- int idx;
-
obj = make_lispy_event (event);
#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)
get_input_pending (&input_pending, 1);
if (timers_run != old_timers_run && do_display)
- redisplay_preserve_echo_area ();
+ redisplay_preserve_echo_area (7);
}
\f
static EMACS_TIME timer_idleness_start_time;
in the current keymaps, or nil where it is not a prefix. */
Lisp_Object *maps;
- Lisp_Object def, tem, tail;
+ Lisp_Object def, tail;
Lisp_Object result;
{
/* No, so use major and minor mode keymaps and keymap property. */
int extra_maps = 2;
- Lisp_Object map = get_local_map (PT, current_buffer, keymap);
+ Lisp_Object map = get_local_map (PT, current_buffer, Qkeymap);
if (!NILP (map))
extra_maps = 3;
nmaps = current_minor_maps (NULL, &tmaps);
bcopy (tmaps, maps, nmaps * sizeof (maps[0]));
if (!NILP (map))
maps[nmaps++] = map;
- maps[nmaps++] = get_local_map (PT, current_buffer, local_map);
+ maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
}
maps[nmaps++] = current_global_map;
}
for (mapno = nmaps - 1; mapno >= 0; mapno--)
if (!NILP (maps[mapno]))
{
- def = get_keymap (access_keymap (maps[mapno], Qmenu_bar, 1, 0, 0),
- 0, 0);
+ def = get_keymap (access_keymap (maps[mapno], Qmenu_bar, 1, 0, 1),
+ 0, 1);
if (CONSP (def))
menu_bar_one_keymap (def);
}
{
/* No, so use major and minor mode keymaps and keymap property. */
int extra_maps = 2;
- Lisp_Object map = get_local_map (PT, current_buffer, keymap);
+ Lisp_Object map = get_local_map (PT, current_buffer, Qkeymap);
if (!NILP (map))
extra_maps = 3;
nmaps = current_minor_maps (NULL, &tmaps);
bcopy (tmaps, maps, nmaps * sizeof (maps[0]));
if (!NILP (map))
maps[nmaps++] = map;
- maps[nmaps++] = get_local_map (PT, current_buffer, local_map);
+ maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
}
/* Add global keymap at the end. */
{
Lisp_Object keymap;
- /* Why set the `noinherit' flag ? -sm */
- keymap = get_keymap (access_keymap (maps[i], Qtool_bar, 1, 1, 0), 0, 0);
+ keymap = get_keymap (access_keymap (maps[i], Qtool_bar, 1, 0, 1), 0, 1);
if (CONSP (keymap))
{
Lisp_Object tail;
if (INTERACTIVE)
{
if (!NILP (prompt))
- echo_prompt (XSTRING (prompt)->data);
+ echo_prompt (prompt);
else if (cursor_in_echo_area
&& (FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
&& NILP (Fzerop (Vecho_keystrokes)))
&junk);
#endif /* GOBBLE_FIRST_EVENT */
- orig_local_map = get_local_map (PT, current_buffer, local_map);
- orig_keymap = get_local_map (PT, current_buffer, keymap);
+ orig_local_map = get_local_map (PT, current_buffer, Qlocal_map);
+ orig_keymap = get_local_map (PT, current_buffer, Qkeymap);
/* We jump here when the key sequence has been thoroughly changed, and
we need to rescan it starting from the beginning. When we jump here,
interrupted_kboard->kbd_queue);
}
mock_input = 0;
- orig_local_map = get_local_map (PT, current_buffer, local_map);
- orig_keymap = get_local_map (PT, current_buffer, keymap);
+ orig_local_map = get_local_map (PT, current_buffer, Qlocal_map);
+ orig_keymap = get_local_map (PT, current_buffer, Qkeymap);
goto replay_sequence;
}
#endif
Fset_buffer (XWINDOW (selected_window)->buffer);
}
- orig_local_map = get_local_map (PT, current_buffer, local_map);
- orig_keymap = get_local_map (PT, current_buffer, keymap);
+ orig_local_map = get_local_map (PT, current_buffer, Qlocal_map);
+ orig_keymap = get_local_map (PT, current_buffer, Qkeymap);
goto replay_sequence;
}
keybuf[t++] = key;
mock_input = t;
Vquit_flag = Qnil;
- orig_local_map = get_local_map (PT, current_buffer, local_map);
- orig_keymap = get_local_map (PT, current_buffer, keymap);
+ orig_local_map = get_local_map (PT, current_buffer, Qlocal_map);
+ orig_keymap = get_local_map (PT, current_buffer, Qkeymap);
goto replay_sequence;
}
if (! FRAME_LIVE_P (XFRAME (selected_frame)))
Fkill_emacs (Qnil);
- set_buffer_internal (XBUFFER (XWINDOW
- (window)->buffer)
-);
+ set_buffer_internal (XBUFFER (XWINDOW (window)->buffer));
orig_local_map = get_local_map (PT, current_buffer,
- local_map);
- orig_keymap = get_local_map (PT, current_buffer, keymap);
+ Qlocal_map);
+ orig_keymap = get_local_map (PT, current_buffer, Qkeymap);
goto replay_sequence;
}
&& XINT (pos) >= BEG && XINT (pos) <= Z)
{
map_here = get_local_map (XINT (pos),
- current_buffer, local_map);
+ current_buffer, Qlocal_map);
if (!EQ (map_here, orig_local_map))
{
orig_local_map = map_here;
goto replay_sequence;
}
map_here = get_local_map (XINT (pos),
- current_buffer, keymap);
+ current_buffer, Qkeymap);
if (!EQ (map_here, orig_keymap))
{
orig_keymap = map_here;
}
return Qnil;
}
+
+
\f
DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_command,
1, 1, "P",
Lisp_Object binding;
char *newmessage;
int message_p = push_message ();
+ int count = BINDING_STACK_SIZE ();
+ record_unwind_protect (push_message_unwind, Qnil);
binding = Fkey_description (bindings);
newmessage
&& message_p)
restore_message ();
- pop_message ();
+ unbind_to (count, Qnil);
}
}
{
/* No, so use major and minor mode keymaps and keymap property. */
int extra_maps = 2;
- Lisp_Object map = get_local_map (PT, current_buffer, keymap);
+ Lisp_Object map = get_local_map (PT, current_buffer, Qkeymap);
if (!NILP (map))
extra_maps = 3;
nmaps = current_minor_maps (NULL, &tmaps);
bcopy (tmaps, maps, nmaps * sizeof (maps[0]));
if (!NILP (map))
maps[nmaps++] = map;
- maps[nmaps++] = get_local_map (PT, current_buffer, local_map);
+ maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
}
maps[nmaps++] = current_global_map;
if (old_timers_run != timers_run && do_display)
{
- redisplay_preserve_echo_area ();
+ redisplay_preserve_echo_area (8);
/* The following fixes a bug when using lazy-lock with
lazy-lock-defer-on-the-fly set to t, i.e. when fontifying
from an idle timer function. The symptom of the bug is that