/* Keyboard and mouse input; editor command loop.
- Copyright (C) 1985,86,87,88,89,93,94,95,96,97,99 Free Software Foundation, Inc.
+ Copyright (C) 1985,86,87,88,89,93,94,95,96,97,99, 2000
+ Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include "intervals.h"
#include "blockinput.h"
#include "puresize.h"
+#include "systime.h"
+#include "atimer.h"
#include <setjmp.h>
#include <errno.h>
static struct kboard *ok_to_echo_at_next_pause;
-/* The kboard currently echoing, or null for none. Set in echo_now to
- the kboard echoing. Reset to 0 in cancel_echoing. If non-null,
- and a current echo area message exists, we know that it comes from
- echoing. */
+/* The kboard last echoing, or null for none. Reset to 0 in
+ cancel_echoing. If non-null, and a current echo area message
+ exists, and echo_message_buffer is eq to the current message
+ buffer, we know that the message comes from echo_kboard. */
static struct kboard *echo_kboard;
+/* The buffer used for echoing. Set in echo_now, reset in
+ cancel_echoing. */
+
+static Lisp_Object echo_message_buffer;
+
/* Nonzero means disregard local maps for the menu bar. */
static int inhibit_local_menu_bar_menus;
key sequence that it reads. */
Lisp_Object read_key_sequence_cmd;
+/* Echo unfinished commands after this many seconds of pause. */
+Lisp_Object Vecho_keystrokes;
+
/* Form to evaluate (if non-nil) when Emacs is started. */
Lisp_Object Vtop_level;
#ifdef HAVE_WINDOW_SYSTEM
#define POLL_FOR_INPUT
#endif
+
+/* After a command is executed, if point is moved into a region that
+ has specific properties (e.g. composition, display), we adjust
+ point to the boundary of the region. But, if a command sets this
+ valiable to non-nil, we suppress this point adjustment. This
+ variable is set to nil before reading a command. */
+Lisp_Object Vdisable_point_adjustment;
+
+/* If non-nil, always disable point adjustment. */
+Lisp_Object Vglobal_disable_point_adjustment;
+
\f
/* Global variable declarations. */
static void restore_getcjmp ();
static Lisp_Object apply_modifiers P_ ((int, Lisp_Object));
-/* > 0 if we are to echo keystrokes. */
-static int echo_keystrokes;
-
/* Nonzero means don't try to suspend even if the operating system seems
to support it. */
static int cannot_suspend;
if (INTEGERP (c))
{
- if (ptr - current_kboard->echobuf > ECHOBUFSIZE - 6)
+ if (ptr - current_kboard->echobuf
+ > ECHOBUFSIZE - KEY_DESCRIPTION_SIZE)
return;
ptr = push_key_description (XINT (c), ptr);
}
echoing = 1;
- echo_kboard = current_kboard;
message2_nolog (current_kboard->echobuf, strlen (current_kboard->echobuf),
! NILP (current_buffer->enable_multibyte_characters));
echoing = 0;
+ /* Record in what buffer we echoed, and from which kboard. */
+ echo_message_buffer = echo_area_buffer[0];
+ echo_kboard = current_kboard;
+
if (waiting_for_input && !NILP (Vquit_flag))
quit_throw_to_read_char ();
}
current_kboard->immediate_echo = 0;
current_kboard->echoptr = current_kboard->echobuf;
current_kboard->echo_after_prompt = -1;
- ok_to_echo_at_next_pause = 0;
- echo_kboard = 0;
+ ok_to_echo_at_next_pause = NULL;
+ echo_kboard = NULL;
+ echo_message_buffer = Qnil;
}
/* Return the length of the current echo string. */
specbind (Qstandard_input, Qt);
}
+#ifdef HAVE_X_WINDOWS
+ /* The command loop has started a busy-cursor timer, so we have to
+ cancel it here, otherwise it will fire because the recursive edit
+ can take some time. */
+ if (display_busy_cursor_p)
+ cancel_busy_cursor ();
+#endif
+
val = command_loop ();
if (EQ (val, Qt))
Fsignal (Qquit, Qnil);
"Exit all recursive editing levels.")
()
{
+#ifdef HAVE_X_WINDOWS
+ if (display_busy_cursor_p)
+ cancel_busy_cursor ();
+#endif
Fthrow (Qtop_level, Qnil);
}
Lisp_Object Fcommand_execute ();
static int read_key_sequence ();
void safe_run_hooks ();
+static void adjust_point_for_property ();
Lisp_Object
command_loop_1 ()
int nonundocount;
Lisp_Object keybuf[30];
int i;
- int no_redisplay;
int no_direct;
int prev_modiff;
struct buffer *prev_buffer;
cancel_echoing ();
nonundocount = 0;
- no_redisplay = 0;
this_command_key_count = 0;
this_single_command_key_start = 0;
}
/* Do redisplay processing after this command except in special
- cases identified below that set no_redisplay to 1.
- (actually, there's currently no way to prevent the redisplay,
- and no_redisplay is ignored.
- Perhaps someday we will really implement it.) */
- no_redisplay = 0;
-
+ cases identified below. */
prev_buffer = current_buffer;
prev_modiff = MODIFF;
last_point_position = PT;
XSETBUFFER (last_point_position_buffer, prev_buffer);
+ /* By default, we adjust point to a boundary of a region that
+ has such a property that should be treated intangible
+ (e.g. composition, display). But, some commands will set
+ this variable differently. */
+ Vdisable_point_adjustment = Qnil;
+
/* Execute the command. */
Vthis_command = cmd;
&& !detect_input_pending ()
&& NILP (XWINDOW (selected_window)->column_number_displayed)
&& NILP (Vexecuting_macro))
- no_redisplay = direct_output_forward_char (1);
+ direct_output_forward_char (1);
goto directly_done;
}
else if (EQ (Vthis_command, Qbackward_char) && PT > BEGV)
&& !detect_input_pending ()
&& NILP (XWINDOW (selected_window)->column_number_displayed)
&& NILP (Vexecuting_macro))
- no_redisplay = direct_output_forward_char (-1);
+ direct_output_forward_char (-1);
goto directly_done;
}
else if (EQ (Vthis_command, Qself_insert_command)
installed which is the case most of the time
because FONT-LOCK installs one. */
if (!lose && !value)
- no_redisplay = direct_output_for_insert (c);
+ direct_output_for_insert (c);
goto directly_done;
}
}
#ifdef HAVE_X_WINDOWS
if (display_busy_cursor_p)
- {
- if (inhibit_busy_cursor != 2)
- inhibit_busy_cursor = 0;
- if (!inhibit_busy_cursor)
- Fx_show_busy_cursor ();
- }
+ start_busy_cursor ();
#endif
nonundocount = 0;
if (NILP (current_kboard->Vprefix_arg))
Fundo_boundary ();
Fcommand_execute (Vthis_command, Qnil, Qnil, Qnil);
+
+#ifdef HAVE_X_WINDOWS
+ if (display_busy_cursor_p)
+ cancel_busy_cursor ();
+#endif
}
directly_done: ;
current_kboard->Vlast_prefix_arg = Vcurrent_prefix_arg;
}
finalize:
+
+ if (current_buffer == prev_buffer
+ && last_point_position != PT
+ && NILP (Vdisable_point_adjustment)
+ && NILP (Vglobal_disable_point_adjustment))
+ adjust_point_for_property (last_point_position);
+
/* Install chars successfully executed in kbd macro. */
if (!NILP (current_kboard->defining_kbd_macro)
}
}
+extern Lisp_Object Qcomposition, Qdisplay;
+
+/* Adjust point to a boundary of a region that has such a property
+ that should be treated intangible. For the moment, we check
+ `composition' and `display' property. LAST_PT is the last position
+ of point. */
+
+static void
+adjust_point_for_property (last_pt)
+ int last_pt;
+{
+ int start, end;
+ Lisp_Object val;
+ int check_composition = 1, check_display = 1;
+
+ while (check_composition || check_display)
+ {
+ if (check_composition
+ && PT > BEGV && PT < ZV
+ && get_property_and_range (PT, Qcomposition, &val, &start, &end, Qnil)
+ && COMPOSITION_VALID_P (start, end, val)
+ && start < PT && end > PT
+ && (last_pt <= start || last_pt >= end))
+ {
+ if (PT < last_pt)
+ SET_PT (start);
+ else
+ SET_PT (end);
+ check_display = 1;
+ }
+ check_composition = 0;
+ if (check_display
+ && PT > BEGV && PT < ZV
+ && get_property_and_range (PT, Qdisplay, &val, &start, &end, Qnil)
+ && start < PT && end > PT
+ && (last_pt <= start || last_pt >= end))
+ {
+ if (PT < last_pt)
+ SET_PT (start);
+ else
+ SET_PT (end);
+ check_composition = 1;
+ }
+ check_display = 0;
+ }
+}
+
/* Subroutine for safe_run_hooks: run the hook HOOK. */
static Lisp_Object
unbind_to (count, Qnil);
}
+
\f
-/* Number of seconds between polling for input. */
+/* Number of seconds between polling for input. This is a Lisp
+ variable that can be bound. */
+
int polling_period;
/* Nonzero means polling for input is temporarily suppressed. */
+
int poll_suppress_count;
-/* Nonzero if polling_for_input is actually being used. */
-int polling_for_input;
+/* Asynchronous timer for polling. */
+
+struct atimer *poll_timer;
+
#ifdef POLL_FOR_INPUT
-/* Handle an alarm once each second and read pending input
- so as to handle a C-g if it comces in. */
+/* Poll for input, so what we catch a C-g if it comes in. This
+ function is called from x_make_frame_visible, see comment
+ there. */
-SIGTYPE
-input_poll_signal (signalnum) /* If we don't have an argument, */
- int signalnum; /* some compilers complain in signal calls. */
+void
+poll_for_input_1 ()
{
- /* This causes the call to start_polling at the end
- to do its job. It also arranges for a quit or error
- from within read_avail_input to resume polling. */
- poll_suppress_count++;
if (interrupt_input_blocked == 0
&& !waiting_for_input)
read_avail_input (0);
- /* Turn on the SIGALRM handler and request another alarm. */
- start_polling ();
}
-#endif
+/* Timer callback function for poll_timer. TIMER is equal to
+ poll_timer. */
+
+void
+poll_for_input (timer)
+ struct atimer *timer;
+{
+ if (poll_suppress_count == 0)
+ poll_for_input_1 ();
+}
+
+#endif /* POLL_FOR_INPUT */
/* Begin signals to poll for input, if they are appropriate.
This function is called unconditionally from various places. */
#ifdef POLL_FOR_INPUT
if (read_socket_hook && !interrupt_input)
{
- poll_suppress_count--;
- if (poll_suppress_count == 0)
+ /* Turn alarm handling on unconditionally. It might have
+ been turned off in process.c. */
+ turn_on_atimers (1);
+
+ /* If poll timer doesn't exist, are we need one with
+ a different interval, start a new one. */
+ if (poll_timer == NULL
+ || EMACS_SECS (poll_timer->interval) != polling_period)
{
- signal (SIGALRM, input_poll_signal);
- polling_for_input = 1;
- alarm (polling_period);
+ EMACS_TIME interval;
+
+ if (poll_timer)
+ cancel_atimer (poll_timer);
+
+ EMACS_SET_SECS_USECS (interval, polling_period, 0);
+ poll_timer = start_atimer (ATIMER_CONTINUOUS, interval,
+ poll_for_input, NULL);
}
+
+ /* Let the timer's callback function poll for input
+ if this becomes zero. */
+ --poll_suppress_count;
}
#endif
}
{
#ifdef POLL_FOR_INPUT
if (read_socket_hook && !interrupt_input)
- {
- if (poll_suppress_count == 0)
- {
- polling_for_input = 0;
- alarm (0);
- }
- poll_suppress_count++;
- }
+ ++poll_suppress_count;
#endif
}
if (n > new)
new = n;
+ stop_other_atimers (poll_timer);
stop_polling ();
specbind (Qpolling_period, make_number (new));
/* Start a new alarm with the new period. */
}
}
- /* Message turns off echoing unless more keystrokes turn it on again. */
- if (/* There is a current message. */
+ /* Message turns off echoing unless more keystrokes turn it on again.
+
+ The code in 20.x for the condition was
+
+ 1. echo_area_glyphs && *echo_area_glyphs
+ 2. && echo_area_glyphs != current_kboard->echobuf
+ 3. && ok_to_echo_at_next_pause != echo_area_glyphs
+
+ (1) means there's a current message displayed
+
+ (2) means it's not the message from echoing from the current
+ kboard.
+
+ (3) There's only one place in 20.x where ok_to_echo_at_next_pause
+ is set to a non-null value. This is done in read_char and it is
+ set to echo_area_glyphs after a call to echo_char. That means
+ ok_to_echo_at_next_pause is either null or
+ current_kboard->echobuf with the appropriate current_kboard at
+ that time.
+
+ So, condition (3) means in clear text ok_to_echo_at_next_pause
+ must be either null, or the current message isn't from echoing at
+ all, or it's from echoing from a different kboard than the
+ current one. */
+
+ if (/* There currently something in the echo area */
!NILP (echo_area_buffer[0])
- /* And we're not echoing from this kboard. */
- && echo_kboard != current_kboard
- /* And it's either not ok to echo (ok_to_echo == NULL), or the
- last char echoed was from a different kboard. */
- && ok_to_echo_at_next_pause != echo_kboard)
+ && (/* And it's either not from echoing. */
+ !EQ (echo_area_buffer[0], echo_message_buffer)
+ /* Or it's an echo from a different kboard. */
+ || echo_kboard != current_kboard
+ /* Or we explicitly allow overwriting whatever there is. */
+ || ok_to_echo_at_next_pause == NULL))
cancel_echoing ();
else
- /* If already echoing, continue. */
echo_dash ();
-
+
/* Try reading a character via menu prompting in the minibuf.
Try this before the sit-for, because the sit-for
would do the wrong thing if we are supposed to do
&& !current_kboard->immediate_echo
&& this_command_key_count > 0
&& ! noninteractive
- && echo_keystrokes > 0
+ && (FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
+ && NILP (Fzerop (Vecho_keystrokes))
&& (/* No message. */
NILP (echo_area_buffer[0])
/* Or empty message. */
echo_now ();
else
{
+ int sec, usec;
+ double duration = extract_float (Vecho_keystrokes);
+ sec = (int) duration;
+ usec = (duration - sec) * 1000000;
save_getcjmp (save_jump);
restore_getcjmp (local_getcjmp);
- tem0 = sit_for (echo_keystrokes, 0, 1, 1, 0);
+ tem0 = sit_for (sec, usec, 1, 1, 0);
restore_getcjmp (save_jump);
if (EQ (tem0, Qt)
&& ! CONSP (Vunread_command_events))
before_command_echo_length = echo_length ();
/* Don't echo mouse motion events. */
- if (echo_keystrokes
+ if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
+ && NILP (Fzerop (Vecho_keystrokes))
&& ! (EVENT_HAS_PARAMETERS (c)
&& EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qmouse_movement)))
{
before_command_echo_length = echo_length ();
/* Don't echo mouse motion events. */
- if (echo_keystrokes)
+ if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
+ && NILP (Fzerop (Vecho_keystrokes)))
{
echo_char (c);
}
vector = XVECTOR (chosen_timer)->contents;
- /* If timer is rupe, run it if it hasn't been run. */
+ /* If timer is ripe, run it if it hasn't been run. */
if (EMACS_TIME_NEG_P (difference)
|| (EMACS_SECS (difference) == 0
&& EMACS_USECS (difference) == 0))
{
int was_locked = single_kboard;
int count = specpdl_ptr - specpdl;
-#ifdef HAVE_WINDOW_SYSTEM
- int old_inhibit_busy_cursor = inhibit_busy_cursor;
-#endif
/* Mark the timer as triggered to prevent problems if the lisp
code fails to reschedule it right. */
specbind (Qinhibit_quit, Qt);
-#ifdef HAVE_WINDOW_SYSTEM
- inhibit_busy_cursor = 2;
-#endif
-
call1 (Qtimer_event_handler, chosen_timer);
timers_run++;
-#ifdef HAVE_WINDOW_SYSTEM
- inhibit_busy_cursor = old_inhibit_busy_cursor;
-#endif
-
unbind_to (count, Qnil);
/* Resume allowing input from any kboard, if that was true before. */
#endif /* not HAVE_NTGUI */
-static char *lispy_mouse_names[] =
-{
- "mouse-1", "mouse-2", "mouse-3", "mouse-4", "mouse-5"
-};
+Lisp_Object Vlispy_mouse_stem;
#ifdef WINDOWSNT
/* mouse-wheel events are generated by the wheel on devices such as
/* Scroll bar parts. */
Lisp_Object Qabove_handle, Qhandle, Qbelow_handle;
Lisp_Object Qup, Qdown, Qbottom, Qend_scroll;
-Lisp_Object Qtop;
+Lisp_Object Qtop, Qratio;
/* An array of scroll bar parts, indexed by an enum scroll_bar_part value. */
Lisp_Object *scroll_bar_parts[] = {
&Qabove_handle, &Qhandle, &Qbelow_handle,
- &Qup, &Qdown, &Qtop, &Qbottom, &Qend_scroll
+ &Qup, &Qdown, &Qtop, &Qbottom, &Qend_scroll, &Qratio
};
/* User signal events. */
Lisp_Object *start_pos_ptr;
Lisp_Object start_pos;
- if (button < 0 || button >= NUM_MOUSE_BUTTONS)
- abort ();
-
/* Build the position as appropriate for this mouse click. */
if (event->kind == mouse_click)
{
}
#endif /* not USE_TOOLKIT_SCROLL_BARS */
+ if (button >= XVECTOR (button_down_location)->size)
+ {
+ button_down_location = larger_vector (button_down_location,
+ button + 1, Qnil);
+ mouse_syms = larger_vector (mouse_syms, button + 1, Qnil);
+ }
+
start_pos_ptr = &XVECTOR (button_down_location)->contents[button];
start_pos = *start_pos_ptr;
head = modify_event_symbol (button,
event->modifiers,
- Qmouse_click, Qnil,
- lispy_mouse_names, &mouse_syms,
- (sizeof (lispy_mouse_names)
- / sizeof (lispy_mouse_names[0])));
+ Qmouse_click, Vlispy_mouse_stem,
+ NULL,
+ &mouse_syms,
+ XVECTOR (mouse_syms)->size);
if (event->modifiers & drag_modifier)
return Fcons (head,
Fcons (start_pos,
/* Get the symbol we should use for the mouse click. */
head = modify_event_symbol (event->code,
event->modifiers,
- Qmouse_click, Qnil,
- lispy_mouse_names, &mouse_syms,
- (sizeof (lispy_mouse_names)
- / sizeof (lispy_mouse_names[0])));
+ Qmouse_click,
+ Vlispy_mouse_stem,
+ NULL, &mouse_syms,
+ XVECTOR (mouse_syms)->size);
return Fcons (head, Fcons (position, Qnil));
}
Lisp_Object *start_pos_ptr;
Lisp_Object start_pos;
- if (button < 0 || button >= NUM_MOUSE_BUTTONS)
- abort ();
-
{
Lisp_Object window;
Lisp_Object portion_whole;
head = modify_event_symbol (button,
event->modifiers,
- Qmouse_click, Qnil,
- lispy_mouse_names, &mouse_syms,
- (sizeof (lispy_mouse_names)
- / sizeof (lispy_mouse_names[0])));
+ Qmouse_click,
+ Vlispy_mouse_stem,
+ NULL, &mouse_syms,
+ XVECTOR (mouse_syms)->size);
return Fcons (head,
Fcons (position,
Qnil));
else
XSETINT (posn,
buffer_posn_from_coords (XWINDOW (window),
- column, row));
+ &column, &row));
}
{
is the name of the i'th symbol. TABLE_SIZE is the number of elements
in the table.
- Alternatively, NAME_ALIST is an alist mapping codes into symbol names.
- NAME_ALIST is used if it is non-nil; otherwise NAME_TABLE is used.
+ Alternatively, NAME_ALIST_OR_STEM is either an alist mapping codes
+ into symbol names, or a string specifying a name stem used to
+ contruct a symbol name or the form `STEM-N', where N is the decimal
+ representation of SYMBOL_NUM. NAME_ALIST_OR_STEM is used if it is
+ non-nil; otherwise NAME_TABLE is used.
SYMBOL_TABLE should be a pointer to a Lisp_Object whose value will
persist between calls to modify_event_symbol that it can use to
in the symbol's name. */
static Lisp_Object
-modify_event_symbol (symbol_num, modifiers, symbol_kind, name_alist,
+modify_event_symbol (symbol_num, modifiers, symbol_kind, name_alist_or_stem,
name_table, symbol_table, table_size)
int symbol_num;
unsigned modifiers;
Lisp_Object symbol_kind;
- Lisp_Object name_alist;
+ Lisp_Object name_alist_or_stem;
char **name_table;
Lisp_Object *symbol_table;
unsigned int table_size;
if (NILP (value))
{
/* No; let's create it. */
- if (!NILP (name_alist))
- value = Fcdr_safe (Fassq (symbol_int, name_alist));
+ if (CONSP (name_alist_or_stem))
+ value = Fcdr_safe (Fassq (symbol_int, name_alist_or_stem));
+ else if (STRINGP (name_alist_or_stem))
+ {
+ int len = STRING_BYTES (XSTRING (name_alist_or_stem));
+ char *buf = (char *) alloca (len + 50);
+ sprintf (buf, "%s-%d", XSTRING (name_alist_or_stem)->data,
+ XINT (symbol_int) + 1);
+ value = intern (buf);
+ }
else if (name_table != 0 && name_table[symbol_num])
value = intern (name_table[symbol_num]);
{
if (!NILP (prompt))
echo_prompt (XSTRING (prompt)->data);
- else if (cursor_in_echo_area && echo_keystrokes)
+ else if (cursor_in_echo_area
+ && (FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
+ && NILP (Fzerop (Vecho_keystrokes)))
/* This doesn't put in a dash if the echo buffer is empty, so
you don't always see a dash hanging out in the minibuffer. */
echo_dash ();
{
key = keybuf[t];
add_command_key (key);
- if (echo_keystrokes)
+ if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
+ && NILP (Fzerop (Vecho_keystrokes)))
echo_char (key);
}
pos = XCDR (string);
string = XCAR (string);
- if (pos >= 0
- && pos < XSTRING (string)->size
+ if (XINT (pos) >= 0
+ && XINT (pos) < XSTRING (string)->size
&& (map = Fget_text_property (pos, Qlocal_map,
string),
!NILP (map)))
Better ideas? */
for (; t < mock_input; t++)
{
- if (echo_keystrokes)
+ if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
+ && NILP (Fzerop (Vecho_keystrokes)))
echo_char (keybuf[t]);
add_command_key (keybuf[t]);
}
this_single_command_key_start = 0;
}
+#ifdef HAVE_X_WINDOWS
+ if (display_busy_cursor_p)
+ cancel_busy_cursor ();
+#endif
+
i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])),
prompt, ! NILP (dont_downcase_last),
! NILP (can_return_switch_frame), 0);
+#ifdef HAVE_X_WINDOWS
+ if (display_busy_cursor_p)
+ start_busy_cursor ();
+#endif
+
if (i == -1)
{
Vquit_flag = Qt;
this_single_command_key_start = 0;
}
+#ifdef HAVE_X_WINDOWS
+ if (display_busy_cursor_p)
+ cancel_busy_cursor ();
+#endif
+
i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])),
prompt, ! NILP (dont_downcase_last),
! NILP (can_return_switch_frame), 0);
+#ifdef HAVE_X_WINDOWS
+ if (display_busy_cursor_p)
+ start_busy_cursor ();
+#endif
+
if (i == -1)
{
Vquit_flag = Qt;
DEFUN ("clear-this-command-keys", Fclear_this_command_keys,
Sclear_this_command_keys, 0, 0, 0,
- "Clear out the vector that `this-command-keys' returns.")
+ "Clear out the vector that `this-command-keys' returns.\n\
+Clear vector containing last 100 events.")
()
{
+ int i;
+
this_command_key_count = 0;
+
+ for (i = 0; i < XVECTOR (recent_keys)->size; ++i)
+ XVECTOR (recent_keys)->contents[i] = Qnil;
+ total_keys = 0;
+ recent_keys_index = 0;
return Qnil;
}
void
syms_of_keyboard ()
{
+ Vlispy_mouse_stem = build_string ("mouse");
+ staticpro (&Vlispy_mouse_stem);
+
/* Tool-bars. */
QCimage = intern (":image");
staticpro (&QCimage);
staticpro (&Qbottom);
Qend_scroll = intern ("end-scroll");
staticpro (&Qend_scroll);
+ Qratio = intern ("ratio");
+ staticpro (&Qratio);
Qevent_kind = intern ("event-kind");
staticpro (&Qevent_kind);
}
}
- button_down_location = Fmake_vector (make_number (NUM_MOUSE_BUTTONS), Qnil);
+ button_down_location = Fmake_vector (make_number (1), Qnil);
staticpro (&button_down_location);
+ mouse_syms = Fmake_vector (make_number (1), Qnil);
+ staticpro (&mouse_syms);
{
int i;
func_key_syms = Qnil;
staticpro (&func_key_syms);
- mouse_syms = Qnil;
- staticpro (&mouse_syms);
-
#ifdef WINDOWSNT
mouse_wheel_syms = Qnil;
staticpro (&mouse_wheel_syms);
Emacs also does a garbage collection if that seems to be warranted.");
XSETFASTINT (Vauto_save_timeout, 30);
- DEFVAR_INT ("echo-keystrokes", &echo_keystrokes,
- "*Nonzero means echo unfinished commands after this many seconds of pause.");
- echo_keystrokes = 1;
+ DEFVAR_LISP ("echo-keystrokes", &Vecho_keystrokes,
+ "*Nonzero means echo unfinished commands after this many seconds of pause.\n\
+The value may be integer or floating point.");
+ Vecho_keystrokes = make_number (1);
DEFVAR_INT ("polling-period", &polling_period,
"*Interval between polling for input during Lisp execution.\n\
"If non-nil, the function that implements the display of help.\n\
It's called with one argument, the help string to display.");
Vshow_help_function = Qnil;
+
+ DEFVAR_LISP ("disable-point-adjustment", &Vdisable_point_adjustment,
+ "If non-nil, suppress point adjustment after executing a command.\n\
+\n\
+After a command is executed, if point is moved into a region that has\n\
+special properties (e.g. composition, display), we adjust point to\n\
+the boundary of the region. But, several special commands sets this\n\
+variable to non-nil, then we suppress the point adjustment.\n\
+\n\
+This variable is set to nil before reading a command, and is checked\n\
+just after executing the command");
+ Vdisable_point_adjustment = Qnil;
+
+ DEFVAR_LISP ("global-disable-point-adjustment",
+ &Vglobal_disable_point_adjustment,
+ "*If non-nil, always suppress point adjustment.\n\
+\n\
+The default value is nil, in which case, point adjustment are\n\
+suppressed only after special commands that set\n\
+`disable-point-adjustment' (which see) to non-nil.");
+ Vglobal_disable_point_adjustment = Qnil;
}
void