/* Keyboard and mouse input; editor command loop.
- Copyright (C) 1985,86,87,88,89,93,94,95,96,97 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.
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* Allow config.h to undefine symbols found here. */
-#include <signal.h>
-
#include <config.h>
+#include <signal.h>
#include <stdio.h>
#include "termchar.h"
#include "termopts.h"
#include "intervals.h"
#include "blockinput.h"
#include "puresize.h"
+#include "systime.h"
+#include "atimer.h"
#include <setjmp.h>
#include <errno.h>
#include "syssignal.h"
#include "systty.h"
+#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
/* This is to get the definitions of the XK_ symbols. */
#ifdef HAVE_X_WINDOWS
#include "xterm.h"
#ifdef HAVE_WINDOW_SYSTEM
/* Make all keyboard buffers much bigger when using X windows. */
+#ifdef macintosh
+/* But not too big (local data > 32K error) if on macintosh */
+#define KBD_BUFFER_SIZE 512
+#else
#define KBD_BUFFER_SIZE 4096
+#endif
#else /* No X-windows, character input */
#define KBD_BUFFER_SIZE 256
#endif /* No X-windows */
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);
()
{
int count = specpdl_ptr - specpdl;
- Lisp_Object val;
command_loop_level++;
update_mode_lines = 1;
{
Lisp_Object stream;
int kill_emacs_p = 0;
+ struct frame *sf = SELECTED_FRAME ();
Vquit_flag = Qnil;
Vinhibit_quit = Qt;
/* If the window system or terminal frame hasn't been initialized
yet, or we're not interactive, it's best to dump this message out
to stderr and exit. */
- if (!selected_frame->glyphs_initialized_p
+ if (!sf->glyphs_initialized_p
/* This is the case of the frame dumped with Emacs, when we're
running under a window system. */
|| (!NILP (Vwindow_system)
&& !inhibit_window_system
- && FRAME_TERMCAP_P (selected_frame))
+ && FRAME_TERMCAP_P (sf))
|| noninteractive)
{
stream = Qexternal_debugging_output;
Lisp_Object Fcommand_execute ();
static int read_key_sequence ();
void safe_run_hooks ();
+static void adjust_point_for_property ();
Lisp_Object
command_loop_1 ()
{
- Lisp_Object cmd, tem;
- int lose, lose2;
+ Lisp_Object cmd;
+ int lose;
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;
if (!NILP (Vpost_command_hook) && !NILP (Vrun_hooks))
safe_run_hooks (Qpost_command_hook);
+ /* If displaying a message, resize the echo area window to fit
+ that message's size exactly. */
+ if (!NILP (echo_area_buffer[0]))
+ resize_echo_area_axactly ();
+
if (!NILP (Vdeferred_action_list))
call0 (Vdeferred_action_function);
while (1)
{
- if (! FRAME_LIVE_P (selected_frame))
+ if (! FRAME_LIVE_P (XFRAME (selected_frame)))
Fkill_emacs (Qnil);
/* Make sure the current window's buffer is selected. */
code swallows a switch-frame event, we'll fix things up here.
Is this a good idea? */
if (FRAMEP (internal_last_event_frame)
- && XFRAME (internal_last_event_frame) != selected_frame)
+ && !EQ (internal_last_event_frame, selected_frame))
Fselect_frame (internal_last_event_frame, Qnil);
#endif
/* If it has changed current-menubar from previous value,
Qnil, 0, 1, 1);
/* A filter may have run while we were reading the input. */
- if (! FRAME_LIVE_P (selected_frame))
+ 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));
}
/* 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;
if (!NILP (Vpost_command_hook) && !NILP (Vrun_hooks))
safe_run_hooks (Qpost_command_hook);
+ /* If displaying a message, resize the echo area window to fit
+ that message's size exactly. */
+ if (!NILP (echo_area_buffer[0]))
+ resize_echo_area_axactly ();
+
if (!NILP (Vdeferred_action_list))
safe_run_hooks (Qdeferred_action_function);
}
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
safe_run_hooks (hook)
Lisp_Object hook;
{
- Lisp_Object value;
int count = specpdl_ptr - specpdl;
specbind (Qinhibit_quit, hook);
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. */
reread = 0;
if (CONSP (Vunread_post_input_method_events))
{
- c = XCONS (Vunread_post_input_method_events)->car;
+ c = XCAR (Vunread_post_input_method_events);
Vunread_post_input_method_events
- = XCONS (Vunread_post_input_method_events)->cdr;
+ = XCDR (Vunread_post_input_method_events);
/* Undo what read_char_x_menu_prompt did when it unread
additional keys returned by Fx_popup_menu. */
if (CONSP (c)
- && (SYMBOLP (XCONS (c)->car) || INTEGERP (XCONS (c)->car))
- && NILP (XCONS (c)->cdr))
- c = XCONS (c)->car;
+ && (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c)))
+ && NILP (XCDR (c)))
+ c = XCAR (c);
reread = 1;
goto reread_first;
if (CONSP (Vunread_command_events))
{
- c = XCONS (Vunread_command_events)->car;
- Vunread_command_events = XCONS (Vunread_command_events)->cdr;
+ c = XCAR (Vunread_command_events);
+ Vunread_command_events = XCDR (Vunread_command_events);
/* Undo what read_char_x_menu_prompt did when it unread
additional keys returned by Fx_popup_menu. */
if (CONSP (c)
- && (SYMBOLP (XCONS (c)->car) || INTEGERP (XCONS (c)->car))
- && NILP (XCONS (c)->cdr))
- c = XCONS (c)->car;
+ && (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c)))
+ && NILP (XCDR (c)))
+ c = XCAR (c);
reread = 1;
goto reread_for_input_method;
if (CONSP (Vunread_input_method_events))
{
- c = XCONS (Vunread_input_method_events)->car;
- Vunread_input_method_events = XCONS (Vunread_input_method_events)->cdr;
+ c = XCAR (Vunread_input_method_events);
+ Vunread_input_method_events = XCDR (Vunread_input_method_events);
/* Undo what read_char_x_menu_prompt did when it unread
additional keys returned by Fx_popup_menu. */
if (CONSP (c)
- && (SYMBOLP (XCONS (c)->car) || INTEGERP (XCONS (c)->car))
- && NILP (XCONS (c)->cdr))
- c = XCONS (c)->car;
+ && (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c)))
+ && NILP (XCDR (c)))
+ c = XCAR (c);
reread = 1;
goto reread_for_input_method;
}
if (_setjmp (local_getcjmp))
{
XSETINT (c, quit_char);
- XSETFRAME (internal_last_event_frame, selected_frame);
+ internal_last_event_frame = selected_frame;
Vlast_event_frame = internal_last_event_frame;
/* If we report the quit char as an event,
don't do so more than once. */
#ifdef MULTI_KBOARD
{
- KBOARD *kb = FRAME_KBOARD (selected_frame);
+ KBOARD *kb = FRAME_KBOARD (XFRAME (selected_frame));
if (kb != current_kboard)
{
Lisp_Object *tailp = &kb->kbd_queue;
if (single_kboard)
abort ();
while (CONSP (*tailp))
- tailp = &XCONS (*tailp)->cdr;
+ tailp = &XCDR (*tailp);
if (!NILP (*tailp))
abort ();
*tailp = Fcons (c, Qnil);
&& !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))
if (nmaps > 0 && INTERACTIVE
&& !NILP (prev_event)
&& EVENT_HAS_PARAMETERS (prev_event)
- && !EQ (XCONS (prev_event)->car, Qmenu_bar)
- && !EQ (XCONS (prev_event)->car, Qtoolbar)
+ && !EQ (XCAR (prev_event), Qmenu_bar)
+ && !EQ (XCAR (prev_event), Qtool_bar)
/* Don't bring up a menu if we already have another event. */
&& NILP (Vunread_command_events)
&& unread_command_char < 0)
or sentinel or filter. */
if (CONSP (Vunread_command_events))
{
- c = XCONS (Vunread_command_events)->car;
- Vunread_command_events = XCONS (Vunread_command_events)->cdr;
+ c = XCAR (Vunread_command_events);
+ Vunread_command_events = XCDR (Vunread_command_events);
}
/* Read something from current KBOARD's side queue, if possible. */
{
if (!CONSP (current_kboard->kbd_queue))
abort ();
- c = XCONS (current_kboard->kbd_queue)->car;
+ c = XCAR (current_kboard->kbd_queue);
current_kboard->kbd_queue
- = XCONS (current_kboard->kbd_queue)->cdr;
+ = XCDR (current_kboard->kbd_queue);
if (NILP (current_kboard->kbd_queue))
current_kboard->kbd_queue_has_data = 0;
input_pending = readable_events (0);
if (EVENT_HAS_PARAMETERS (c)
&& EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qswitch_frame))
- internal_last_event_frame = XCONS (XCONS (c)->cdr)->car;
+ internal_last_event_frame = XCAR (XCDR (c));
Vlast_event_frame = internal_last_event_frame;
}
}
{
Lisp_Object *tailp = &kb->kbd_queue;
while (CONSP (*tailp))
- tailp = &XCONS (*tailp)->cdr;
+ tailp = &XCDR (*tailp);
if (!NILP (*tailp))
abort ();
*tailp = Fcons (c, Qnil);
return just menu-bar for now. Modify the mouse click event
so we won't do this twice, then queue it up. */
if (EVENT_HAS_PARAMETERS (c)
- && CONSP (XCONS (c)->cdr)
+ && CONSP (XCDR (c))
&& CONSP (EVENT_START (c))
- && CONSP (XCONS (EVENT_START (c))->cdr))
+ && CONSP (XCDR (EVENT_START (c))))
{
Lisp_Object posn;
posn = POSN_BUFFER_POSN (EVENT_START (c));
/* Handle menu-bar events:
insert the dummy prefix event `menu-bar'. */
- if (EQ (posn, Qmenu_bar) || EQ (posn, Qtoolbar))
+ if (EQ (posn, Qmenu_bar) || EQ (posn, Qtool_bar))
{
/* Change menu-bar to (menu-bar) as the event "position". */
POSN_BUFFER_POSN (EVENT_START (c)) = Fcons (posn, Qnil);
goto retry;
}
/* It returned one event or more. */
- c = XCONS (tem)->car;
+ c = XCAR (tem);
Vunread_post_input_method_events
- = nconc2 (XCONS (tem)->cdr, Vunread_post_input_method_events);
+ = nconc2 (XCDR (tem), Vunread_post_input_method_events);
}
reread_first:
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);
if (EQ (c, Vhelp_char))
return 1;
- for (tail = Vhelp_event_list; CONSP (tail); tail = XCONS (tail)->cdr)
- if (EQ (c, XCONS (tail)->car))
+ for (tail = Vhelp_event_list; CONSP (tail); tail = XCDR (tail))
+ if (EQ (c, XCAR (tail)))
return 1;
return 0;
}
Lisp_Object frame;
frame = event->frame_or_window;
if (CONSP (frame))
- frame = XCONS (frame)->car;
+ frame = XCAR (frame);
else if (WINDOWP (frame))
frame = WINDOW_FRAME (XWINDOW (frame));
{
register int c;
Lisp_Object obj;
- EMACS_TIME next_timer_delay;
if (noninteractive)
{
if (CONSP (Vunread_command_events))
{
Lisp_Object first;
- first = XCONS (Vunread_command_events)->car;
- Vunread_command_events = XCONS (Vunread_command_events)->cdr;
+ first = XCAR (Vunread_command_events);
+ Vunread_command_events = XCDR (Vunread_command_events);
*kbp = current_kboard;
return first;
}
frame = event->frame_or_window;
if (CONSP (frame))
- frame = XCONS (frame)->car;
+ frame = XCAR (frame);
else if (WINDOWP (frame))
frame = WINDOW_FRAME (XWINDOW (frame));
frame = focus;
if (! EQ (frame, internal_last_event_frame)
- && XFRAME (frame) != selected_frame)
+ && !EQ (frame, selected_frame))
obj = make_lispy_switch_frame (frame);
internal_last_event_frame = frame;
beginning of the menu sequence, and we might as well leave
that as the `event with parameters' for this selection. */
if ((event->kind == menu_bar_event
- || event->kind == TOOLBAR_EVENT)
- && !(CONSP (obj) && EQ (XCONS (obj)->car, Qmenu_bar))
- && !(CONSP (obj) && EQ (XCONS (obj)->car, Qtoolbar))
+ || event->kind == TOOL_BAR_EVENT)
+ && !(CONSP (obj) && EQ (XCAR (obj), Qmenu_bar))
+ && !(CONSP (obj) && EQ (XCAR (obj), Qtool_bar))
&& used_mouse_menu)
*used_mouse_menu = 1;
#endif
XSETFRAME (frame, f);
if (! EQ (frame, internal_last_event_frame)
- && XFRAME (frame) != selected_frame)
+ && !EQ (frame, selected_frame))
obj = make_lispy_switch_frame (frame);
internal_last_event_frame = frame;
}
EMACS_GET_TIME (timer_idleness_start_time);
/* Mark all idle-time timers as once again candidates for running. */
- for (timers = Vtimer_idle_list; CONSP (timers); timers = XCONS (timers)->cdr)
+ for (timers = Vtimer_idle_list; CONSP (timers); timers = XCDR (timers))
{
Lisp_Object timer;
- timer = XCONS (timers)->car;
+ timer = XCAR (timers);
if (!VECTORP (timer) || XVECTOR (timer)->size != 8)
continue;
while (CONSP (timers) || CONSP (idle_timers))
{
- int triggertime = EMACS_SECS (now);
Lisp_Object *vector;
Lisp_Object timer, idle_timer;
EMACS_TIME timer_time, idle_timer_time;
/* Skip past invalid timers and timers already handled. */
if (!NILP (timers))
{
- timer = XCONS (timers)->car;
+ timer = XCAR (timers);
if (!VECTORP (timer) || XVECTOR (timer)->size != 8)
{
- timers = XCONS (timers)->cdr;
+ timers = XCDR (timers);
continue;
}
vector = XVECTOR (timer)->contents;
|| !INTEGERP (vector[3])
|| ! NILP (vector[0]))
{
- timers = XCONS (timers)->cdr;
+ timers = XCDR (timers);
continue;
}
}
if (!NILP (idle_timers))
{
- timer = XCONS (idle_timers)->car;
+ timer = XCAR (idle_timers);
if (!VECTORP (timer) || XVECTOR (timer)->size != 8)
{
- idle_timers = XCONS (idle_timers)->cdr;
+ idle_timers = XCDR (idle_timers);
continue;
}
vector = XVECTOR (timer)->contents;
|| !INTEGERP (vector[3])
|| ! NILP (vector[0]))
{
- idle_timers = XCONS (idle_timers)->cdr;
+ idle_timers = XCDR (idle_timers);
continue;
}
}
this timer becomes ripe (negative if it's already ripe). */
if (!NILP (timers))
{
- timer = XCONS (timers)->car;
+ timer = XCAR (timers);
vector = XVECTOR (timer)->contents;
EMACS_SET_SECS (timer_time,
(XINT (vector[1]) << 16) | (XINT (vector[2])));
based on the next idle timer. */
if (!NILP (idle_timers))
{
- idle_timer = XCONS (idle_timers)->car;
+ idle_timer = XCAR (idle_timers);
vector = XVECTOR (idle_timer)->contents;
EMACS_SET_SECS (idle_timer_time,
(XINT (vector[1]) << 16) | (XINT (vector[2])));
if (EMACS_TIME_NEG_P (temp))
{
chosen_timer = timer;
- timers = XCONS (timers)->cdr;
+ timers = XCDR (timers);
difference = timer_difference;
}
else
{
chosen_timer = idle_timer;
- idle_timers = XCONS (idle_timers)->cdr;
+ idle_timers = XCDR (idle_timers);
difference = idle_timer_difference;
}
}
else if (! NILP (timers))
{
chosen_timer = timer;
- timers = XCONS (timers)->cdr;
+ timers = XCDR (timers);
difference = timer_difference;
}
else
{
chosen_timer = idle_timer;
- idle_timers = XCONS (idle_timers)->cdr;
+ idle_timers = XCDR (idle_timers);
difference = idle_timer_difference;
}
vector = XVECTOR (chosen_timer)->contents;
{
if (NILP (vector[0]))
{
- Lisp_Object tem;
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. */
/* 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 string;
int charpos;
- posn = part == 1 ? Qmode_line : Qtop_line;
+ posn = part == 1 ? Qmode_line : Qheader_line;
string = mode_line_string (w, wx, wy, part == 1, &charpos);
if (STRINGP (string))
string_info = Fcons (string, make_number (charpos));
Lisp_Object down;
down = Fnth (make_number (2), start_pos);
- if (EQ (event->x, XCONS (down)->car)
- && EQ (event->y, XCONS (down)->cdr))
+ if (EQ (event->x, XCAR (down))
+ && EQ (event->y, XCDR (down)))
{
event->modifiers |= click_modifier;
}
else if (part == 2)
posn = Qvertical_line;
else if (part == 3)
- posn = Qtop_line;
+ posn = Qheader_line;
else
XSETINT (posn,
buffer_posn_from_coords (XWINDOW (window),
FRAME_PTR f;
Lisp_Object window;
Lisp_Object posn;
- Lisp_Object head, position;
Lisp_Object files;
int row, column;
if (! CONSP (event->frame_or_window))
abort ();
- f = XFRAME (XCONS (event->frame_or_window)->car);
- files = XCONS (event->frame_or_window)->cdr;
+ f = XFRAME (XCAR (event->frame_or_window));
+ files = XCDR (event->frame_or_window);
/* Ignore mouse events that were made on frames that
have been deleted. */
if (!WINDOWP (window))
{
- window = XCONS (event->frame_or_window)->car;
+ window = XCAR (event->frame_or_window);
posn = Qnil;
}
else
else if (part == 2)
posn = Qvertical_line;
else if (part == 3)
- posn = Qtop_line;
+ posn = Qheader_line;
else
XSETINT (posn, buffer_posn_from_coords (w, &wx, &wy));
}
/* The event value is in the cdr of the frame_or_window slot. */
if (!CONSP (event->frame_or_window))
abort ();
- return XCONS (event->frame_or_window)->cdr;
+ return XCDR (event->frame_or_window);
#endif
- case TOOLBAR_EVENT:
+ case TOOL_BAR_EVENT:
{
Lisp_Object key;
if (!CONSP (event->frame_or_window))
if (WINDOWP (window))
{
struct window *w = XWINDOW (window);
- int hpos, vpos;
int wx, wy;
- int pos;
/* Get window relative coordinates. */
wx = FRAME_TO_WINDOW_PIXEL_X (w, XINT (x));
else if (area == 2)
posn = Qvertical_line;
else if (area == 3)
- posn = Qtop_line;
+ posn = Qheader_line;
else
XSETINT (posn, buffer_posn_from_coords (w, &wx, &wy));
}
entry = assq_no_quit (index, cache);
if (CONSP (entry))
- new_symbol = XCONS (entry)->cdr;
+ new_symbol = XCDR (entry);
else
{
/* We have to create the symbol ourselves. */
Lisp_Object parsed;
parsed = parse_modifiers (symbol);
- return apply_modifiers ((int) XINT (XCONS (XCONS (parsed)->cdr)->car),
- XCONS (parsed)->car);
+ return apply_modifiers ((int) XINT (XCAR (XCDR (parsed))),
+ XCAR (parsed));
}
Lisp_Object elt;
int this = 0;
- elt = XCONS (rest)->car;
- rest = XCONS (rest)->cdr;
+ elt = XCAR (rest);
+ rest = XCDR (rest);
/* Given a symbol, see if it is a modifier name. */
if (SYMBOLP (elt) && CONSP (rest))
if (! CONSP (object))
return 0;
- for (tail = object; CONSP (tail); tail = XCONS (tail)->cdr)
+ for (tail = object; CONSP (tail); tail = XCDR (tail))
{
Lisp_Object elt;
- elt = XCONS (tail)->car;
+ elt = XCAR (tail);
if (! (INTEGERP (elt) || SYMBOLP (elt)))
return 0;
}
cbuf[0] = dos_keyread ();
nread = 1;
#else
- nread = read (input_fd, cbuf, n_to_read);
+ nread = emacs_read (input_fd, cbuf, n_to_read);
#endif
/* POSIX infers that processes which are not in the session leader's
process group won't get SIGHUP's at logout time. BSDI adheres to
cbuf[i] &= ~0x80;
buf[i].code = cbuf[i];
- XSETFRAME (buf[i].frame_or_window, selected_frame);
+ buf[i].frame_or_window = selected_frame;
}
}
nmaps = current_minor_maps (NULL, &tmaps);
maps = (Lisp_Object *) alloca ((nmaps + 2) * sizeof (maps[0]));
bcopy (tmaps, maps, nmaps * sizeof (maps[0]));
-#ifdef USE_TEXT_PROPERTIES
maps[nmaps++] = get_local_map (PT, current_buffer);
-#else
- maps[nmaps++] = current_buffer->keymap;
-#endif
}
maps[nmaps++] = current_global_map;
}
/* Move to the end those items that should be at the end. */
- for (tail = Vmenu_bar_final_items; CONSP (tail); tail = XCONS (tail)->cdr)
+ for (tail = Vmenu_bar_final_items; CONSP (tail); tail = XCDR (tail))
{
int i;
int end = menu_bar_items_index;
for (i = 0; i < end; i += 4)
- if (EQ (XCONS (tail)->car, XVECTOR (menu_bar_items_vector)->contents[i]))
+ if (EQ (XCAR (tail), XVECTOR (menu_bar_items_vector)->contents[i]))
{
Lisp_Object tem0, tem1, tem2, tem3;
/* Move the item at index I to the end,
if (i + 4 > XVECTOR (menu_bar_items_vector)->size)
{
Lisp_Object tem;
- int newsize = 2 * i;
tem = Fmake_vector (make_number (2 * i), Qnil);
bcopy (XVECTOR (menu_bar_items_vector)->contents,
XVECTOR (tem)->contents, i * sizeof (Lisp_Object));
menu_bar_one_keymap (keymap)
Lisp_Object keymap;
{
- Lisp_Object tail, item, table;
+ Lisp_Object tail, item;
menu_bar_one_keymap_changed_items = Qnil;
/* Loop over all keymap entries that have menu strings. */
- for (tail = keymap; CONSP (tail); tail = XCONS (tail)->cdr)
+ for (tail = keymap; CONSP (tail); tail = XCDR (tail))
{
- item = XCONS (tail)->car;
+ item = XCAR (tail);
if (CONSP (item))
- menu_bar_item (XCONS (item)->car, XCONS (item)->cdr);
+ menu_bar_item (XCAR (item), XCDR (item));
else if (VECTORP (item))
{
/* Loop over the char values represented in the vector. */
if (i + 4 > XVECTOR (menu_bar_items_vector)->size)
{
Lisp_Object tem;
- int newsize = 2 * i;
tem = Fmake_vector (make_number (2 * i), Qnil);
bcopy (XVECTOR (menu_bar_items_vector)->contents,
XVECTOR (tem)->contents, i * sizeof (Lisp_Object));
{
/* If we got a quit from within the menu computation,
quit all the way out of it. This takes care of C-] in the debugger. */
- if (CONSP (arg) && EQ (XCONS (arg)->car, Qquit))
+ if (CONSP (arg) && EQ (XCAR (arg), Qquit))
Fsignal (Qquit, Qnil);
return Qnil;
/* Save the item here to protect it from GC. */
XVECTOR (item_properties)->contents[ITEM_PROPERTY_ITEM] = item;
- item_string = XCONS (item)->car;
+ item_string = XCAR (item);
start = item;
- item = XCONS (item)->cdr;
+ item = XCDR (item);
if (STRINGP (item_string))
{
/* Old format menu item. */
XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME] = item_string;
/* Maybe help string. */
- if (CONSP (item) && STRINGP (XCONS (item)->car))
+ if (CONSP (item) && STRINGP (XCAR (item)))
{
XVECTOR (item_properties)->contents[ITEM_PROPERTY_HELP]
- = XCONS (item)->car;
+ = XCAR (item);
start = item;
- item = XCONS (item)->cdr;
+ item = XCDR (item);
}
/* Maybee key binding cache. */
- if (CONSP (item) && CONSP (XCONS (item)->car)
- && (NILP (XCONS (XCONS (item)->car)->car)
- || VECTORP (XCONS (XCONS (item)->car)->car)))
+ if (CONSP (item) && CONSP (XCAR (item))
+ && (NILP (XCAR (XCAR (item)))
+ || VECTORP (XCAR (XCAR (item)))))
{
- cachelist = XCONS (item)->car;
- item = XCONS (item)->cdr;
+ cachelist = XCAR (item);
+ item = XCDR (item);
}
/* This is the real definition--the function to run. */
{
/* New format menu item. */
XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME]
- = XCONS (item)->car;
- start = XCONS (item)->cdr;
+ = XCAR (item);
+ start = XCDR (item);
if (CONSP (start))
{
/* We have a real binding. */
XVECTOR (item_properties)->contents[ITEM_PROPERTY_DEF]
- = XCONS (start)->car;
+ = XCAR (start);
- item = XCONS (start)->cdr;
+ item = XCDR (start);
/* Is there a cache list with key equivalences. */
- if (CONSP (item) && CONSP (XCONS (item)->car))
+ if (CONSP (item) && CONSP (XCAR (item)))
{
- cachelist = XCONS (item)->car;
- item = XCONS (item)->cdr;
+ cachelist = XCAR (item);
+ item = XCDR (item);
}
/* Parse properties. */
- while (CONSP (item) && CONSP (XCONS (item)->cdr))
+ while (CONSP (item) && CONSP (XCDR (item)))
{
- tem = XCONS (item)->car;
- item = XCONS (item)->cdr;
+ tem = XCAR (item);
+ item = XCDR (item);
if (EQ (tem, QCenable))
XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE]
- = XCONS (item)->car;
+ = XCAR (item);
else if (EQ (tem, QCvisible) && !notreal)
{
/* If got a visible property and that evaluates to nil
then ignore this item. */
- tem = menu_item_eval_property (XCONS (item)->car);
+ tem = menu_item_eval_property (XCAR (item));
if (NILP (tem))
return 0;
}
else if (EQ (tem, QChelp))
XVECTOR (item_properties)->contents[ITEM_PROPERTY_HELP]
- = XCONS (item)->car;
+ = XCAR (item);
else if (EQ (tem, QCfilter))
filter = item;
else if (EQ (tem, QCkey_sequence))
{
- tem = XCONS (item)->car;
+ tem = XCAR (item);
if (NILP (cachelist)
&& (SYMBOLP (tem) || STRINGP (tem) || VECTORP (tem)))
/* Be GC protected. Set keyhint to item instead of tem. */
}
else if (EQ (tem, QCkeys))
{
- tem = XCONS (item)->car;
- if (CONSP (tem) || STRINGP (tem) && NILP (cachelist))
+ tem = XCAR (item);
+ if (CONSP (tem) || (STRINGP (tem) && NILP (cachelist)))
XVECTOR (item_properties)->contents[ITEM_PROPERTY_KEYEQ]
= tem;
}
- else if (EQ (tem, QCbutton) && CONSP (XCONS (item)->car))
+ else if (EQ (tem, QCbutton) && CONSP (XCAR (item)))
{
Lisp_Object type;
- tem = XCONS (item)->car;
- type = XCONS (tem)->car;
+ tem = XCAR (item);
+ type = XCAR (tem);
if (EQ (type, QCtoggle) || EQ (type, QCradio))
{
XVECTOR (item_properties)->contents[ITEM_PROPERTY_SELECTED]
- = XCONS (tem)->cdr;
+ = XCDR (tem);
XVECTOR (item_properties)->contents[ITEM_PROPERTY_TYPE]
= type;
}
}
- item = XCONS (item)->cdr;
+ item = XCDR (item);
}
}
else if (inmenubar || !NILP (start))
def = XVECTOR (item_properties)->contents[ITEM_PROPERTY_DEF];
if (!NILP (filter))
{
- def = menu_item_eval_property (list2 (XCONS (filter)->car,
+ def = menu_item_eval_property (list2 (XCAR (filter),
list2 (Qquote, def)));
XVECTOR (item_properties)->contents[ITEM_PROPERTY_DEF] = def;
{
/* We have to create a cachelist. */
CHECK_IMPURE (start);
- XCONS (start)->cdr = Fcons (Fcons (Qnil, Qnil), XCONS (start)->cdr);
- cachelist = XCONS (XCONS (start)->cdr)->car;
+ XCDR (start) = Fcons (Fcons (Qnil, Qnil), XCDR (start));
+ cachelist = XCAR (XCDR (start));
newcache = 1;
tem = XVECTOR (item_properties)->contents[ITEM_PROPERTY_KEYEQ];
if (!NILP (keyhint))
{
- XCONS (cachelist)->car = XCONS (keyhint)->car;
+ XCAR (cachelist) = XCAR (keyhint);
newcache = 0;
}
else if (STRINGP (tem))
{
- XCONS (cachelist)->cdr = Fsubstitute_command_keys (tem);
- XCONS (cachelist)->car = Qt;
+ XCDR (cachelist) = Fsubstitute_command_keys (tem);
+ XCAR (cachelist) = Qt;
}
}
- tem = XCONS (cachelist)->car;
+ tem = XCAR (cachelist);
if (!EQ (tem, Qt))
{
int chkcache = 0;
prefix = XVECTOR (item_properties)->contents[ITEM_PROPERTY_KEYEQ];
if (CONSP (prefix))
{
- def = XCONS (prefix)->car;
- prefix = XCONS (prefix)->cdr;
+ def = XCAR (prefix);
+ prefix = XCDR (prefix);
}
else
def = XVECTOR (item_properties)->contents[ITEM_PROPERTY_DEF];
- if (NILP (XCONS (cachelist)->car)) /* Have no saved key. */
+ if (NILP (XCAR (cachelist))) /* Have no saved key. */
{
if (newcache /* Always check first time. */
/* Should we check everything when precomputing key
}
/* We had a saved key. Is it still bound to the command? */
else if (NILP (tem)
- || !EQ (tem, def)
- /* 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)))
+ || (!EQ (tem, def)
+ /* 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))))
chkcache = 1; /* Need to recompute key binding. */
if (chkcache)
&& ! NILP (Fget (def, Qmenu_alias)))
def = XSYMBOL (def)->function;
tem = Fwhere_is_internal (def, Qnil, Qt, Qnil);
- XCONS (cachelist)->car = tem;
+ XCAR (cachelist) = tem;
if (NILP (tem))
{
- XCONS (cachelist)->cdr = Qnil;
+ XCDR (cachelist) = Qnil;
chkcache = 0;
}
}
- else if (!NILP (keyhint) && !NILP (XCONS (cachelist)->car))
+ else if (!NILP (keyhint) && !NILP (XCAR (cachelist)))
{
- tem = XCONS (cachelist)->car;
+ tem = XCAR (cachelist);
chkcache = 1;
}
tem = Fkey_description (tem);
if (CONSP (prefix))
{
- if (STRINGP (XCONS (prefix)->car))
- tem = concat2 (XCONS (prefix)->car, tem);
- if (STRINGP (XCONS (prefix)->cdr))
- tem = concat2 (tem, XCONS (prefix)->cdr);
+ if (STRINGP (XCAR (prefix)))
+ tem = concat2 (XCAR (prefix), tem);
+ if (STRINGP (XCDR (prefix)))
+ tem = concat2 (tem, XCDR (prefix));
}
- XCONS (cachelist)->cdr = tem;
+ XCDR (cachelist) = tem;
}
}
- tem = XCONS (cachelist)->cdr;
+ tem = XCDR (cachelist);
if (newcache && !NILP (tem))
{
tem = concat3 (build_string (" ("), tem, build_string (")"));
- XCONS (cachelist)->cdr = tem;
+ XCDR (cachelist) = tem;
}
/* If we only want to precompute equivalent key bindings, stop here. */
Tool-bars
***********************************************************************/
-/* A vector holding toolbar items while they are parsed in function
- toolbar_items runs Each item occupies TOOLBAR_ITEM_NSCLOTS
- elements in the vector. */
+/* A vector holding tool bar items while they are parsed in function
+ tool_bar_items runs Each item occupies TOOL_BAR_ITEM_NSCLOTS elements
+ in the vector. */
-static Lisp_Object toolbar_items_vector;
+static Lisp_Object tool_bar_items_vector;
-/* A vector holding the result of parse_toolbar_item. Layout is like
- the one for a single item in toolbar_items_vector. */
+/* A vector holding the result of parse_tool_bar_item. Layout is like
+ the one for a single item in tool_bar_items_vector. */
-static Lisp_Object toolbar_item_properties;
+static Lisp_Object tool_bar_item_properties;
-/* Next free index in toolbar_items_vector. */
+/* Next free index in tool_bar_items_vector. */
-static int ntoolbar_items;
+static int ntool_bar_items;
-/* The symbols `toolbar', `toolbar-item', and `:image'. */
+/* The symbols `tool-bar', and `:image'. */
-extern Lisp_Object Qtoolbar;
+extern Lisp_Object Qtool_bar;
Lisp_Object QCimage;
/* Function prototypes. */
-static void init_toolbar_items P_ ((Lisp_Object));
-static void process_toolbar_item P_ ((Lisp_Object, Lisp_Object));
-static int parse_toolbar_item P_ ((Lisp_Object, Lisp_Object));
-static void append_toolbar_item P_ ((void));
+static void init_tool_bar_items P_ ((Lisp_Object));
+static void process_tool_bar_item P_ ((Lisp_Object, Lisp_Object));
+static int parse_tool_bar_item P_ ((Lisp_Object, Lisp_Object));
+static void append_tool_bar_item P_ ((void));
-/* Return a vector of toolbar items for keymaps currently in effect.
+/* Return a vector of tool bar items for keymaps currently in effect.
Reuse vector REUSE if non-nil. Return in *NITEMS the number of
- toolbar items found. */
+ tool bar items found. */
Lisp_Object
-toolbar_items (reuse, nitems)
+tool_bar_items (reuse, nitems)
Lisp_Object reuse;
int *nitems;
{
oquit = Vinhibit_quit;
Vinhibit_quit = Qt;
- /* Initialize toolbar_items_vector and protect it from GC. */
- init_toolbar_items (reuse);
+ /* Initialize tool_bar_items_vector and protect it from GC. */
+ init_tool_bar_items (reuse);
/* Build list of keymaps in maps. Set nmaps to the number of maps
to process. */
nmaps = current_minor_maps (NULL, &tmaps);
maps = (Lisp_Object *) alloca ((nmaps + 2) * sizeof (maps[0]));
bcopy (tmaps, maps, nmaps * sizeof (maps[0]));
-#ifdef USE_TEXT_PROPERTIES
maps[nmaps++] = get_local_map (PT, current_buffer);
-#else
- maps[nmaps++] = current_buffer->keymap;
-#endif
}
/* Add global keymap at the end. */
maps[nmaps++] = current_global_map;
/* Process maps in reverse order and look up in each map the prefix
- key `toolbar'. */
+ key `tool-bar'. */
for (i = nmaps - 1; i >= 0; --i)
if (!NILP (maps[i]))
{
Lisp_Object keymap;
- keymap = get_keyelt (access_keymap (maps[i], Qtoolbar, 1, 1), 0);
+ keymap = get_keyelt (access_keymap (maps[i], Qtool_bar, 1, 1), 0);
if (!NILP (Fkeymapp (keymap)))
{
Lisp_Object tail;
/* KEYMAP is a list `(keymap (KEY . BINDING) ...)'. */
- for (tail = keymap; CONSP (tail); tail = XCONS (tail)->cdr)
+ for (tail = keymap; CONSP (tail); tail = XCDR (tail))
{
Lisp_Object keydef = XCAR (tail);
if (CONSP (keydef))
- process_toolbar_item (XCAR (keydef), XCDR (keydef));
+ process_tool_bar_item (XCAR (keydef), XCDR (keydef));
}
}
}
Vinhibit_quit = oquit;
- *nitems = ntoolbar_items / TOOLBAR_ITEM_NSLOTS;
- return toolbar_items_vector;
+ *nitems = ntool_bar_items / TOOL_BAR_ITEM_NSLOTS;
+ return tool_bar_items_vector;
}
/* Process the definition of KEY which is DEF. */
static void
-process_toolbar_item (key, def)
+process_tool_bar_item (key, def)
Lisp_Object key, def;
{
int i;
extern Lisp_Object Qundefined;
struct gcpro gcpro1, gcpro2;
- /* Protect KEY and DEF from GC because parse_toolbar_item may call
+ /* Protect KEY and DEF from GC because parse_tool_bar_item may call
eval. */
GCPRO2 (key, def);
{
/* If a map has an explicit `undefined' as definition,
discard any previously made item. */
- for (i = 0; i < ntoolbar_items; i += TOOLBAR_ITEM_NSLOTS)
+ for (i = 0; i < ntool_bar_items; i += TOOL_BAR_ITEM_NSLOTS)
{
- Lisp_Object *v = XVECTOR (toolbar_items_vector)->contents + i;
+ Lisp_Object *v = XVECTOR (tool_bar_items_vector)->contents + i;
- if (EQ (key, v[TOOLBAR_ITEM_KEY]))
+ if (EQ (key, v[TOOL_BAR_ITEM_KEY]))
{
- if (ntoolbar_items > i + TOOLBAR_ITEM_NSLOTS)
- bcopy (v + TOOLBAR_ITEM_NSLOTS, v,
- ((ntoolbar_items - i - TOOLBAR_ITEM_NSLOTS)
+ if (ntool_bar_items > i + TOOL_BAR_ITEM_NSLOTS)
+ bcopy (v + TOOL_BAR_ITEM_NSLOTS, v,
+ ((ntool_bar_items - i - TOOL_BAR_ITEM_NSLOTS)
* sizeof (Lisp_Object)));
- ntoolbar_items -= TOOLBAR_ITEM_NSLOTS;
+ ntool_bar_items -= TOOL_BAR_ITEM_NSLOTS;
break;
}
}
}
- else if (parse_toolbar_item (key, def))
- /* Append a new toolbar item to toolbar_items_vector. Accept
+ else if (parse_tool_bar_item (key, def))
+ /* Append a new tool bar item to tool_bar_items_vector. Accept
more than one definition for the same key. */
- append_toolbar_item ();
+ append_tool_bar_item ();
UNGCPRO;
}
-/* Parse a toolbar item specification ITEM for key KEY and return the
- result in toolbar_item_properties. Value is zero if ITEM is
+/* Parse a tool bar item specification ITEM for key KEY and return the
+ result in tool_bar_item_properties. Value is zero if ITEM is
invalid.
ITEM is a list `(menu-item CAPTION BINDING PROPS...)'.
CAPTION is the caption of the item, If it's not a string, it is
evaluated to get a string.
- BINDING is the toolbar item's binding. Toolbar items with keymaps
+ BINDING is the tool bar item's binding. Tool-bar items with keymaps
as binding are currently ignored.
The following properties are recognized:
- `:enable FORM'.
- FORM is evaluated and specifies whether the toolbar item is enabled
- or disabled.
+ FORM is evaluated and specifies whether the tool bar item is
+ enabled or disabled.
- `:visible FORM'
- FORM is evaluated and specifies whether the toolbar item is visible.
+ FORM is evaluated and specifies whether the tool bar item is visible.
- `:filter FUNCTION'
- `:image IMAGES'
IMAGES is either a single image specification or a vector of four
- image specifications. See enum toolbar_item_images.
+ image specifications. See enum tool_bar_item_images.
- `:help HELP-STRING'.
- Gives a help string to display for the toolbar item. */
+ Gives a help string to display for the tool bar item. */
static int
-parse_toolbar_item (key, item)
+parse_tool_bar_item (key, item)
Lisp_Object key, item;
{
- /* Access slot with index IDX of vector toolbar_item_properties. */
-#define PROP(IDX) XVECTOR (toolbar_item_properties)->contents[IDX]
+ /* Access slot with index IDX of vector tool_bar_item_properties. */
+#define PROP(IDX) XVECTOR (tool_bar_item_properties)->contents[IDX]
Lisp_Object filter = Qnil;
Lisp_Object caption;
extern Lisp_Object QCenable, QCvisible, QChelp, QCfilter;
extern Lisp_Object QCbutton, QCtoggle, QCradio;
int i;
- struct gcpro gcpro1;
- /* Defininition looks like `(toolbar-item CAPTION BINDING
+ /* Defininition looks like `(tool-bar-item CAPTION BINDING
PROPS...)'. Rule out items that aren't lists, don't start with
- `toolbar-item' or whose rest following `toolbar-item' is not a
+ `tool-bar-item' or whose rest following `tool-bar-item' is not a
list. */
if (!CONSP (item)
|| !EQ (XCAR (item), Qmenu_item)
!CONSP (item)))
return 0;
- /* Create toolbar_item_properties vector if necessary. Reset it to
+ /* Create tool_bar_item_properties vector if necessary. Reset it to
defaults. */
- if (VECTORP (toolbar_item_properties))
+ if (VECTORP (tool_bar_item_properties))
{
- for (i = 0; i < TOOLBAR_ITEM_NSLOTS; ++i)
+ for (i = 0; i < TOOL_BAR_ITEM_NSLOTS; ++i)
PROP (i) = Qnil;
}
else
- toolbar_item_properties
- = Fmake_vector (make_number (TOOLBAR_ITEM_NSLOTS), Qnil);
+ tool_bar_item_properties
+ = Fmake_vector (make_number (TOOL_BAR_ITEM_NSLOTS), Qnil);
/* Set defaults. */
- PROP (TOOLBAR_ITEM_KEY) = key;
- PROP (TOOLBAR_ITEM_ENABLED_P) = Qt;
+ PROP (TOOL_BAR_ITEM_KEY) = key;
+ PROP (TOOL_BAR_ITEM_ENABLED_P) = Qt;
/* Get the caption of the item. If the caption is not a string,
evaluate it to get a string. If we don't get a string, skip this
if (!STRINGP (caption))
return 0;
}
- PROP (TOOLBAR_ITEM_CAPTION) = caption;
+ PROP (TOOL_BAR_ITEM_CAPTION) = caption;
/* Give up if rest following the caption is not a list. */
item = XCDR (item);
return 0;
/* Store the binding. */
- PROP (TOOLBAR_ITEM_BINDING) = XCAR (item);
+ PROP (TOOL_BAR_ITEM_BINDING) = XCAR (item);
item = XCDR (item);
/* Process the rest of the properties. */
if (EQ (key, QCenable))
/* `:enable FORM'. */
- PROP (TOOLBAR_ITEM_ENABLED_P) = value;
+ PROP (TOOL_BAR_ITEM_ENABLED_P) = value;
else if (EQ (key, QCvisible))
{
/* `:visible FORM'. If got a visible property and that
}
else if (EQ (key, QChelp))
/* `:help HELP-STRING'. */
- PROP (TOOLBAR_ITEM_HELP) = value;
+ PROP (TOOL_BAR_ITEM_HELP) = value;
else if (EQ (key, QCfilter))
/* ':filter FORM'. */
filter = value;
selected = XCDR (value);
if (EQ (type, QCtoggle) || EQ (type, QCradio))
{
- PROP (TOOLBAR_ITEM_SELECTED_P) = selected;
- PROP (TOOLBAR_ITEM_TYPE) = type;
+ PROP (TOOL_BAR_ITEM_SELECTED_P) = selected;
+ PROP (TOOL_BAR_ITEM_TYPE) = type;
}
}
else if (EQ (key, QCimage)
|| (VECTORP (value) && XVECTOR (value)->size == 4)))
/* Value is either a single image specification or a vector
of 4 such specifications for the different buttion states. */
- PROP (TOOLBAR_ITEM_IMAGES) = value;
+ PROP (TOOL_BAR_ITEM_IMAGES) = value;
}
/* If got a filter apply it on binding. */
if (!NILP (filter))
- PROP (TOOLBAR_ITEM_BINDING)
+ PROP (TOOL_BAR_ITEM_BINDING)
= menu_item_eval_property (list2 (filter,
list2 (Qquote,
- PROP (TOOLBAR_ITEM_BINDING))));
+ PROP (TOOL_BAR_ITEM_BINDING))));
/* See if the binding is a keymap. Give up if it is. */
- if (!NILP (get_keymap_1 (PROP (TOOLBAR_ITEM_BINDING), 0, 1)))
+ if (!NILP (get_keymap_1 (PROP (TOOL_BAR_ITEM_BINDING), 0, 1)))
return 0;
/* Enable or disable selection of item. */
- if (!EQ (PROP (TOOLBAR_ITEM_ENABLED_P), Qt))
- PROP (TOOLBAR_ITEM_ENABLED_P)
- = menu_item_eval_property (PROP (TOOLBAR_ITEM_ENABLED_P));
+ if (!EQ (PROP (TOOL_BAR_ITEM_ENABLED_P), Qt))
+ PROP (TOOL_BAR_ITEM_ENABLED_P)
+ = menu_item_eval_property (PROP (TOOL_BAR_ITEM_ENABLED_P));
/* Handle radio buttons or toggle boxes. */
- if (!NILP (PROP (TOOLBAR_ITEM_SELECTED_P)))
- PROP (TOOLBAR_ITEM_SELECTED_P)
- = menu_item_eval_property (PROP (TOOLBAR_ITEM_SELECTED_P));
+ if (!NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)))
+ PROP (TOOL_BAR_ITEM_SELECTED_P)
+ = menu_item_eval_property (PROP (TOOL_BAR_ITEM_SELECTED_P));
return 1;
}
-/* Initialize Vtoolbar_items. REUSE, if non-nil, is a vector that can
- be reused. */
+/* Initialize tool_bar_items_vector. REUSE, if non-nil, is a vector
+ that can be reused. */
static void
-init_toolbar_items (reuse)
+init_tool_bar_items (reuse)
Lisp_Object reuse;
{
if (VECTORP (reuse))
- toolbar_items_vector = reuse;
+ tool_bar_items_vector = reuse;
else
- toolbar_items_vector = Fmake_vector (make_number (64), Qnil);
- ntoolbar_items = 0;
+ tool_bar_items_vector = Fmake_vector (make_number (64), Qnil);
+ ntool_bar_items = 0;
}
-/* Append parsed toolbar item properties from toolbar_item_properties */
+/* Append parsed tool bar item properties from
+ tool_bar_item_properties */
static void
-append_toolbar_item ()
+append_tool_bar_item ()
{
Lisp_Object *to, *from;
- /* Enlarge toolbar_items_vector if necessary. */
- if (ntoolbar_items + TOOLBAR_ITEM_NSLOTS
- >= XVECTOR (toolbar_items_vector)->size)
+ /* Enlarge tool_bar_items_vector if necessary. */
+ if (ntool_bar_items + TOOL_BAR_ITEM_NSLOTS
+ >= XVECTOR (tool_bar_items_vector)->size)
{
Lisp_Object new_vector;
- int old_size = XVECTOR (toolbar_items_vector)->size;
+ int old_size = XVECTOR (tool_bar_items_vector)->size;
new_vector = Fmake_vector (make_number (2 * old_size), Qnil);
- bcopy (XVECTOR (toolbar_items_vector)->contents,
+ bcopy (XVECTOR (tool_bar_items_vector)->contents,
XVECTOR (new_vector)->contents,
old_size * sizeof (Lisp_Object));
- toolbar_items_vector = new_vector;
+ tool_bar_items_vector = new_vector;
}
- /* Append entries from toolbar_item_properties to the end of
- toolbar_items_vector. */
- to = XVECTOR (toolbar_items_vector)->contents + ntoolbar_items;
- from = XVECTOR (toolbar_item_properties)->contents;
- bcopy (from, to, TOOLBAR_ITEM_NSLOTS * sizeof *to);
- ntoolbar_items += TOOLBAR_ITEM_NSLOTS;
+ /* Append entries from tool_bar_item_properties to the end of
+ tool_bar_items_vector. */
+ to = XVECTOR (tool_bar_items_vector)->contents + ntool_bar_items;
+ from = XVECTOR (tool_bar_item_properties)->contents;
+ bcopy (from, to, TOOL_BAR_ITEM_NSLOTS * sizeof *to);
+ ntool_bar_items += TOOL_BAR_ITEM_NSLOTS;
}
{
int mapno;
register Lisp_Object name;
- Lisp_Object rest, vector;
if (used_mouse_menu)
*used_mouse_menu = 0;
/* If we got to this point via a mouse click,
use a real menu for mouse selection. */
if (EVENT_HAS_PARAMETERS (prev_event)
- && !EQ (XCONS (prev_event)->car, Qmenu_bar)
- && !EQ (XCONS (prev_event)->car, Qtoolbar))
+ && !EQ (XCAR (prev_event), Qmenu_bar)
+ && !EQ (XCAR (prev_event), Qtool_bar))
{
/* Display the menu and get the selection. */
Lisp_Object *realmaps
{
Lisp_Object tem;
- record_menu_key (XCONS (value)->car);
+ record_menu_key (XCAR (value));
/* If we got multiple events, unread all but
the first.
to indicate that they came from a mouse menu,
so that when present in last_nonmenu_event
they won't confuse things. */
- for (tem = XCONS (value)->cdr; !NILP (tem);
- tem = XCONS (tem)->cdr)
+ for (tem = XCDR (value); !NILP (tem);
+ tem = XCDR (tem))
{
- record_menu_key (XCONS (tem)->car);
- if (SYMBOLP (XCONS (tem)->car)
- || INTEGERP (XCONS (tem)->car))
- XCONS (tem)->car
- = Fcons (XCONS (tem)->car, Qnil);
+ record_menu_key (XCAR (tem));
+ if (SYMBOLP (XCAR (tem))
+ || INTEGERP (XCAR (tem)))
+ XCAR (tem)
+ = Fcons (XCAR (tem), Qnil);
}
/* If we got more than one event, put all but the first
onto this list to be read later.
Return just the first event now. */
Vunread_command_events
- = nconc2 (XCONS (value)->cdr, Vunread_command_events);
- value = XCONS (value)->car;
+ = nconc2 (XCDR (value), Vunread_command_events);
+ value = XCAR (value);
}
else if (NILP (value))
value = Qt;
int mapno;
register Lisp_Object name;
int nlength;
- int width = FRAME_WIDTH (selected_frame) - 4;
+ int width = FRAME_WIDTH (SELECTED_FRAME ()) - 4;
int idx = -1;
int nobindings = 1;
Lisp_Object rest, vector;
int prev_keytran_start;
int prev_keytran_end;
+#if defined (GOBBLE_FIRST_EVENT)
int junk;
+#endif
raw_keybuf_count = 0;
{
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 ();
nmaps_allocated = nmaps + 2;
}
bcopy (maps, submaps, nmaps * sizeof (submaps[0]));
-#ifdef USE_TEXT_PROPERTIES
submaps[nmaps++] = orig_local_map;
-#else
- submaps[nmaps++] = current_buffer->keymap;
-#endif
}
submaps[nmaps++] = current_global_map;
}
{
key = keybuf[t];
add_command_key (key);
- if (echo_keystrokes)
+ if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
+ && NILP (Fzerop (Vecho_keystrokes)))
echo_char (key);
}
/* If not, we should actually read a character. */
else
{
- struct buffer *buf = current_buffer;
-
{
#ifdef MULTI_KBOARD
KBOARD *interrupted_kboard = current_kboard;
- struct frame *interrupted_frame = selected_frame;
+ struct frame *interrupted_frame = SELECTED_FRAME ();
if (setjmp (wrong_kboard_jmpbuf))
{
if (!NILP (delayed_switch_frame))
/* If the side queue is non-empty, ensure it begins with a
switch-frame, so we'll replay it in the right context. */
if (CONSP (interrupted_kboard->kbd_queue)
- && (key = XCONS (interrupted_kboard->kbd_queue)->car,
+ && (key = XCAR (interrupted_kboard->kbd_queue),
!(EVENT_HAS_PARAMETERS (key)
&& EQ (EVENT_HEAD_KIND (EVENT_HEAD (key)),
Qswitch_frame))))
of the command_loop_1. */
if (fix_current_buffer)
{
- if (! FRAME_LIVE_P (selected_frame))
+ if (! FRAME_LIVE_P (XFRAME (selected_frame)))
Fkill_emacs (Qnil);
if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
Fset_buffer (XWINDOW (selected_window)->buffer);
emacsclient). */
record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
- if (! FRAME_LIVE_P (selected_frame))
+ if (! FRAME_LIVE_P (XFRAME (selected_frame)))
Fkill_emacs (Qnil);
set_buffer_internal (XBUFFER (XWINDOW (window)->buffer));
orig_local_map = get_local_map (PT, current_buffer);
/* For a mouse click, get the local text-property keymap
of the place clicked on, rather than point. */
if (last_real_key_start == 0
- && CONSP (XCONS (key)->cdr)
+ && CONSP (XCDR (key))
&& ! localized_local_map)
{
Lisp_Object map_here, start, pos;
localized_local_map = 1;
start = EVENT_START (key);
- if (CONSP (start) && CONSP (XCONS (start)->cdr))
+ if (CONSP (start) && CONSP (XCDR (start)))
{
pos = POSN_BUFFER_POSN (start);
if (INTEGERP (pos)
goto replay_key;
}
}
- else if (CONSP (XCONS (key)->cdr)
+ else if (CONSP (XCDR (key))
&& CONSP (EVENT_START (key))
- && CONSP (XCONS (EVENT_START (key))->cdr))
+ && CONSP (XCDR (EVENT_START (key))))
{
Lisp_Object posn;
posn = POSN_BUFFER_POSN (EVENT_START (key));
/* Handle menu-bar events:
insert the dummy prefix event `menu-bar'. */
- if (EQ (posn, Qmenu_bar) || EQ (posn, Qtoolbar))
+ if (EQ (posn, Qmenu_bar) || EQ (posn, Qtool_bar))
{
if (t + 1 >= bufsize)
error ("Key sequence too long");
int modifiers;
breakdown = parse_modifiers (head);
- modifiers = XINT (XCONS (XCONS (breakdown)->cdr)->car);
+ modifiers = XINT (XCAR (XCDR (breakdown)));
/* Attempt to reduce an unbound mouse event to a simpler
event that is bound:
Drags reduce to clicks.
}
new_head
- = apply_modifiers (modifiers, XCONS (breakdown)->car);
+ = apply_modifiers (modifiers, XCAR (breakdown));
new_click
= Fcons (new_head, Fcons (EVENT_START (key), Qnil));
/* Handle symbol with autoload definition. */
if (SYMBOLP (fkey_next) && ! NILP (Ffboundp (fkey_next))
&& CONSP (XSYMBOL (fkey_next)->function)
- && EQ (XCONS (XSYMBOL (fkey_next)->function)->car, Qautoload))
+ && EQ (XCAR (XSYMBOL (fkey_next)->function), Qautoload))
do_autoload (XSYMBOL (fkey_next)->function,
fkey_next);
/* Handle symbol with autoload definition. */
if (SYMBOLP (keytran_next) && ! NILP (Ffboundp (keytran_next))
&& CONSP (XSYMBOL (keytran_next)->function)
- && EQ (XCONS (XSYMBOL (keytran_next)->function)->car, Qautoload))
+ && EQ (XCAR (XSYMBOL (keytran_next)->function), Qautoload))
do_autoload (XSYMBOL (keytran_next)->function,
keytran_next);
int modifiers;
breakdown = parse_modifiers (key);
- modifiers = XINT (XCONS (XCONS (breakdown)->cdr)->car);
+ modifiers = XINT (XCAR (XCDR (breakdown)));
if (modifiers & shift_modifier)
{
Lisp_Object new_key;
modifiers &= ~shift_modifier;
new_key = apply_modifiers (modifiers,
- XCONS (breakdown)->car);
+ XCAR (breakdown));
keybuf[t - 1] = new_key;
mock_input = t;
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]);
}
{
Lisp_Object keybuf[30];
register int i;
- struct gcpro gcpro1, gcpro2;
+ struct gcpro gcpro1;
int count = specpdl_ptr - specpdl;
if (!NILP (prompt))
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;
{
Lisp_Object keybuf[30];
register int i;
- struct gcpro gcpro1, gcpro2;
+ struct gcpro gcpro1;
int count = specpdl_ptr - specpdl;
if (!NILP (prompt))
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;
{
tem = Fnthcdr (Vhistory_length, Vcommand_history);
if (CONSP (tem))
- XCONS (tem)->cdr = Qnil;
+ XCDR (tem) = Qnil;
}
}
if (EQ (prefixarg, Qminus))
strcpy (buf, "- ");
- else if (CONSP (prefixarg) && XINT (XCONS (prefixarg)->car) == 4)
+ else if (CONSP (prefixarg) && XINT (XCAR (prefixarg)) == 4)
strcpy (buf, "C-u ");
- else if (CONSP (prefixarg) && INTEGERP (XCONS (prefixarg)->car))
+ else if (CONSP (prefixarg) && INTEGERP (XCAR (prefixarg)))
{
if (sizeof (int) == sizeof (EMACS_INT))
- sprintf (buf, "%d ", XINT (XCONS (prefixarg)->car));
+ sprintf (buf, "%d ", XINT (XCAR (prefixarg)));
else if (sizeof (long) == sizeof (EMACS_INT))
- sprintf (buf, "%ld ", XINT (XCONS (prefixarg)->car));
+ sprintf (buf, "%ld ", (long) XINT (XCAR (prefixarg)));
else
abort ();
}
if (sizeof (int) == sizeof (EMACS_INT))
sprintf (buf, "%d ", XINT (prefixarg));
else if (sizeof (long) == sizeof (EMACS_INT))
- sprintf (buf, "%ld ", XINT (prefixarg));
+ sprintf (buf, "%ld ", (long) XINT (prefixarg));
else
abort ();
}
nmaps = current_minor_maps (NULL, &tmaps);
maps = (Lisp_Object *) xmalloc ((nmaps + 2) * sizeof (maps[0]));
bcopy (tmaps, maps, nmaps * sizeof (maps[0]));
-#ifdef USE_TEXT_PROPERTIES
maps[nmaps++] = get_local_map (PT, current_buffer);
-#else
- maps[nmaps++] = current_buffer->keymap;
-#endif
}
maps[nmaps++] = current_global_map;
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;
}
(stuffstring)
Lisp_Object stuffstring;
{
- Lisp_Object tem;
int count = specpdl_ptr - specpdl;
int old_height, old_width;
int width, height;
- struct gcpro gcpro1, gcpro2;
+ struct gcpro gcpro1;
if (!NILP (stuffstring))
CHECK_STRING (stuffstring, 0);
with a window system; but suspend should be disabled in that case. */
get_frame_size (&width, &height);
if (width != old_width || height != old_height)
- change_frame_size (selected_frame, height, width, 0, 0, 0);
+ change_frame_size (SELECTED_FRAME (), height, width, 0, 0, 0);
/* Run suspend-resume-hook. */
if (!NILP (Vrun_hooks))
char c;
/* Must preserve main program's value of errno. */
int old_errno = errno;
+ struct frame *sf = SELECTED_FRAME ();
#if defined (USG) && !defined (POSIX_SIGNALS)
if (!read_socket_hook && NILP (Vwindow_system))
cancel_echoing ();
if (!NILP (Vquit_flag)
- && (FRAME_TERMCAP_P (selected_frame) || FRAME_MSDOS_P (selected_frame)))
+ && (FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf)))
{
/* If SIGINT isn't blocked, don't let us be interrupted by
another SIGINT, it might be harmful due to non-reentrancy
#endif
#endif
if (FRAMEP (internal_last_event_frame)
- && XFRAME (internal_last_event_frame) != selected_frame)
+ && !EQ (internal_last_event_frame, selected_frame))
do_switch_frame (make_lispy_switch_frame (internal_last_event_frame),
Qnil, 0);
void
syms_of_keyboard ()
{
- /* Toolbars. */
+ /* Tool-bars. */
QCimage = intern (":image");
staticpro (&QCimage);
staticpro (&item_properties);
item_properties = Qnil;
- staticpro (&toolbar_item_properties);
- toolbar_item_properties = Qnil;
- staticpro (&toolbar_items_vector);
- toolbar_items_vector = Qnil;
+ staticpro (&tool_bar_item_properties);
+ tool_bar_item_properties = Qnil;
+ staticpro (&tool_bar_items_vector);
+ tool_bar_items_vector = Qnil;
staticpro (&real_this_command);
real_this_command = Qnil;
staticpro (&Qbottom);
Qend_scroll = intern ("end-scroll");
staticpro (&Qend_scroll);
+ Qratio = intern ("ratio");
+ staticpro (&Qratio);
Qevent_kind = intern ("event-kind");
staticpro (&Qevent_kind);
Vthis_command = Qnil;
DEFVAR_INT ("auto-save-interval", &auto_save_interval,
- "*Number of keyboard input characters between auto-saves.\n\
+ "*Number of input events between auto-saves.\n\
Zero means disable autosaving due to number of characters typed.");
auto_save_interval = 300;
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