emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r100822: Change clipboard/primary sel


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r100822: Change clipboard/primary selection to X application standards.
Date: Wed, 14 Jul 2010 14:03:39 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100822
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Wed 2010-07-14 14:03:39 -0400
message:
  Change clipboard/primary selection to X application standards.
  
  * lisp/menu-bar.el (menu-bar-enable-clipboard): Don't overwrite
  Cut/Copy/Paste menu bar items.
  
  * lisp/mouse.el: Bind mouse-2 to mouse-yank-primary.
  (mouse-drag-copy-region): Default to nil.
  
  * lisp/simple.el (select-active-regions): Default to t.
  (push-mark-command): Don't overwrite primary with empty string.
  
  * lisp/term/x-win.el (x-select-enable-clipboard): Default to t.
  (x-initialize-window-system): Don't overwrite Paste menu item.
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/menu-bar.el
  lisp/mouse.el
  lisp/simple.el
  lisp/term/x-win.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2010-07-03 03:16:11 +0000
+++ b/etc/NEWS  2010-07-14 18:03:39 +0000
@@ -173,6 +173,20 @@
 
 *** The option `mouse-region-delete-keys' has been deleted.
 
+** 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 t.
+
+*** `x-select-enable-clipboard' now defaults to t.
+
+*** `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-07-14 16:41:40 +0000
+++ b/lisp/ChangeLog    2010-07-14 18:03:39 +0000
@@ -1,3 +1,17 @@
+2010-07-14  Chong Yidong  <address@hidden>
+
+       * term/x-win.el (x-select-enable-clipboard): Default to t.
+       (x-initialize-window-system): Don't overwrite Paste menu item.
+
+       * simple.el (select-active-regions): Default to t.
+       (push-mark-command): Don't overwrite primary with empty string.
+
+       * mouse.el: Bind mouse-2 to mouse-yank-primary.
+       (mouse-drag-copy-region): Default to nil.
+
+       * menu-bar.el (menu-bar-enable-clipboard): Don't overwrite
+       Cut/Copy/Paste menu bar items.
+
 2010-07-13  Thierry Volpiatto <address@hidden>
 
        Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).

=== modified file 'lisp/menu-bar.el'
--- a/lisp/menu-bar.el  2010-07-05 17:54:13 +0000
+++ b/lisp/menu-bar.el  2010-07-14 18:03:39 +0000
@@ -526,17 +526,6 @@
   "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard.
 Do the same for the keys of the same name."
   (interactive)
-  ;; We can't use constant list structure here because it becomes pure,
-  ;; and because it gets modified with cache data.
-  (define-key menu-bar-edit-menu [paste]
-    (cons "Paste" (cons "Paste text from clipboard" 'clipboard-yank)))
-  (define-key menu-bar-edit-menu [copy]
-    (cons "Copy" (cons "Copy text in region to the clipboard"
-                      'clipboard-kill-ring-save)))
-  (define-key menu-bar-edit-menu [cut]
-    (cons "Cut" (cons "Delete text in region and copy it to the clipboard"
-                     'clipboard-kill-region)))
-
   ;; These are Sun server keysyms for the Cut, Copy and Paste keys
   ;; (also for XFree86 on Sun keyboard):
   (define-key global-map [f20] 'clipboard-kill-region)

=== modified file 'lisp/mouse.el'
--- a/lisp/mouse.el     2010-07-11 22:14:53 +0000
+++ b/lisp/mouse.el     2010-07-14 18:03:39 +0000
@@ -41,7 +41,7 @@
   :type 'boolean
   :group 'mouse)
 
-(defcustom mouse-drag-copy-region t
+(defcustom mouse-drag-copy-region nil
   "If non-nil, mouse drag copies region to kill-ring."
   :type 'boolean
   :version "22.1"
@@ -2443,7 +2443,7 @@
 (global-set-key [left-fringe mouse-1]  'mouse-set-point)
 (global-set-key [right-fringe mouse-1] 'mouse-set-point)
 
-(global-set-key [mouse-2]      'mouse-yank-at-click)
+(global-set-key [mouse-2]      'mouse-yank-primary)
 ;; Allow yanking also when the corresponding cursor is "in the fringe".
 (global-set-key [right-fringe mouse-2] 'mouse-yank-at-click)
 (global-set-key [left-fringe mouse-2] 'mouse-yank-at-click)

=== modified file 'lisp/simple.el'
--- a/lisp/simple.el    2010-07-13 10:41:49 +0000
+++ b/lisp/simple.el    2010-07-14 18:03:39 +0000
@@ -3666,7 +3666,7 @@
       (marker-position (mark-marker))
     (signal 'mark-inactive nil)))
 
-(defcustom select-active-regions nil
+(defcustom select-active-regions t
   "If non-nil, an active region automatically becomes the window selection."
   :type 'boolean
   :group 'killing
@@ -3687,6 +3687,7 @@
         mark-active
         (display-selections-p)
         (x-selection-owner-p 'PRIMARY)
+        (not (eq (region-beginning) (region-end)))
         (x-set-selection 'PRIMARY (buffer-substring-no-properties
                                    (region-beginning) (region-end))))
     (if (and (null force)
@@ -3819,6 +3820,8 @@
        (push-mark nil nomsg t)
       (setq mark-active t)
       (run-hooks 'activate-mark-hook)
+      (and select-active-regions (display-selections-p)
+          (x-set-selection 'PRIMARY (current-buffer)))
       (unless nomsg
        (message "Mark activated")))))
 

=== modified file 'lisp/term/x-win.el'
--- a/lisp/term/x-win.el        2010-01-18 04:39:40 +0000
+++ b/lisp/term/x-win.el        2010-07-14 18:03:39 +0000
@@ -1219,13 +1219,9 @@
   "Max number of characters to put in the cut buffer.
 It is said that overlarge strings are slow to put into the cut buffer.")
 
-(defcustom x-select-enable-clipboard nil
+(defcustom x-select-enable-clipboard t
   "Non-nil means cutting and pasting uses the clipboard.
-This is in addition to, but in preference to, the primary selection.
-
-On MS-Windows, this is non-nil by default, since Windows does not
-support other types of selections.  \(The primary selection that is
-set by Emacs is not accessible to other programs on Windows.\)"
+This is in addition to, but in preference to, the primary selection."
   :type 'boolean
   :group 'killing)
 
@@ -1560,12 +1556,12 @@
   ;; Enable CLIPBOARD copy/paste through menu bar commands.
   (menu-bar-enable-clipboard)
 
-  ;; Override Paste so it looks at CLIPBOARD first.
-  (define-key menu-bar-edit-menu [paste]
-    (append '(menu-item "Paste" x-clipboard-yank
-                       :enable (not buffer-read-only)
-                       :help "Paste (yank) text most recently cut/copied")
-           nil))
+  ;; ;; Override Paste so it looks at CLIPBOARD first.
+  ;; (define-key menu-bar-edit-menu [paste]
+  ;;   (append '(menu-item "Paste" x-clipboard-yank
+  ;;                   :enable (not buffer-read-only)
+  ;;                   :help "Paste (yank) text most recently cut/copied")
+  ;;       nil))
 
   (setq x-initialized t))
 


reply via email to

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