static int raw_keybuf_count;
#define GROW_RAW_KEYBUF \
- if (raw_keybuf_count == XVECTOR (raw_keybuf)->size) \
+ if (raw_keybuf_count == ASIZE (raw_keybuf)) \
raw_keybuf = larger_vector (raw_keybuf, raw_keybuf_count * 2, Qnil) \
/* Number of elements of this_command_keys
/* Last size recorded for a current buffer which is not a minibuffer. */
static EMACS_INT last_non_minibuf_size;
-/* Total number of times read_char has returned, modulo SIZE_MAX + 1. */
-size_t num_input_events;
+/* Total number of times read_char has returned, modulo UINTMAX_MAX + 1. */
+uintmax_t num_input_events;
/* Value of num_nonmacro_input_events as of last auto save. */
/* The timestamp of the last input event we received from the X server.
X Windows wants this for selection ownership. */
-unsigned long last_event_timestamp;
+Time last_event_timestamp;
static Lisp_Object Qx_set_selection, Qhandle_switch_frame;
Lisp_Object QPRIMARY;
static Lisp_Object Qself_insert_command;
static Lisp_Object Qforward_char;
static Lisp_Object Qbackward_char;
-static Lisp_Object Qundefined;
+Lisp_Object Qundefined;
static Lisp_Object Qtimer_event_handler;
/* read_key_sequence stores here the command definition of the
static Lisp_Object Qdeferred_action_function;
+static Lisp_Object Qdelayed_warnings_hook;
+
static Lisp_Object Qinput_method_exit_on_first_char;
static Lisp_Object Qinput_method_use_echo_area;
#endif
static Lisp_Object modify_event_symbol (EMACS_INT, unsigned, Lisp_Object,
Lisp_Object, const char *const *,
- Lisp_Object *, unsigned);
+ Lisp_Object *, EMACS_INT);
static Lisp_Object make_lispy_switch_frame (Lisp_Object);
static int help_char_p (Lisp_Object);
static void save_getcjmp (jmp_buf);
if (!NILP (echo_area_buffer[0]))
resize_echo_area_exactly ();
+ /* If there are warnings waiting, process them. */
+ if (!NILP (Vdelayed_warnings_list))
+ safe_run_hooks (Qdelayed_warnings_hook);
+
if (!NILP (Vdeferred_action_list))
safe_run_hooks (Qdeferred_action_function);
}
message_with_string ("%s is undefined", keys, 0);
KVAR (current_kboard, defining_kbd_macro) = Qnil;
update_mode_lines = 1;
- KVAR (current_kboard, Vprefix_arg) = Qnil;
+ /* If this is a down-mouse event, don't reset prefix-arg;
+ pass it to the command run by the up event. */
+ if (EVENT_HAS_PARAMETERS (last_command_event))
+ {
+ Lisp_Object breakdown
+ = parse_modifiers (EVENT_HEAD (last_command_event));
+ int modifiers = XINT (XCAR (XCDR (breakdown)));
+ if (!(modifiers & down_modifier))
+ KVAR (current_kboard, Vprefix_arg) = Qnil;
+ }
+ else
+ KVAR (current_kboard, Vprefix_arg) = Qnil;
}
else
{
if (!NILP (echo_area_buffer[0]))
resize_echo_area_exactly ();
+ /* If there are warnings waiting, process them. */
+ if (!NILP (Vdelayed_warnings_list))
+ safe_run_hooks (Qdelayed_warnings_hook);
+
safe_run_hooks (Qdeferred_action_function);
/* If there is a prefix argument,
&& PT > BEGV && PT < ZV
&& !NILP (val = get_char_property_and_overlay
(make_number (PT), Qdisplay, Qnil, &overlay))
- && display_prop_intangible_p (val)
+ && display_prop_intangible_p (val, overlay, PT, PT_BYTE)
&& (!OVERLAYP (overlay)
? get_property_and_range (PT, Qdisplay, &val, &beg, &end, Qnil)
: (beg = OVERLAY_POSITION (OVERLAY_START (overlay)),
}
static Lisp_Object
-safe_run_hook_funcall (size_t nargs, Lisp_Object *args)
+safe_run_hook_funcall (ptrdiff_t nargs, Lisp_Object *args)
{
eassert (nargs == 1);
if (CONSP (Vinhibit_quit))
volatile Lisp_Object also_record;
volatile int reread;
struct gcpro gcpro1, gcpro2;
- int polling_stopped_here = 0;
+ int volatile polling_stopped_here = 0;
struct kboard *orig_kboard = current_kboard;
also_record = Qnil;
c = Faref (Vexecuting_kbd_macro, make_number (executing_kbd_macro_index));
if (STRINGP (Vexecuting_kbd_macro)
- && (XINT (c) & 0x80) && (XUINT (c) <= 0xff))
- XSETFASTINT (c, CHAR_META | (XINT (c) & ~0x80));
+ && (XFASTINT (c) & 0x80) && (XFASTINT (c) <= 0xff))
+ XSETFASTINT (c, CHAR_META | (XFASTINT (c) & ~0x80));
executing_kbd_macro_index++;
goto exit;
if ((STRINGP (KVAR (current_kboard, Vkeyboard_translate_table))
- && SCHARS (KVAR (current_kboard, Vkeyboard_translate_table)) > (unsigned) XFASTINT (c))
+ && UNSIGNED_CMP (XFASTINT (c), <,
+ SCHARS (KVAR (current_kboard,
+ Vkeyboard_translate_table))))
|| (VECTORP (KVAR (current_kboard, Vkeyboard_translate_table))
- && XVECTOR (KVAR (current_kboard, Vkeyboard_translate_table))->size > (unsigned) XFASTINT (c))
+ && UNSIGNED_CMP (XFASTINT (c), <,
+ ASIZE (KVAR (current_kboard,
+ Vkeyboard_translate_table))))
|| (CHAR_TABLE_P (KVAR (current_kboard, Vkeyboard_translate_table))
&& CHARACTERP (c)))
{
save the echo area contents for it to refer to. */
if (INTEGERP (c)
&& ! NILP (Vinput_method_function)
- && (unsigned) XINT (c) >= ' '
- && (unsigned) XINT (c) != 127
- && (unsigned) XINT (c) < 256)
+ && ' ' <= XINT (c) && XINT (c) < 256 && XINT (c) != 127)
{
previous_echo_area_message = Fcurrent_message ();
Vinput_method_previous_message = previous_echo_area_message;
/* Don't run the input method within a key sequence,
after the first event of the key sequence. */
&& NILP (prev_event)
- && (unsigned) XINT (c) >= ' '
- && (unsigned) XINT (c) != 127
- && (unsigned) XINT (c) < 256)
+ && ' ' <= XINT (c) && XINT (c) < 256 && XINT (c) != 127)
{
Lisp_Object keys;
int key_count, key_count_reset;
if (INTEGERP (c))
{
if (XUINT (c) < 0x100)
- putc (XINT (c), dribble);
+ putc (XUINT (c), dribble);
else
- fprintf (dribble, " 0x%x", (int) XUINT (c));
+ fprintf (dribble, " 0x%"pI"x", XUINT (c));
}
else
{
\f
/* Clear input event EVENT. */
-static INLINE void
+static inline void
clear_event (struct input_event *event)
{
event->kind = NO_EVENT;
Lisp_Object bar_window;
enum scroll_bar_part part;
Lisp_Object x, y;
- unsigned long t;
+ Time t;
*kbp = current_kboard;
/* Note that this uses F to determine which terminal to look at.
timer = XCAR (timers);
- if (!VECTORP (timer) || XVECTOR (timer)->size != 8)
+ if (!VECTORP (timer) || ASIZE (timer) != 8)
continue;
XVECTOR (timer)->contents[0] = Qnil;
}
if (CONSP (timers))
{
timer = XCAR (timers);
- if (!VECTORP (timer) || XVECTOR (timer)->size != 8)
+ if (!VECTORP (timer) || ASIZE (timer) != 8)
{
timers = XCDR (timers);
continue;
if (CONSP (idle_timers))
{
timer = XCAR (idle_timers);
- if (!VECTORP (timer) || XVECTOR (timer)->size != 8)
+ if (!VECTORP (timer) || ASIZE (timer) != 8)
{
idle_timers = XCDR (idle_timers);
continue;
static int last_mouse_button;
static int last_mouse_x;
static int last_mouse_y;
-static unsigned long button_down_time;
+static Time button_down_time;
/* The number of clicks in this multiple-click. */
static Lisp_Object
make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
- unsigned long t)
+ Time t)
{
enum window_part part;
Lisp_Object posn = Qnil;
Qfunction_key,
KVAR (current_kboard, Vsystem_key_alist),
0, &KVAR (current_kboard, system_key_syms),
- (unsigned) -1);
+ TYPE_MAXIMUM (EMACS_INT));
}
return modify_event_symbol (event->code - FUNCTION_KEY_OFFSET,
&& (event->modifiers & down_modifier))
{
Lisp_Object items, item;
- int i;
/* Find the menu bar item under `column'. */
item = Qnil;
items = FRAME_MENU_BAR_ITEMS (f);
- for (i = 0; i < XVECTOR (items)->size; i += 4)
+ for (i = 0; i < ASIZE (items); i += 4)
{
Lisp_Object pos, string;
string = AREF (items, i + 1);
&& (eabs (XINT (event->y) - last_mouse_y) <= fuzz)
&& button_down_time != 0
&& (EQ (Vdouble_click_time, Qt)
- || (INTEGERP (Vdouble_click_time)
- && ((int)(event->timestamp - button_down_time)
- < XINT (Vdouble_click_time)))));
+ || (NATNUMP (Vdouble_click_time)
+ && (event->timestamp - button_down_time
+ < XFASTINT (Vdouble_click_time)))));
}
last_mouse_button = button;
Qmouse_click, Vlispy_mouse_stem,
NULL,
&mouse_syms,
- XVECTOR (mouse_syms)->size);
+ ASIZE (mouse_syms));
if (event->modifiers & drag_modifier)
return Fcons (head,
Fcons (start_pos,
&& (eabs (XINT (event->y) - last_mouse_y) <= fuzz)
&& button_down_time != 0
&& (EQ (Vdouble_click_time, Qt)
- || (INTEGERP (Vdouble_click_time)
- && ((int)(event->timestamp - button_down_time)
- < XINT (Vdouble_click_time)))));
+ || (NATNUMP (Vdouble_click_time)
+ && (event->timestamp - button_down_time
+ < XFASTINT (Vdouble_click_time)))));
if (is_double)
{
double_click_count++;
Qmouse_click,
Vlispy_mouse_stem,
NULL, &mouse_syms,
- XVECTOR (mouse_syms)->size);
+ ASIZE (mouse_syms));
return Fcons (head, Fcons (position, Qnil));
}
Qmouse_click, Vlispy_mouse_stem,
NULL,
&mouse_syms,
- XVECTOR (mouse_syms)->size);
+ ASIZE (mouse_syms));
if (event->modifiers & drag_modifier)
return Fcons (head,
static Lisp_Object
make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part,
- Lisp_Object x, Lisp_Object y, unsigned long t)
+ Lisp_Object x, Lisp_Object y, Time t)
{
/* Is it a scroll bar movement? */
if (frame && ! NILP (bar_window))
Lisp_Object parsed;
parsed = parse_modifiers (symbol);
- return apply_modifiers ((int) XINT (XCAR (XCDR (parsed))),
+ return apply_modifiers (XFASTINT (XCAR (XCDR (parsed))),
XCAR (parsed));
}
static Lisp_Object
modify_event_symbol (EMACS_INT symbol_num, unsigned int modifiers, Lisp_Object symbol_kind,
Lisp_Object name_alist_or_stem, const char *const *name_table,
- Lisp_Object *symbol_table, unsigned int table_size)
+ Lisp_Object *symbol_table, EMACS_INT table_size)
{
Lisp_Object value;
Lisp_Object symbol_int;
else
{
if (! VECTORP (*symbol_table)
- || XVECTOR (*symbol_table)->size != table_size)
+ || ASIZE (*symbol_table) != table_size)
{
Lisp_Object size;
{
int len = SBYTES (name_alist_or_stem);
char *buf = (char *) alloca (len + 50);
- sprintf (buf, "%s-%ld", SDATA (name_alist_or_stem),
- (long) XINT (symbol_int) + 1);
+ sprintf (buf, "%s-%"pI"d", SDATA (name_alist_or_stem),
+ XINT (symbol_int) + 1);
value = intern (buf);
}
else if (name_table != 0 && name_table[symbol_num])
if (NILP (value))
{
char buf[20];
- sprintf (buf, "key-%ld", (long)symbol_num);
+ sprintf (buf, "key-%"pI"d", symbol_num);
value = intern (buf);
}
{
int old_errno = errno;
struct user_signal_info *p;
+ const char *special_event_name = NULL;
SIGNAL_THREAD_CHECK (sig);
+ if (SYMBOLP (Vdebug_on_event))
+ special_event_name = SSDATA (SYMBOL_NAME (Vdebug_on_event));
+
for (p = user_signals; p; p = p->next)
if (p->sig == sig)
{
+ if (special_event_name &&
+ strcmp (special_event_name, p->name) == 0)
+ {
+ /* Enter the debugger in many ways. */
+ debug_on_next_call = 1;
+ debug_on_quit = 1;
+ Vquit_flag = Qt;
+ Vinhibit_quit = Qnil;
+
+ /* Eat the event. */
+ break;
+ }
+
p->npending++;
#ifdef SIGIO
if (interrupt_input)
if (CONSP (def))
{
menu_bar_one_keymap_changed_items = Qnil;
- map_keymap (def, menu_bar_item, Qnil, NULL, 1);
+ map_keymap_canonical (def, menu_bar_item, Qnil, NULL);
}
}
/* Add nil, nil, nil, nil at the end. */
{
int i = menu_bar_items_index;
- if (i + 4 > XVECTOR (menu_bar_items_vector)->size)
+ if (i + 4 > ASIZE (menu_bar_items_vector))
menu_bar_items_vector =
larger_vector (menu_bar_items_vector, 2 * i, Qnil);
/* Add this item. */
if (i == menu_bar_items_index)
{
/* If vector is too small, get a bigger one. */
- if (i + 4 > XVECTOR (menu_bar_items_vector)->size)
+ if (i + 4 > ASIZE (menu_bar_items_vector))
menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil);
/* Add this item. */
XVECTOR (menu_bar_items_vector)->contents[i++] = key;
/* If we got no definition, this item is just unselectable text which
is OK in a submenu but not in the menubar. */
if (NILP (def))
- return (inmenubar ? 0 : 1);
+ return (!inmenubar);
/* See if this is a separate pane or a submenu. */
def = AREF (item_properties, ITEM_PROPERTY_DEF);
/* The symbols `:image' and `:rtl'. */
static Lisp_Object QCimage;
-static Lisp_Object Qrtl;
+static Lisp_Object QCrtl;
/* Function prototypes. */
/* `:label LABEL-STRING'. */
PROP (TOOL_BAR_ITEM_LABEL) = STRINGP (value)
? value
- : make_string (bad_label, strlen (bad_label));
+ : build_string (bad_label);
have_label = 1;
}
else if (EQ (ikey, QCfilter))
}
else if (EQ (ikey, QCimage)
&& (CONSP (value)
- || (VECTORP (value) && XVECTOR (value)->size == 4)))
+ || (VECTORP (value) && ASIZE (value) == 4)))
/* Value is either a single image specification or a vector
of 4 such specifications for the different button states. */
PROP (TOOL_BAR_ITEM_IMAGES) = value;
- else if (EQ (ikey, Qrtl))
+ else if (EQ (ikey, QCrtl))
/* ':rtl STRING' */
PROP (TOOL_BAR_ITEM_RTL_IMAGE) = value;
}
else
label = "";
- new_lbl = Fupcase_initials (make_string (label, strlen (label)));
+ new_lbl = Fupcase_initials (build_string (label));
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);
- free (buf);
+ xfree (buf);
}
/* If got a filter apply it on binding. */
/* Enlarge tool_bar_items_vector if necessary. */
if (ntool_bar_items + TOOL_BAR_ITEM_NSLOTS
- >= XVECTOR (tool_bar_items_vector)->size)
+ >= ASIZE (tool_bar_items_vector))
tool_bar_items_vector
= larger_vector (tool_bar_items_vector,
- 2 * XVECTOR (tool_bar_items_vector)->size, Qnil);
+ 2 * ASIZE (tool_bar_items_vector), Qnil);
/* Append entries from tool_bar_item_properties to the end of
tool_bar_items_vector. */
}
/* Move past this element. */
- if (idx >= 0 && idx + 1 >= XVECTOR (vector)->size)
+ if (idx >= 0 && idx + 1 >= ASIZE (vector))
/* Handle reaching end of dense table. */
idx = -1;
if (idx >= 0)
/* Treat uppercase keys as shifted. */
|| (INTEGERP (key)
&& (KEY_TO_CHAR (key)
- < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->size)
+ < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->header.size)
&& uppercasep (KEY_TO_CHAR (key))))
{
Lisp_Object new_key
this_single_command_key_start = 0;
keys = XVECTOR (saved_keys)->contents;
- for (i = 0; i < XVECTOR (saved_keys)->size; i++)
+ for (i = 0; i < ASIZE (saved_keys); i++)
add_command_key (keys[i]);
for (i = 0; i < SCHARS (function); i++)
if (NILP (keep_record))
{
- for (i = 0; i < XVECTOR (recent_keys)->size; ++i)
+ for (i = 0; i < ASIZE (recent_keys); ++i)
XVECTOR (recent_keys)->contents[i] = Qnil;
total_keys = 0;
recent_keys_index = 0;
DEFUN ("open-dribble-file", Fopen_dribble_file, Sopen_dribble_file, 1, 1,
"FOpen dribble file: ",
doc: /* Start writing all keyboard characters to a dribble file called FILE.
-If FILE is nil, close any open dribble file. */)
+If FILE is nil, close any open dribble file.
+The file will be closed when Emacs exits. */)
(Lisp_Object file)
{
if (dribble)
/* Tool-bars. */
DEFSYM (QCimage, ":image");
DEFSYM (Qhelp_echo, "help-echo");
- DEFSYM (Qrtl, ":rtl");
+ DEFSYM (QCrtl, ":rtl");
staticpro (&item_properties);
item_properties = Qnil;
DEFSYM (Qpre_command_hook, "pre-command-hook");
DEFSYM (Qpost_command_hook, "post-command-hook");
DEFSYM (Qdeferred_action_function, "deferred-action-function");
+ DEFSYM (Qdelayed_warnings_hook, "delayed-warnings-hook");
DEFSYM (Qfunction_key, "function-key");
DEFSYM (Qmouse_click, "mouse-click");
DEFSYM (Qdrag_n_drop, "drag-n-drop");
whenever `deferred-action-list' is non-nil. */);
Vdeferred_action_function = Qnil;
+ DEFVAR_LISP ("delayed-warnings-list", Vdelayed_warnings_list,
+ doc: /* List of warnings to be displayed as soon as possible.
+Each element must be a list (TYPE MESSAGE [LEVEL [BUFFER-NAME]]),
+as per the args of `display-warning' (which see).
+If this variable is non-nil, `delayed-warnings-hook' will be run
+immediately after running `post-command-hook'. */);
+ Vdelayed_warnings_list = Qnil;
+
DEFVAR_LISP ("suggest-key-bindings", Vsuggest_key_bindings,
doc: /* *Non-nil means show the equivalent key-binding when M-x command has one.
The value can be a length of time to show the message for.
`deactivate-mark' call uses this to set the window selection. */);
Vsaved_region_selection = Qnil;
+ DEFVAR_LISP ("debug-on-event",
+ Vdebug_on_event,
+ doc: /* Enter debugger on this event. When Emacs
+receives the special event specifed by this variable, it will try to
+break into the debugger as soon as possible instead of processing the
+event normally through `special-event-map'.
+
+Currently, the only supported values for this
+variable are `sigusr1' and `sigusr2'. */);
+ Vdebug_on_event = intern_c_string ("sigusr2");
+
/* Create the initial keyboard. */
initial_kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
init_kboard (initial_kboard);