emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r101094: Let all active regions set t


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101094: Let all active regions set the primary selection.
Date: Sun, 15 Aug 2010 22:33:17 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101094
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sun 2010-08-15 22:33:17 -0400
message:
  Let all active regions set the primary selection.
  This includes both temporarily active regions (mouse drag and
  shift-select) and those made with C-SPC and cursor motion.
  
  * lisp/cus-start.el: Change defcustom for select-active-regions.
  
  * lisp/simple.el (deactivate-mark): If select-active-regions is `only',
  only set selection for temporarily active regions.
  
  * src/insdel.c (prepare_to_modify_buffer): Handle `only' value of
  select-active-regions.
  
  * src/keyboard.c (command_loop_1): Avoid setting selection twice,
  since it's done in deactivate-mark as well.
  (Vselect_active_regions): Replace `lazy' value with `only',
  meaning to only set PRIMARY for temporarily active regions.
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/cus-start.el
  lisp/simple.el
  src/ChangeLog
  src/insdel.c
  src/keyboard.c
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2010-08-14 22:58:10 +0000
+++ b/etc/NEWS  2010-08-16 02:33:17 +0000
@@ -191,23 +191,26 @@
 
 ** 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.
-
-*** `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.
+The default handling of clipboard and primary selections has been
+changed to conform with other X applications.
+
+*** `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'.
-
 
 * Changes in Specialized Modes and Packages in Emacs 24.1
 

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-08-16 02:08:01 +0000
+++ b/lisp/ChangeLog    2010-08-16 02:33:17 +0000
@@ -1,3 +1,10 @@
+2010-08-16  Chong Yidong  <address@hidden>
+
+       * simple.el (deactivate-mark): If select-active-regions is `only',
+       only set selection for temporarily active regions.
+
+       * cus-start.el: Change defcustom for select-active-regions.
+
 2010-08-15  Chong Yidong  <address@hidden>
 
        * mouse.el (mouse--drag-set-mark-and-point): New function.

=== modified file 'lisp/cus-start.el'
--- a/lisp/cus-start.el 2010-08-07 19:39:04 +0000
+++ b/lisp/cus-start.el 2010-08-16 02:33:17 +0000
@@ -198,8 +198,8 @@
             (help-event-list keyboard (repeat (sexp :format "%v")))
             (menu-prompting menu boolean)
             (select-active-regions killing
-                                   (choice (const :tag "lazy" lazy)
-                                           (const :tag "always" t)
+                                   (choice (const :tag "always" t)
+                                           (const :tag "only shift-selection 
or mouse-drag" only)
                                            (const :tag "off" nil))
                                    "24.1")
             (suggest-key-bindings keyboard (choice (const :tag "off" nil)

=== modified file 'lisp/simple.el'
--- a/lisp/simple.el    2010-08-08 21:12:29 +0000
+++ b/lisp/simple.el    2010-08-16 02:33:17 +0000
@@ -3674,7 +3674,9 @@
 Mark mode is disabled.
 This function also runs `deactivate-mark-hook'."
   (when (or transient-mark-mode force)
-    (when (and select-active-regions
+    (when (and (if (eq select-active-regions 'only)
+                  (eq (car-safe transient-mark-mode) 'only)
+                select-active-regions)
               (region-active-p)
               (display-selections-p))
       ;; The var `saved-region-selection', if non-nil, is the text in

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-08-15 13:18:14 +0000
+++ b/src/ChangeLog     2010-08-16 02:33:17 +0000
@@ -1,3 +1,14 @@
+2010-08-16  Chong Yidong  <address@hidden>
+
+       * keyboard.c (command_loop_1): Avoid setting selection twice,
+       since it's done in deactivate-mark as well.
+       (Vselect_active_regions): Change default to t.  Replace `lazy'
+       with non-default value `only', meaning only set PRIMARY for
+       temporarily active regions.
+
+       * insdel.c (prepare_to_modify_buffer): Handle `only' value of
+       select-active-regions.
+
 2010-08-15  Jan Djärv  <address@hidden>
 
        * keyboard.c (parse_tool_bar_item): Put in a bad label if :label

=== modified file 'src/insdel.c'
--- a/src/insdel.c      2010-08-07 20:26:55 +0000
+++ b/src/insdel.c      2010-08-16 02:33:17 +0000
@@ -74,7 +74,7 @@
 
 Lisp_Object Qinhibit_modification_hooks;
 
-extern Lisp_Object Vselect_active_regions, Vsaved_region_selection;
+extern Lisp_Object Vselect_active_regions, Vsaved_region_selection, Qonly;
 
 
 /* Check all markers in the current buffer, looking for something invalid.  */
@@ -2050,10 +2050,12 @@
 #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));

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2010-08-15 13:18:14 +0000
+++ b/src/keyboard.c    2010-08-16 02:33:17 +0000
@@ -368,7 +368,7 @@
    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;
@@ -1790,27 +1790,34 @@
            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;
        }
@@ -11718,8 +11725,6 @@
   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);
@@ -12331,16 +12336,11 @@
   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.
-
-For other non-nil value, Emacs sets the window selection after every
-command.  */);
-  Vselect_active_regions = Qlazy;
+If the value is `only', only temporarily active regions (usually made
+by mouse-dragging or shift-selection) set the window selection.
+
+This takes effect only when Transient Mark mode is enabled.  */);
+  Vselect_active_regions = Qt;
 
   DEFVAR_LISP ("saved-region-selection",
               &Vsaved_region_selection,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]