** Selection changes.
-The way Emacs interacts with the clipboard and primary selection, by
-default, is now similar to other X applications. In particular, kill
-and yank use the clipboard, in addition to the primary selection.
+The default handling of clipboard and primary selections has been
+changed to conform with other X applications.
-*** `select-active-regions' now defaults to `lazy'.
-This means that any active region made with shift-selection or mouse
-dragging, or acted on by Emacs (e.g. with M-w or C-w), is
-automatically added to the primary window selection.
+*** `select-active-regions' now defaults to t, so active regions set
+the primary selection.
+
+It also accepts a new value, `lazy', which means to only set the
+primary selection for temporarily active regions (usually made by
+mouse-dragging or shift-selection).
+
+*** `mouse-2' is now bound to `mouse-yank-primary'.
*** `x-select-enable-clipboard' now defaults to t.
+Thus, killing and yanking now use the clipboard (in addition to the
+kill ring).
*** `x-select-enable-primary' now defaults to nil.
*** `mouse-drag-copy-region' now defaults to nil.
-*** `mouse-2' is now bound to `mouse-yank-primary'.
-
\f
* Changes in Specialized Modes and Packages in Emacs 24.1
Lisp_Object Qinhibit_modification_hooks;
-extern Lisp_Object Vselect_active_regions, Vsaved_region_selection;
+extern Lisp_Object Vselect_active_regions, Vsaved_region_selection, Qonly;
\f
/* Check all markers in the current buffer, looking for something invalid. */
#endif /* not CLASH_DETECTION */
/* If `select-active-regions' is non-nil, save the region text. */
- if (!NILP (Vselect_active_regions)
- && !NILP (current_buffer->mark_active)
- && !NILP (Vtransient_mark_mode)
- && NILP (Vsaved_region_selection))
+ if (!NILP (current_buffer->mark_active)
+ && NILP (Vsaved_region_selection)
+ && (EQ (Vselect_active_regions, Qonly)
+ ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
+ : (!NILP (Vselect_active_regions)
+ && !NILP (Vtransient_mark_mode))))
{
int b = XINT (Fmarker_position (current_buffer->mark));
int e = XINT (make_number (PT));
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;
Lisp_Object Qself_insert_command;
Lisp_Object Qforward_char;
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 (EQ (Vselect_active_regions, Qonly)
+ ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
+ : (!NILP (Vselect_active_regions)
+ && !NILP (Vtransient_mark_mode)))
+ {
+ 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));
+ /* Don't set empty selections. */
+ }
+
+ if (current_buffer != prev_buffer || MODIFF != prev_modiff)
+ call1 (Vrun_hooks, intern ("activate-mark-hook"));
+ }
Vsaved_region_selection = Qnil;
}
staticpro (&Qx_set_selection);
QPRIMARY = intern_c_string ("PRIMARY");
staticpro (&QPRIMARY);
- Qlazy = intern_c_string ("lazy");
- staticpro (&Qlazy);
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,