char evalargs;
};
+#ifdef MULTI_PERDISPLAY
+PERDISPLAY *current_perdisplay;
+#else
PERDISPLAY the_only_perdisplay;
+#endif
/* Non-nil disable property on a command means
do not execute it; call disabled-command-hook's value instead. */
echo_prompt (str)
char *str;
{
- PERDISPLAY *perd = get_perdisplay (selected_frame);
int len = strlen (str);
if (len > ECHOBUFSIZE - 4)
len = ECHOBUFSIZE - 4;
- bcopy (str, perd->echobuf, len);
- perd->echoptr = perd->echobuf + len;
- *perd->echoptr = '\0';
+ bcopy (str, current_perdisplay->echobuf, len);
+ current_perdisplay->echoptr = current_perdisplay->echobuf + len;
+ *current_perdisplay->echoptr = '\0';
- perd->echo_after_prompt = len;
+ current_perdisplay->echo_after_prompt = len;
echo ();
}
Lisp_Object c;
{
extern char *push_key_description ();
- PERDISPLAY *perd = get_perdisplay (selected_frame);
- if (perd->immediate_echo)
+ if (current_perdisplay->immediate_echo)
{
- char *ptr = perd->echoptr;
+ char *ptr = current_perdisplay->echoptr;
- if (ptr != perd->echobuf)
+ if (ptr != current_perdisplay->echobuf)
*ptr++ = ' ';
/* If someone has passed us a composite event, use its head symbol. */
if (INTEGERP (c))
{
- if (ptr - perd->echobuf > ECHOBUFSIZE - 6)
+ if (ptr - current_perdisplay->echobuf > ECHOBUFSIZE - 6)
return;
ptr = push_key_description (XINT (c), ptr);
else if (SYMBOLP (c))
{
struct Lisp_String *name = XSYMBOL (c)->name;
- if (((ptr - perd->echobuf) + name->size + 4) > ECHOBUFSIZE)
+ if (((ptr - current_perdisplay->echobuf) + name->size + 4)
+ > ECHOBUFSIZE)
return;
bcopy (name->data, ptr, name->size);
ptr += name->size;
}
- if (perd->echoptr == perd->echobuf && EQ (c, Vhelp_char))
+ if (current_perdisplay->echoptr == current_perdisplay->echobuf
+ && EQ (c, Vhelp_char))
{
strcpy (ptr, " (Type ? for further options)");
ptr += strlen (ptr);
}
*ptr = 0;
- perd->echoptr = ptr;
+ current_perdisplay->echoptr = ptr;
echo ();
}
echo_dash ()
{
- PERDISPLAY *perd = get_perdisplay (selected_frame);
- if (!perd->immediate_echo && perd->echoptr == perd->echobuf)
+ if (!current_perdisplay->immediate_echo
+ && current_perdisplay->echoptr == current_perdisplay->echobuf)
return;
/* Do nothing if we just printed a prompt. */
- if (perd->echo_after_prompt == perd->echoptr - perd->echobuf)
+ if (current_perdisplay->echo_after_prompt
+ == current_perdisplay->echoptr - current_perdisplay->echobuf)
return;
/* Do nothing if not echoing at all. */
- if (perd->echoptr == 0)
+ if (current_perdisplay->echoptr == 0)
return;
/* Put a dash at the end of the buffer temporarily,
but make it go away when the next character is added. */
- perd->echoptr[0] = '-';
- perd->echoptr[1] = 0;
+ current_perdisplay->echoptr[0] = '-';
+ current_perdisplay->echoptr[1] = 0;
echo ();
}
echo ()
{
- PERDISPLAY *perd = get_perdisplay (selected_frame);
- if (!perd->immediate_echo)
+ if (!current_perdisplay->immediate_echo)
{
int i;
- perd->immediate_echo = 1;
+ current_perdisplay->immediate_echo = 1;
for (i = 0; i < this_command_key_count; i++)
{
}
echoing = 1;
- message2_nolog (perd->echobuf, strlen (perd->echobuf));
+ message1_nolog (current_perdisplay->echobuf);
echoing = 0;
if (waiting_for_input && !NILP (Vquit_flag))
cancel_echoing ()
{
- PERDISPLAY *perd = get_perdisplay (selected_frame);
- perd->immediate_echo = 0;
- perd->echoptr = perd->echobuf;
- perd->echo_after_prompt = -1;
+ current_perdisplay->immediate_echo = 0;
+ current_perdisplay->echoptr = current_perdisplay->echobuf;
+ current_perdisplay->echo_after_prompt = -1;
}
/* Return the length of the current echo string. */
static int
echo_length ()
{
- PERDISPLAY *perd = get_perdisplay (selected_frame);
- return perd->echoptr - perd->echobuf;
+ return current_perdisplay->echoptr - current_perdisplay->echobuf;
}
/* Truncate the current echo message to its first LEN chars.
echo_truncate (len)
int len;
{
- PERDISPLAY *perd = get_perdisplay (selected_frame);
- perd->echobuf[len] = '\0';
- perd->echoptr = perd->echobuf + len;
+ current_perdisplay->echobuf[len] = '\0';
+ current_perdisplay->echoptr = current_perdisplay->echobuf + len;
truncate_echo_area (len);
}
int count;
jmp_buf save_jump;
int key_already_recorded = 0;
- PERDISPLAY *perd = get_perdisplay (selected_frame);
Lisp_Object also_record;
also_record = Qnil;
}
/* Message turns off echoing unless more keystrokes turn it on again. */
- if (echo_area_glyphs && *echo_area_glyphs && echo_area_glyphs != perd->echobuf)
+ if (echo_area_glyphs && *echo_area_glyphs
+ && echo_area_glyphs != current_perdisplay->echobuf)
cancel_echoing ();
else
/* If already echoing, continue. */
/* If in middle of key sequence and minibuffer not active,
start echoing if enough time elapses. */
- if (minibuf_level == 0 && !perd->immediate_echo && this_command_key_count > 0
+ if (minibuf_level == 0 && !current_perdisplay->immediate_echo
+ && this_command_key_count > 0
&& ! noninteractive
&& echo_keystrokes > 0
&& (echo_area_glyphs == 0 || *echo_area_glyphs == 0))
find_active_event_queue ()
{
PERDISPLAY *perd;
- perd = &the_only_perdisplay;
- /* FOR_ALL_PERDISPLAYS (perd) */
+
+ for (perd = all_perdisplays; perd; perd = perd->next_perdisplay)
{
if (perd->kbd_fetch_ptr != perd->kbd_store_ptr)
return perd;
Also cancel any kbd macro being defined.")
()
{
- PERDISPLAY *perd = &the_only_perdisplay;
defining_kbd_macro = 0;
update_mode_lines++;
/* Without the cast, GCC complains that this assignment loses the
volatile qualifier of kbd_store_ptr. Is there anything wrong
with that? */
- perd->kbd_fetch_ptr = (struct input_event *) perd->kbd_store_ptr;
- Ffillarray (perd->kbd_buffer_frame_or_window, Qnil);
+ current_perdisplay->kbd_fetch_ptr
+ = (struct input_event *) current_perdisplay->kbd_store_ptr;
+ Ffillarray (current_perdisplay->kbd_buffer_frame_or_window, Qnil);
input_pending = 0;
return Qnil;
#ifdef BSD
#ifndef BSD4_1
register unsigned char *p;
- PERDISPLAY *perd = &the_only_perdisplay; /* We really want the primary display's perd */
+ PERDISPLAY *perd;
if (STRINGP (stuffstring))
{
stuff_char ('\n');
}
/* Anything we have read ahead, put back for the shell to read. */
+#ifndef MULTI_PERDISPLAY
+ perd = &the_only_perdisplay;
+#else
+ /* ?? What should this do when we have multiple keyboards?? */
+ perd = current_perdisplay;
+ if (!perd)
+ return;
+#endif
while (perd->kbd_fetch_ptr != perd->kbd_store_ptr)
{
if (perd->kbd_fetch_ptr == perd->kbd_buffer + KBD_BUFFER_SIZE)
}
\f
+/*
+ * Set up a perdisplay object with reasonable initial values.
+ */
+void
+init_perdisplay (perd)
+ PERDISPLAY *perd;
+{
+ perd->Vprefix_arg = Qnil;
+ perd->Vcurrent_prefix_arg = Qnil;
+ perd->kbd_buffer
+ = (struct input_event *)xmalloc (KBD_BUFFER_SIZE
+ * sizeof (struct input_event));
+ perd->kbd_fetch_ptr = perd->kbd_buffer;
+ perd->kbd_store_ptr = perd->kbd_buffer;
+ perd->kbd_buffer_frame_or_window
+ = Fmake_vector (make_number (KBD_BUFFER_SIZE), Qnil);
+}
+
+/*
+ * Destroy the contents of a perdisplay object, but not the object itself.
+ * We use this just before deleteing it, or if we're going to initialize
+ * it a second time.
+ */
+void
+wipe_perdisplay (perd)
+ PERDISPLAY *perd;
+{
+ xfree (perd->kbd_buffer);
+}
+
init_keyboard ()
{
/* This is correct before outermost invocation of the editor loop */
unread_command_char = -1;
total_keys = 0;
recent_keys_index = 0;
- the_only_perdisplay.kbd_buffer
- = (struct input_event *)xmalloc (KBD_BUFFER_SIZE
- * sizeof (struct input_event));
- the_only_perdisplay.kbd_fetch_ptr = the_only_perdisplay.kbd_buffer;
- the_only_perdisplay.kbd_store_ptr = the_only_perdisplay.kbd_buffer;
#ifdef HAVE_MOUSE
do_mouse_tracking = Qnil;
#endif
Vlast_event_frame = internal_last_event_frame;
#endif
- /* If we're running a dumped Emacs, we need to clear out
- kbd_buffer_frame_or_window, in case some events got into it
- before we dumped.
-
- If we're running an undumped Emacs, it hasn't been initialized by
- syms_of_keyboard yet. */
+#ifndef MULTI_PERDISPLAY
if (initialized)
- {
- PERDISPLAY *perd;
- perd = &the_only_perdisplay;
- /* FOR_ALL_PERDISPLAYS (perd) */
- {
- Ffillarray (perd->kbd_buffer_frame_or_window, Qnil);
- }
- }
+ wipe_perdisplay (&the_only_perdisplay);
+ init_perdisplay (&the_only_perdisplay);
+#endif
if (!noninteractive && !read_socket_hook && NILP (Vwindow_system))
{
Fset (Qextended_command_history, Qnil);
staticpro (&Qextended_command_history);
- the_only_perdisplay.kbd_buffer_frame_or_window
- = Fmake_vector (make_number (KBD_BUFFER_SIZE), Qnil);
- staticpro (&the_only_perdisplay.kbd_buffer_frame_or_window);
-
accent_key_syms = Qnil;
staticpro (&accent_key_syms);
This function is called with no arguments after each command\n\
whenever `deferred-action-list' is non-nil.");
Vdeferred_action_function = Qnil;
+
+ DEFVAR_DISPLAY ("prefix-arg", Vprefix_arg,
+ "The value of the prefix argument for the next editing command.\n\
+It may be a number, or the symbol `-' for just a minus sign as arg,\n\
+or a list whose car is a number for just one or more C-U's\n\
+or nil if no argument has been specified.\n\
+\n\
+You cannot examine this variable to find the argument for this command\n\
+since it has been set to nil by the time you can look.\n\
+Instead, you should use the variable `current-prefix-arg', although\n\
+normally commands can get this prefix argument with (interactive \"P\").");
+
+ DEFVAR_DISPLAY ("current-prefix-arg", Vcurrent_prefix_arg,
+ "The value of the prefix argument for this editing command.\n\
+It may be a number, or the symbol `-' for just a minus sign as arg,\n\
+or a list whose car is a number for just one or more C-U's\n\
+or nil if no argument has been specified.\n\
+This is what `(interactive \"P\")' returns.");
}
keys_of_keyboard ()