update_mode_lines = 1;
if (command_loop_level
- && current_buffer != XBUFFER (XWINDOW (selected_window)->buffer))
+ && current_buffer != XBUFFER (WVAR (XWINDOW (selected_window), buffer)))
buffer = Fcurrent_buffer ();
else
buffer = Qnil;
}
#endif
+/* The last boundary auto-added to buffer-undo-list. */
+Lisp_Object last_undo_boundary;
+
/* FIXME: This is wrong rather than test window-system, we should call
a new set-selection, which will then dispatch to x-set-selection, or
tty-set-selection, or w32-set-selection, ... */
Fkill_emacs (Qnil);
/* Make sure the current window's buffer is selected. */
- if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
- set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
+ if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer)
+ set_buffer_internal (XBUFFER (WVAR (XWINDOW (selected_window), buffer)));
/* Display any malloc warning that just came out. Use while because
displaying one warning can cause another. */
/* A filter may have run while we were reading the input. */
if (! FRAME_LIVE_P (XFRAME (selected_frame)))
Fkill_emacs (Qnil);
- if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
- set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
+ if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer)
+ set_buffer_internal (XBUFFER (WVAR (XWINDOW (selected_window), buffer)));
++num_input_keys;
{
struct buffer *b;
XWINDOW (selected_window)->force_start = 0;
- b = XBUFFER (XWINDOW (selected_window)->buffer);
+ b = XBUFFER (WVAR (XWINDOW (selected_window), buffer));
BUF_BEG_UNCHANGED (b) = BUF_END_UNCHANGED (b) = 0;
}
#endif
if (NILP (KVAR (current_kboard, Vprefix_arg))) /* FIXME: Why? --Stef */
- Fundo_boundary ();
+ {
+ Lisp_Object undo = BVAR (current_buffer, undo_list);
+ Fundo_boundary ();
+ last_undo_boundary
+ = (EQ (undo, BVAR (current_buffer, undo_list))
+ ? Qnil : BVAR (current_buffer, undo_list));
+ }
Fcommand_execute (Vthis_command, Qnil, Qnil, Qnil);
#ifdef HAVE_WINDOW_SYSTEM
|| EMACS_SECS (poll_timer->interval) != polling_period)
{
time_t period = max (1, min (polling_period, TYPE_MAXIMUM (time_t)));
- EMACS_TIME interval;
+ EMACS_TIME interval = make_emacs_time (period, 0);
if (poll_timer)
cancel_atimer (poll_timer);
- EMACS_SET_SECS_USECS (interval, period, 0);
poll_timer = start_atimer (ATIMER_CONTINUOUS, interval,
poll_for_input, NULL);
}
if (!NILP (help) && !STRINGP (help))
{
if (FUNCTIONP (help))
- {
- Lisp_Object args[4];
- args[0] = help;
- args[1] = window;
- args[2] = object;
- args[3] = pos;
- help = safe_call (4, args);
- }
+ help = safe_call (4, help, window, object, pos);
else
help = safe_eval (help);
&& ! CONSP (Vunread_command_events))
{
Fdo_auto_save (Qnil, Qnil);
-
- /* If we have auto-saved and there is still no input
- available, garbage collect if there has been enough
- consing going on to make it worthwhile. */
- if (!detect_input_pending_run_timers (0)
- && consing_since_gc > gc_cons_threshold / 2)
- Fgarbage_collect ();
-
redisplay ();
}
}
+
+ /* If there is still no input available, ask for GC. */
+ if (!detect_input_pending_run_timers (0))
+ maybe_gc ();
}
/* Notify the caller if an autosave hook, or a timer, sentinel or
{
KBOARD *kb IF_LINT (= NULL);
- if (end_time)
- {
- EMACS_TIME now;
- EMACS_GET_TIME (now);
- if (EMACS_TIME_GE (now, *end_time))
- goto exit;
- }
+ if (end_time && EMACS_TIME_LE (*end_time, current_emacs_time ()))
+ goto exit;
/* Actually read a character, waiting if necessary. */
save_getcjmp (save_jump);
#endif
if (end_time)
{
- EMACS_TIME duration;
- EMACS_GET_TIME (duration);
- if (EMACS_TIME_GE (duration, *end_time))
+ EMACS_TIME now = current_emacs_time ();
+ if (EMACS_TIME_LE (*end_time, now))
return Qnil; /* Finished waiting. */
else
{
- EMACS_SUB_TIME (duration, *end_time, duration);
+ EMACS_TIME duration = sub_emacs_time (*end_time, now);
wait_reading_process_output (min (EMACS_SECS (duration),
WAIT_READING_MAX),
EMACS_NSECS (duration),
if (EMACS_TIME_VALID_P (timer_idleness_start_time))
return;
- EMACS_GET_TIME (timer_idleness_start_time);
-
+ timer_idleness_start_time = current_emacs_time ();
timer_last_idleness_start_time = timer_idleness_start_time;
/* Mark all idle-time timers as once again candidates for running. */
static void
timer_stop_idle (void)
{
- EMACS_SET_INVALID_TIME (timer_idleness_start_time);
+ timer_idleness_start_time = invalid_emacs_time ();
}
/* Resume idle timer from last idle start time. */
Lisp_Object timers, idle_timers, chosen_timer;
struct gcpro gcpro1, gcpro2, gcpro3;
- EMACS_SET_INVALID_TIME (nexttime);
+ nexttime = invalid_emacs_time ();
/* Always consider the ordinary timers. */
timers = Vtimer_list;
if (CONSP (timers) || CONSP (idle_timers))
{
- EMACS_GET_TIME (now);
- if (EMACS_TIME_VALID_P (timer_idleness_start_time))
- EMACS_SUB_TIME (idleness_now, now, timer_idleness_start_time);
- else
- EMACS_SET_SECS_NSECS (idleness_now, 0, 0);
+ now = current_emacs_time ();
+ idleness_now = (EMACS_TIME_VALID_P (timer_idleness_start_time)
+ ? sub_emacs_time (now, timer_idleness_start_time)
+ : make_emacs_time (0, 0));
}
while (CONSP (timers) || CONSP (idle_timers))
Lisp_Object timer = Qnil, idle_timer = Qnil;
EMACS_TIME timer_time, idle_timer_time;
EMACS_TIME difference;
- EMACS_TIME timer_difference, idle_timer_difference;
+ EMACS_TIME timer_difference = invalid_emacs_time ();
+ EMACS_TIME idle_timer_difference = invalid_emacs_time ();
int ripe, timer_ripe = 0, idle_timer_ripe = 0;
- EMACS_SET_INVALID_TIME (timer_difference);
- EMACS_SET_INVALID_TIME (idle_timer_difference);
-
/* Set TIMER and TIMER_DIFFERENCE
based on the next ordinary timer.
TIMER_DIFFERENCE is the distance in time from NOW to when
}
timer_ripe = EMACS_TIME_LE (timer_time, now);
- if (timer_ripe)
- EMACS_SUB_TIME (timer_difference, now, timer_time);
- else
- EMACS_SUB_TIME (timer_difference, timer_time, now);
+ timer_difference = (timer_ripe
+ ? sub_emacs_time (now, timer_time)
+ : sub_emacs_time (timer_time, now));
}
/* Likewise for IDLE_TIMER and IDLE_TIMER_DIFFERENCE
}
idle_timer_ripe = EMACS_TIME_LE (idle_timer_time, idleness_now);
- if (idle_timer_ripe)
- EMACS_SUB_TIME (idle_timer_difference,
- idleness_now, idle_timer_time);
- else
- EMACS_SUB_TIME (idle_timer_difference,
- idle_timer_time, idleness_now);
+ idle_timer_difference =
+ (idle_timer_ripe
+ ? sub_emacs_time (idleness_now, idle_timer_time)
+ : sub_emacs_time (idle_timer_time, idleness_now));
}
/* Decide which timer is the next timer,
return 0 to indicate that. */
}
- EMACS_SET_SECS (nexttime, 0);
- EMACS_SET_USECS (nexttime, 0);
+ nexttime = make_emacs_time (0, 0);
}
else
/* When we encounter a timer that is still waiting,
(void)
{
if (EMACS_TIME_VALID_P (timer_idleness_start_time))
- {
- EMACS_TIME now, idleness_now;
-
- EMACS_GET_TIME (now);
- EMACS_SUB_TIME (idleness_now, now, timer_idleness_start_time);
-
- return make_lisp_time (idleness_now);
- }
+ return make_lisp_time (sub_emacs_time (current_emacs_time (),
+ timer_idleness_start_time));
return Qnil;
}
if (STRINGP (string))
string_info = Fcons (string, make_number (charpos));
textpos = (w == XWINDOW (selected_window)
- && current_buffer == XBUFFER (w->buffer))
- ? PT : XMARKER (w->pointm)->charpos;
+ && current_buffer == XBUFFER (WVAR (w, buffer)))
+ ? PT : XMARKER (WVAR (w, pointm))->charpos;
xret = wx;
yret = wy;
{
int i;
- switch (SWITCH_ENUM_CAST (event->kind))
+ switch (event->kind)
{
/* A simple keystroke. */
case ASCII_KEYSTROKE_EVENT:
int fuzz;
if (WINDOWP (event->frame_or_window))
- f = XFRAME (XWINDOW (event->frame_or_window)->frame);
+ f = XFRAME (WVAR (XWINDOW (event->frame_or_window), frame));
else if (FRAMEP (event->frame_or_window))
f = XFRAME (event->frame_or_window);
else
int is_double;
if (WINDOWP (event->frame_or_window))
- fr = XFRAME (XWINDOW (event->frame_or_window)->frame);
+ fr = XFRAME (WVAR (XWINDOW (event->frame_or_window), frame));
else if (FRAMEP (event->frame_or_window))
fr = XFRAME (event->frame_or_window);
else
#define MULTI_LETTER_MOD(BIT, NAME, LEN) \
if (i + LEN + 1 <= SBYTES (name) \
- && ! strncmp (SSDATA (name) + i, NAME, LEN)) \
+ && ! memcmp (SDATA (name) + i, NAME, LEN)) \
{ \
this_mod_end = i + LEN; \
this_mod = BIT; \
if (! (modifiers & (down_modifier | drag_modifier
| double_modifier | triple_modifier))
&& i + 7 == SBYTES (name)
- && strncmp (SSDATA (name) + i, "mouse-", 6) == 0
+ && memcmp (SDATA (name) + i, "mouse-", 6) == 0
&& ('0' <= SREF (name, i + 6) && SREF (name, i + 6) <= '9'))
modifiers |= click_modifier;
if (! (modifiers & (double_modifier | triple_modifier))
&& i + 6 < SBYTES (name)
- && strncmp (SSDATA (name) + i, "wheel-", 6) == 0)
+ && memcmp (SDATA (name) + i, "wheel-", 6) == 0)
modifiers |= click_modifier;
if (modifier_end)
#define MULTI_LETTER_MOD(BIT, NAME, LEN) \
if (LEN == SBYTES (name) \
- && ! strncmp (SSDATA (name), NAME, LEN)) \
+ && ! memcmp (SDATA (name), NAME, LEN)) \
return BIT;
case 'A':
#endif
if (input_available_clear_time)
- EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
+ *input_available_clear_time = make_emacs_time (0, 0);
#ifndef SYNC_INPUT
handle_async_input ();
/* Tell wait_reading_process_output that it needs to wake
up and look around. */
if (input_available_clear_time)
- EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
+ *input_available_clear_time = make_emacs_time (0, 0);
}
break;
}
if (!label)
return 0;
else if (strlen (label) > 3
- && strncmp (label, "--", 2) == 0
+ && memcmp (label, "--", 2) == 0
&& label[2] != '-')
{
int i;
/* If the command is an alias for another
(such as lmenu.el set it up), check if the
original command matches the cached command. */
- && !(SYMBOLP (def) && EQ (tem, XSYMBOL (def)->function))))
+ && !(SYMBOLP (def)
+ && EQ (tem, SVAR (XSYMBOL (def), function)))))
keys = Qnil;
}
if (SCHARS (new_lbl) <= tool_bar_max_label_size)
PROP (TOOL_BAR_ITEM_LABEL) = new_lbl;
else
- PROP (TOOL_BAR_ITEM_LABEL) = make_string ("", 0);
+ PROP (TOOL_BAR_ITEM_LABEL) = empty_unibyte_string;
xfree (buf);
}
next = access_keymap (map, key, 1, 0, 1);
- /* Handle symbol with autoload definition. */
- if (SYMBOLP (next) && !NILP (Ffboundp (next))
- && CONSP (XSYMBOL (next)->function)
- && EQ (XCAR (XSYMBOL (next)->function), Qautoload))
- do_autoload (XSYMBOL (next)->function, next);
-
/* Handle a symbol whose function definition is a keymap
or an array. */
if (SYMBOLP (next) && !NILP (Ffboundp (next))
- && (ARRAYP (XSYMBOL (next)->function)
- || KEYMAPP (XSYMBOL (next)->function)))
- next = XSYMBOL (next)->function;
+ && (ARRAYP (SVAR (XSYMBOL (next), function))
+ || KEYMAPP (SVAR (XSYMBOL (next), function))))
+ next = Fautoload_do_load (SVAR (XSYMBOL (next), function), next, Qnil);
/* If the keymap gives a function, not an
array, then call the function with one arg and use
{
if (! FRAME_LIVE_P (XFRAME (selected_frame)))
Fkill_emacs (Qnil);
- if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
- Fset_buffer (XWINDOW (selected_window)->buffer);
+ if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer)
+ Fset_buffer (WVAR (XWINDOW (selected_window), buffer));
}
orig_local_map = get_local_map (PT, current_buffer, Qlocal_map);
not the current buffer. If we're at the
beginning of a key sequence, switch buffers. */
if (WINDOWP (window)
- && BUFFERP (XWINDOW (window)->buffer)
- && XBUFFER (XWINDOW (window)->buffer) != current_buffer)
+ && BUFFERP (WVAR (XWINDOW (window), buffer))
+ && XBUFFER (WVAR (XWINDOW (window), buffer)) != current_buffer)
{
ASET (raw_keybuf, raw_keybuf_count, key);
raw_keybuf_count++;
if (! FRAME_LIVE_P (XFRAME (selected_frame)))
Fkill_emacs (Qnil);
- set_buffer_internal (XBUFFER (XWINDOW (window)->buffer));
+ set_buffer_internal (XBUFFER (WVAR (XWINDOW (window), buffer)));
orig_local_map = get_local_map (PT, current_buffer,
Qlocal_map);
orig_keymap = get_local_map (PT, current_buffer,
struct gcpro gcpro1, gcpro2;
GCPRO2 (cmd, prefixarg);
- do_autoload (final, cmd);
+ Fautoload_do_load (final, cmd, Qnil);
UNGCPRO;
}
else
? window_box_left_offset (w, TEXT_AREA)
: 0)));
XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XINT (y)));
- frame_or_window = w->frame;
+ frame_or_window = WVAR (w, frame);
}
CHECK_LIVE_FRAME (frame_or_window);
quit_char = Ctl ('g');
Vunread_command_events = Qnil;
unread_command_char = -1;
- EMACS_SET_INVALID_TIME (timer_idleness_start_time);
+ timer_idleness_start_time = invalid_emacs_time ();
total_keys = 0;
recent_keys_index = 0;
kbd_fetch_ptr = kbd_buffer;
initial_define_lispy_key (Vspecial_event_map, "config-changed-event",
"ignore");
+#if defined (WINDOWSNT)
+ initial_define_lispy_key (Vspecial_event_map, "language-change",
+ "ignore");
+#endif
}
/* Mark the pointers in the kboard objects.