instead of the actual command. */
Lisp_Object this_command;
+/* The value of point when the last command was executed. */
+int last_point_position;
+
#ifdef MULTI_FRAME
/* The frame in which the last input event occurred, or Qmacro if the
last event came from a macro. We use this to determine when to
if (this_command_key_count >= size)
{
- Lisp_Object new_keys = Fmake_vector (make_number (size * 2), Qnil);
+ Lisp_Object new_keys;
+ new_keys = Fmake_vector (make_number (size * 2), Qnil);
bcopy (XVECTOR (this_command_keys)->contents,
XVECTOR (new_keys)->contents,
size * sizeof (Lisp_Object));
nonundocount = 0;
no_redisplay = 0;
this_command_key_count = 0;
- last_command = this_command;
/* Make sure this hook runs after commands that get errors and
throw to top level. */
- if (!NILP (Vpost_command_hook))
+ if (!NILP (Vpost_command_hook) && !NILP (Vrun_hooks))
{
/* If we get an error during the post-command-hook,
cause post-command-hook to be nil. */
Vpost_command_hook = Vcommand_hook_internal;
}
+ /* Do this after running Vpost_command_hook, for consistency. */
+ last_command = this_command;
+
while (1)
{
/* Install chars successfully executed in kbd macro. */
prev_buffer = current_buffer;
prev_modiff = MODIFF;
+ last_point_position = PT;
/* Execute the command. */
this_command = cmd;
- if (!NILP (Vpre_command_hook))
+ if (!NILP (Vpre_command_hook) && !NILP (Vrun_hooks))
{
/* If we get an error during the pre-command-hook,
cause pre-command-hook to be nil. */
if (dp)
{
- Lisp_Object obj = DISP_CHAR_VECTOR (dp, lose);
+ Lisp_Object obj;
+ obj = DISP_CHAR_VECTOR (dp, lose);
if (XTYPE (obj) == Lisp_Vector
&& XVECTOR (obj)->size == 1
&& (XTYPE (obj = XVECTOR (obj)->contents[0])
}
directly_done: ;
- if (!NILP (Vpost_command_hook))
+ if (!NILP (Vpost_command_hook) && !NILP (Vrun_hooks))
{
/* If we get an error during the post-command-hook,
cause post-command-hook to be nil. */
this_command_key_count = 0;
}
- if (!NILP (current_buffer->mark_active))
+ if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks))
{
if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode))
{
putc (XINT (c), dribble);
else
{
- Lisp_Object dribblee = c;
+ Lisp_Object dribblee;
/* If it's a structured event, take the event header. */
- dribblee = EVENT_HEAD (dribblee);
+ dribblee = EVENT_HEAD (c);
if (XTYPE (dribblee) == Lisp_Symbol)
{
get returned to Emacs as an event, the next event read
will set Vlast_event_frame again, so this is safe to do. */
{
- Lisp_Object focus
- = FRAME_FOCUS_FRAME (XFRAME (event->frame_or_window));
+ Lisp_Object focus;
+ focus = FRAME_FOCUS_FRAME (XFRAME (event->frame_or_window));
if (NILP (focus))
internal_last_event_frame = event->frame_or_window;
else
else
{
#ifdef MULTI_FRAME
- Lisp_Object frame = event->frame_or_window;
+ Lisp_Object frame;
Lisp_Object focus;
+ frame = event->frame_or_window;
if (XTYPE (frame) == Lisp_Window)
frame = WINDOW_FRAME (XWINDOW (frame));
frames. */
if (f)
{
- Lisp_Object frame = FRAME_FOCUS_FRAME (f);
+ Lisp_Object frame;
+ frame = FRAME_FOCUS_FRAME (f);
if (NILP (frame))
XSET (frame, Lisp_Frame, f);
{
/* The third element of every position should be the (x,y)
pair. */
- Lisp_Object down = Fnth (make_number (2), start_pos);
+ Lisp_Object down;
+ down = Fnth (make_number (2), start_pos);
if (EQ (event->x, XCONS (down)->car)
&& EQ (event->y, XCONS (down)->cdr))
{
{
/* Get the symbol we should use for the mouse click. */
- Lisp_Object head
- = modify_event_symbol (button,
- event->modifiers,
- Qmouse_click, Qnil,
- lispy_mouse_names, &mouse_syms,
- (sizeof (lispy_mouse_names)
- / sizeof (lispy_mouse_names[0])));
-
+ Lisp_Object head;
+
+ head = modify_event_symbol (button,
+ event->modifiers,
+ Qmouse_click, Qnil,
+ lispy_mouse_names, &mouse_syms,
+ (sizeof (lispy_mouse_names)
+ / sizeof (lispy_mouse_names[0])));
if (event->modifiers & drag_modifier)
return Fcons (head,
Fcons (start_pos,
/* Is it a scroll bar movement? */
if (frame && ! NILP (bar_window))
{
- Lisp_Object part_sym = *scroll_bar_parts[(int) part];
+ Lisp_Object part_sym;
+ part_sym = *scroll_bar_parts[(int) part];
return Fcons (Qscroll_bar_movement,
(Fcons (Fcons (bar_window,
Fcons (Qvertical_scroll_bar,
}
{
- Lisp_Object new_name = make_uninit_string (mod_len + base_len);
+ Lisp_Object new_name;
+ new_name = make_uninit_string (mod_len + base_len);
bcopy (new_mods, XSTRING (new_name)->data, mod_len);
bcopy (base, XSTRING (new_name)->data + mod_len, base_len);
parse_modifiers (symbol)
Lisp_Object symbol;
{
- Lisp_Object elements = Fget (symbol, Qevent_symbol_element_mask);
+ Lisp_Object elements;
+ elements = Fget (symbol, Qevent_symbol_element_mask);
if (CONSP (elements))
return elements;
else
{
int end;
int modifiers = parse_modifiers_uncached (symbol, &end);
- Lisp_Object unmodified
- = Fintern (make_string (XSYMBOL (symbol)->name->data + end,
- XSYMBOL (symbol)->name->size - end),
- Qnil);
+ Lisp_Object unmodified;
Lisp_Object mask;
+ unmodified = Fintern (make_string (XSYMBOL (symbol)->name->data + end,
+ XSYMBOL (symbol)->name->size - end),
+ Qnil);
+
if (modifiers & ~((1<<VALBITS) - 1))
abort ();
XFASTINT (mask) = modifiers;
Qevent_kind set right as well. */
if (NILP (Fget (new_symbol, Qevent_kind)))
{
- Lisp_Object kind = Fget (base, Qevent_kind);
+ Lisp_Object kind;
+ kind = Fget (base, Qevent_kind);
if (! NILP (kind))
Fput (new_symbol, Qevent_kind, kind);
}
{
/* It's hopefully okay to write the code this way, since everything
will soon be in caches, and no consing will be done at all. */
- Lisp_Object parsed = parse_modifiers (symbol);
+ Lisp_Object parsed;
+ parsed = parse_modifiers (symbol);
return apply_modifiers (XCONS (XCONS (parsed)->cdr)->car,
XCONS (parsed)->car);
}
Fix it for 19.23. */
/* Retry the read if it is interrupted. */
if (nread >= 0
-#ifdef EFAULT
- || ! (errno == EAGAIN || errno == EFAULT
-#else
|| ! (errno == EAGAIN
+#ifdef EFAULT
+ || errno == EFAULT
#endif
#ifdef EBADSLT
|| errno == EBADSLT
or when user programs play with this-command-keys. */
if (EVENT_HAS_PARAMETERS (key))
{
- Lisp_Object kind = EVENT_HEAD_KIND (EVENT_HEAD (key));
+ Lisp_Object kind;
+ kind = EVENT_HEAD_KIND (EVENT_HEAD (key));
if (EQ (kind, Qmouse_click))
{
- Lisp_Object window = POSN_WINDOW (EVENT_START (key));
- Lisp_Object posn = POSN_BUFFER_POSN (EVENT_START (key));
+ Lisp_Object window, posn;
+ window = POSN_WINDOW (EVENT_START (key));
+ posn = POSN_BUFFER_POSN (EVENT_START (key));
if (XTYPE (posn) == Lisp_Cons)
{
/* We're looking at the second event of a
}
else
{
- Lisp_Object posn = POSN_BUFFER_POSN (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))
if (t + 1 >= bufsize)
error ("key sequence too long");
/* Run the Lucid hook. */
- call1 (Vrun_hooks, Qactivate_menubar_hook);
+ if (!NILP (Vrun_hooks))
+ call1 (Vrun_hooks, Qactivate_menubar_hook);
/* If it has changed current-menubar from previous value,
really recompute the menubar from the value. */
if (! NILP (Vlucid_menu_bar_dirty_flag))
/* If KEY wasn't bound, we'll try some fallbacks. */
if (first_binding >= nmaps)
{
- Lisp_Object head = EVENT_HEAD (key);
+ Lisp_Object head;
+ head = EVENT_HEAD (key);
if (EQ (head, Vhelp_char))
{
read_key_sequence_cmd = Vprefix_help_command;
if (XTYPE (head) == Lisp_Symbol)
{
- Lisp_Object breakdown = parse_modifiers (head);
- int modifiers = XINT (XCONS (XCONS (breakdown)->cdr)->car);
+ Lisp_Object breakdown;
+ int modifiers;
+ breakdown = parse_modifiers (head);
+ modifiers = XINT (XCONS (XCONS (breakdown)->cdr)->car);
/* Attempt to reduce an unbound mouse event to a simpler
event that is bound:
Drags reduce to clicks.
if (XTYPE (cmd) == Lisp_Symbol)
{
tem = Fget (cmd, Qdisabled);
- if (!NILP (tem))
+ if (!NILP (tem) && !NILP (Vrun_hooks))
return call1 (Vrun_hooks, Qdisabled_command_hook);
}