If the value is non-nil and not a number, we wait 2 seconds. */
Lisp_Object Vsuggest_key_bindings;
+/* How long to display an echo-area message when the minibuffer is active.
+ If the value is not a number, such messages don't time out. */
+Lisp_Object Vminibuffer_message_timeout;
+
/* Character that causes a quit. Normally C-g.
If we are running on an ordinary terminal, this must be an ordinary
/* 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;
+
+ 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;
+ }
- current_kboard->echo_after_prompt = len;
+ 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. */
Vdeactivate_mark = Qnil;
/* If minibuffer on and echo area in use,
- wait 2 sec and redraw minibuffer. */
+ wait a short time and redraw minibuffer. */
if (minibuf_level
&& !NILP (echo_area_buffer[0])
- && EQ (minibuf_window, echo_area_window))
+ && EQ (minibuf_window, echo_area_window)
+ && NUMBERP (Vminibuffer_message_timeout))
{
/* Bind inhibit-quit to t so that C-g gets read in
rather than quitting back to the minibuffer. */
int count = specpdl_ptr - specpdl;
specbind (Qinhibit_quit, Qt);
- Fsit_for (make_number (2), Qnil, Qnil);
+ Fsit_for (Vminibuffer_message_timeout, Qnil, Qnil);
/* Clear the echo area. */
message2 (0, 0, 0);
safe_run_hooks (Qecho_area_clear_hook);
{
int count = specpdl_ptr - specpdl;
specbind (Qmessage_truncate_lines, Qt);
- message3_nolog (help, XSTRING (help)->size,
+ message3_nolog (help, STRING_BYTES (XSTRING (help)),
STRING_MULTIBYTE (help));
unbind_to (count, Qnil);
}
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;
+ /* Don't record `help-echo' in recent_keys unless it shows some 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. :-) */
fflush (dribble);
}
- store_kbd_macro_char (c);
+ if (!CONSP (c) || !EQ (Qhelp_echo, XCAR (c)))
+ store_kbd_macro_char (c);
num_nonmacro_input_events++;
}
if (NILP (obj))
{
- int idx;
-
obj = make_lispy_event (event);
#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)
if (part == 1 || part == 3)
{
- /* Mode line or top line. Look for a string under
+ /* Mode line or header line. Look for a string under
the mouse that may have a `local-map' property. */
Lisp_Object string;
int charpos;
return Qnil;
pixel_to_glyph_coords (f, XINT (event->x), XINT (event->y),
&column, &row, NULL, 1);
- window = window_from_coordinates (f, column, row, &part, 0);
+ window = window_from_coordinates (f, XINT (event->x),
+ XINT (event->y), &part, 0);
if (!WINDOWP (window))
{
Lisp_Object window;
Lisp_Object posn;
Lisp_Object files;
- int row, column;
/* The frame_or_window field should be a cons of the frame in
which the event occurred and a list of the filenames
have been deleted. */
if (! FRAME_LIVE_P (f))
return Qnil;
- pixel_to_glyph_coords (f, XINT (event->x), XINT (event->y),
- &column, &row, NULL, 1);
- window = window_from_coordinates (f, column, row, &part, 0);
+
+ window = window_from_coordinates (f, XINT (event->x),
+ XINT (event->y), &part, 0);
if (!WINDOWP (window))
{
if (! CONSP (object))
return 0;
+ if (EQ (XCAR (object), Qhelp_echo)
+ || EQ (XCAR (object), Qvertical_line)
+ || EQ (XCAR (object), Qmode_line)
+ || EQ (XCAR (object), Qheader_line))
+ return 0;
+
for (tail = object; CONSP (tail); tail = XCDR (tail))
{
Lisp_Object elt;
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;
prompt, ! NILP (dont_downcase_last),
! NILP (can_return_switch_frame), 0);
+#if 0 /* The following is fine for code reading a key sequence and
+ then proceeding with a lenghty compuation, but it's not good
+ for code reading keys in a loop, like an input method. */
#ifdef HAVE_X_WINDOWS
if (display_busy_cursor_p)
start_busy_cursor ();
+#endif
#endif
if (i == -1)
DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
Sread_key_sequence_vector, 1, 5, 0,
"Like `read-key-sequence' but always return a vector.")
- (prompt, continue_echo, dont_downcase_last, can_return_switch_frame,
- command_loop)
+ /* Don't break the following line for documentation's sake. */
+ (prompt, continue_echo, dont_downcase_last, can_return_switch_frame, command_loop)
Lisp_Object prompt, continue_echo, dont_downcase_last;
Lisp_Object can_return_switch_frame, command_loop;
{
}
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;
A value of nil means menu bindings should not be updated.\n\
Used during Emacs' startup.");
update_menu_bindings = 1;
+
+ DEFVAR_LISP ("minibuffer-message-timeout", &Vminibuffer_message_timeout,
+ "*How long to display an echo-area message when the minibuffer is active.\n\
+If the value is not a number, such messages don't time out.");
+ Vminibuffer_message_timeout = make_number (2);
}
void