Lisp_Object meta_prefix_char;
/* Last size recorded for a current buffer which is not a minibuffer. */
-static int last_non_minibuf_size;
+static EMACS_INT last_non_minibuf_size;
/* Number of idle seconds before an auto-save and garbage collection. */
static Lisp_Object Vauto_save_timeout;
Lisp_Object Vthis_original_command;
/* The value of point when the last command was started. */
-int last_point_position;
+EMACS_INT last_point_position;
/* The buffer that was current when the last command was started. */
Lisp_Object last_point_position_buffer;
Used by the `select-active-regions' feature. */
Lisp_Object Vsaved_region_selection;
-Lisp_Object Qx_set_selection, QPRIMARY, Qlazy;
+Lisp_Object Qx_set_selection, QPRIMARY, Qhandle_switch_frame;
Lisp_Object Qself_insert_command;
Lisp_Object Qforward_char;
Lisp_Object, Lisp_Object,
unsigned long);
#endif
-static Lisp_Object modify_event_symbol (int, unsigned, Lisp_Object,
+static Lisp_Object modify_event_symbol (EMACS_INT, unsigned, Lisp_Object,
Lisp_Object, const char **,
Lisp_Object *, unsigned);
static Lisp_Object make_lispy_switch_frame (Lisp_Object);
switches frames while entering a key sequence. */
static void
-echo_truncate (int nchars)
+echo_truncate (EMACS_INT nchars)
{
if (STRINGP (current_kboard->echo_string))
current_kboard->echo_string
static int read_key_sequence (Lisp_Object *, int, Lisp_Object,
int, int, int);
void safe_run_hooks (Lisp_Object);
-static void adjust_point_for_property (int, int);
+static void adjust_point_for_property (EMACS_INT, int);
/* Cancel hourglass from protect_unwind.
ARG is not used. */
}
#endif
+/* 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, ... */
+EXFUN (Fwindow_system, 1);
+
Lisp_Object
command_loop_1 (void)
{
Vtransient_mark_mode = Qnil;
else if (EQ (Vtransient_mark_mode, Qonly))
Vtransient_mark_mode = Qidentity;
- else if (EQ (Vselect_active_regions, Qlazy)
- ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
- : (!NILP (Vselect_active_regions)
- && !NILP (Vtransient_mark_mode)))
- {
- /* Set window selection. If `select-active-regions' is
- `lazy', only do it for temporarily active regions. */
- int beg = XINT (Fmarker_position (current_buffer->mark));
- int end = XINT (make_number (PT));
- if (beg < end)
- call2 (Qx_set_selection, QPRIMARY,
- make_buffer_string (beg, end, 0));
- else if (beg > end)
- call2 (Qx_set_selection, QPRIMARY,
- make_buffer_string (end, beg, 0));
- }
if (!NILP (Vdeactivate_mark))
+ /* If `select-active-regions' is non-nil, this call to
+ `deactivate-mark' also sets the PRIMARY selection. */
call0 (Qdeactivate_mark);
- else if (current_buffer != prev_buffer || MODIFF != prev_modiff)
- call1 (Vrun_hooks, intern ("activate-mark-hook"));
+ else
+ {
+ /* Even if not deactivating the mark, set PRIMARY if
+ `select-active-regions' is non-nil. */
+ if (!NILP (Fwindow_system (Qnil))
+ && (EQ (Vselect_active_regions, Qonly)
+ ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
+ : (!NILP (Vselect_active_regions)
+ && !NILP (Vtransient_mark_mode)))
+ && !EQ (Vthis_command, Qhandle_switch_frame))
+ {
+ EMACS_INT beg =
+ XINT (Fmarker_position (current_buffer->mark));
+ EMACS_INT end = PT;
+ if (beg < end)
+ call2 (Qx_set_selection, QPRIMARY,
+ make_buffer_string (beg, end, 0));
+ else if (beg > end)
+ call2 (Qx_set_selection, QPRIMARY,
+ make_buffer_string (end, beg, 0));
+ /* Don't set empty selections. */
+ }
+
+ if (current_buffer != prev_buffer || MODIFF != prev_modiff)
+ call1 (Vrun_hooks, intern ("activate-mark-hook"));
+ }
Vsaved_region_selection = Qnil;
}
LAST_PT is the last position of point. */
static void
-adjust_point_for_property (int last_pt, int modified)
+adjust_point_for_property (EMACS_INT last_pt, int modified)
{
EMACS_INT beg, end;
Lisp_Object val, overlay, tmp;
user can keep inserting another character at point or keep
deleting characters around point. */
int check_composition = ! modified, check_display = 1, check_invisible = 1;
- int orig_pt = PT;
+ EMACS_INT orig_pt = PT;
/* FIXME: cycling is probably not necessary because these properties
can't be usefully combined anyway. */
if (INTERACTIVE && NILP (c))
{
- int delay_level, buffer_size;
+ int delay_level;
+ EMACS_INT buffer_size;
/* Slow down auto saves logarithmically in size of current buffer,
and garbage collect while we're at it. */
static int
readable_events (int flags)
{
-#ifdef HAVE_DBUS
- /* Check whether a D-Bus message has arrived. */
- if (xd_pending_messages () > 0)
- return 1;
-#endif /* HAVE_DBUS */
-
if (flags & READABLE_EVENTS_DO_TIMERS_NOW)
timer_check (1);
}
-/* Generate HELP_EVENT input_events in BUFP which has room for
- SIZE events. If there's not enough room in BUFP, ignore this
- event.
+/* Generate a HELP_EVENT input_event and store it in the keyboard
+ buffer.
HELP is the help form.
- FRAME is the frame on which the help is generated. OBJECT is the
- Lisp object where the help was found (a buffer, a string, an
- overlay, or nil if neither from a string nor from a buffer. POS is
- the position within OBJECT where the help was found.
-
- Value is the number of input_events generated. */
+ FRAME and WINDOW are the frame and window where the help is
+ generated. OBJECT is the Lisp object where the help was found (a
+ buffer, a string, an overlay, or nil if neither from a string nor
+ from a buffer). POS is the position within OBJECT where the help
+ was found. */
void
gen_help_event (Lisp_Object help, Lisp_Object frame, Lisp_Object window,
- Lisp_Object object, int pos)
+ Lisp_Object object, EMACS_INT pos)
{
struct input_event event;
/* It's a click in window window at frame coordinates (x,y) */
struct window *w = XWINDOW (window);
Lisp_Object string_info = Qnil;
- int textpos = -1, rx = -1, ry = -1;
+ EMACS_INT textpos = -1;
+ int rx = -1, ry = -1;
int dx = -1, dy = -1;
int width = -1, height = -1;
Lisp_Object object = Qnil;
/* Mode line or header line. Look for a string under
the mouse that may have a `local-map' property. */
Lisp_Object string;
- int charpos;
+ EMACS_INT charpos;
posn = part == ON_MODE_LINE ? Qmode_line : Qheader_line;
rx = wx, ry = wy;
else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN)
{
Lisp_Object string;
- int charpos;
+ EMACS_INT charpos;
posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin;
rx = wx, ry = wy;
case MULTIBYTE_CHAR_KEYSTROKE_EVENT:
{
Lisp_Object lispy_c;
- int c = event->code;
+ EMACS_INT c = event->code;
if (event->kind == ASCII_KEYSTROKE_EVENT)
{
c &= 0377;
in the symbol's name. */
static Lisp_Object
-modify_event_symbol (int symbol_num, unsigned int modifiers, Lisp_Object symbol_kind,
+modify_event_symbol (EMACS_INT symbol_num, unsigned int modifiers, Lisp_Object symbol_kind,
Lisp_Object name_alist_or_stem, const char **name_table,
Lisp_Object *symbol_table, unsigned int table_size)
{
if (NILP (value))
{
char buf[20];
- sprintf (buf, "key-%d", symbol_num);
+ sprintf (buf, "key-%ld", (long)symbol_num);
value = intern (buf);
}
void
gobble_input (int expected)
{
-#ifdef HAVE_DBUS
- /* Read D-Bus messages. */
- xd_read_queued_messages ();
-#endif /* HAVE_DBUS */
-
#ifdef SIGIO
if (interrupt_input)
{
{
const char *bad_label = "!!?GARBLED ITEM?!!";
/* `:label LABEL-STRING'. */
- PROP (TOOL_BAR_ITEM_HELP) = STRINGP (value)
+ PROP (TOOL_BAR_ITEM_LABEL) = STRINGP (value)
? value
: make_string (bad_label, strlen (bad_label));
have_label = 1;
(Lisp_Object prefixarg)
{
Lisp_Object function;
- char buf[40];
- int saved_last_point_position;
+ EMACS_INT saved_last_point_position;
Lisp_Object saved_keys, saved_last_point_position_buffer;
Lisp_Object bindings, value;
struct gcpro gcpro1, gcpro2, gcpro3;
#ifdef HAVE_WINDOW_SYSTEM
- /* The call to Fcompleting_read wil start and cancel the hourglass,
+ /* The call to Fcompleting_read will start and cancel the hourglass,
but if the hourglass was already scheduled, this means that no
hourglass will be shown for the actual M-x command itself.
So we restart it if it is already scheduled. Note that checking
XVECTOR (this_command_keys)->contents);
saved_last_point_position_buffer = last_point_position_buffer;
saved_last_point_position = last_point_position;
- buf[0] = 0;
GCPRO3 (saved_keys, prefixarg, saved_last_point_position_buffer);
- if (EQ (prefixarg, Qminus))
- strcpy (buf, "- ");
- else if (CONSP (prefixarg) && XINT (XCAR (prefixarg)) == 4)
- strcpy (buf, "C-u ");
- else if (CONSP (prefixarg) && INTEGERP (XCAR (prefixarg)))
- sprintf (buf, "%ld ", (long) XINT (XCAR (prefixarg)));
- else if (INTEGERP (prefixarg))
- sprintf (buf, "%ld ", (long) XINT (prefixarg));
-
- /* This isn't strictly correct if execute-extended-command
- is bound to anything else. Perhaps it should use
- this_command_keys? */
- strcat (buf, "M-x ");
-
- /* Prompt with buf, and then read a string, completing from and
- restricting to the set of all defined commands. Don't provide
- any initial input. Save the command read on the extended-command
- history list. */
- function = Fcompleting_read (build_string (buf),
- Vobarray, Qcommandp,
- Qt, Qnil, Qextended_command_history, Qnil,
- Qnil);
+ function = call0 (intern ("read-extended-command"));
#ifdef HAVE_WINDOW_SYSTEM
if (hstarted) start_hourglass ();
if (STRINGP (stuffstring))
{
- register int count;
+ register EMACS_INT count;
p = SDATA (stuffstring);
count = SBYTES (stuffstring);
Emacs on SIGINT when there are no termcap frames on the
controlling terminal. */
signal (SIGINT, interrupt_signal);
-#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
+#ifndef DOS_NT
/* For systems with SysV TERMIO, C-g is set up for both SIGINT and
SIGQUIT and we can't tell which one it will give us. */
signal (SIGQUIT, interrupt_signal);
-#endif /* HAVE_TERMIO */
+#endif /* not DOS_NT */
}
/* Note SIGIO has been undef'd if FIONREAD is missing. */
#ifdef SIGIO
staticpro (&Qx_set_selection);
QPRIMARY = intern_c_string ("PRIMARY");
staticpro (&QPRIMARY);
- Qlazy = intern_c_string ("lazy");
- staticpro (&Qlazy);
+ Qhandle_switch_frame = intern_c_string ("handle-switch-frame");
+ staticpro (&Qhandle_switch_frame);
Qinput_method_exit_on_first_char = intern_c_string ("input-method-exit-on-first-char");
staticpro (&Qinput_method_exit_on_first_char);
DEFVAR_LISP ("select-active-regions",
&Vselect_active_regions,
doc: /* If non-nil, an active region automatically becomes the window selection.
-This takes effect only when Transient Mark mode is enabled.
-
-If the value is `lazy', Emacs only sets the window selection during
-`deactivate-mark'; unless the region is temporarily active
-(e.g. mouse-drags or shift-selection), in which case it sets the
-window selection after each command.
+If the value is `only', only temporarily active regions (usually made
+by mouse-dragging or shift-selection) set the window selection.
-For other non-nil value, Emacs sets the window selection after every
-command. */);
- Vselect_active_regions = Qlazy;
+This takes effect only when Transient Mark mode is enabled. */);
+ Vselect_active_regions = Qt;
DEFVAR_LISP ("saved-region-selection",
&Vsaved_region_selection,