Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1494128
 поиск   регистрация   авторизация 
 
Группа :: Редакторы
Пакет: emacs21

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

Патч: emacs-21.3-alt3-clipboard.patch


Hardcode modifications that make Emacs behave like a normal program
in what concerns cut-n-paste operations:
- cut-n-paste to the X *clipbaord*, not the primary/secondary selections
  (as described at http://www.freedesktop.org/standards/clipboards.txt);
  the primary (and secondary) selections can be manipulated by the mouse
  (primary selection manipulation is done as in Mozilla).
mouse-sel.al (some alternative mouse selection bindings) has been modified
to match best the rest of our Emacs: now there is no need to undefine the
interprogram cut/paste functions since their work doesn't interfere with
primary X selection manipulate by mouse-sel.el (they work with X clipboard).
(Since 21.3, Emacs uses the standard CTEXT with extensions 
encoding for passing the selection to X. We used to pathc it for this before.)
imz@altlinux.ru, Apr 2003.
--- emacs-21.2/lisp/term/x-win.el.orig	Mon Apr  8 05:21:42 2002
+++ emacs-21.2/lisp/term/x-win.el	Mon Apr  8 05:25:13 2002
@@ -1175,9 +1175,14 @@
 (defvar x-cut-buffer-max 20000
   "Max number of characters to put in 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."
+This is in addition to, but in preference to, the primary selection.
+
+The default value changed to non-nil by ALT (in GNU release it was nil), 
+because clipboard selection
+management scheme is considered to be more consistent with other desktop
+components. (Read #795 at bugs.altlinux.ru for details.) (April 2002)"
   :type 'boolean
   :group 'killing)
 
--- 21.2/lisp/mouse.el.clipboard	2002-11-11 22:19:41 +0300
+++ 21.2/lisp/mouse.el	2002-11-16 19:06:12 +0300
@@ -590,7 +590,7 @@
     ;; Don't set this-command to kill-region, so that a following
     ;; C-w will not double the text in the kill ring.
     ;; Ignore last-command so we don't append to a preceding kill.
-    (let (this-command last-command deactivate-mark)
+    (let (this-command last-command deactivate-mark x-select-enable-clipboard)
       (copy-region-as-kill (mark) (point)))
     (mouse-set-region-1)))
 
@@ -788,7 +788,7 @@
 		  (push-mark region-commencement t t)
 		  (goto-char region-termination)
 		  ;; Don't let copy-region-as-kill set deactivate-mark.
-		  (let (deactivate-mark)
+		  (let (deactivate-mark x-select-enable-clipboard)
 		    (copy-region-as-kill (point) (mark t)))
 		  (let ((buffer (current-buffer)))
 		    (mouse-show-mark)
@@ -1029,8 +1029,9 @@
 	 (click-posn (posn-point posn)))
     (select-window (posn-window posn))
     (if (numberp click-posn)
-	(kill-region (min (point) click-posn)
-		     (max (point) click-posn)))))
+	(let (x-select-enable-clipboard)
+	  (kill-region (min (point) click-posn)
+		       (max (point) click-posn))))))
 
 (defun mouse-yank-at-click (click arg)
   "Insert the last stretch of killed text at the position clicked on.
@@ -1045,14 +1046,15 @@
   (or mouse-yank-at-point (mouse-set-point click))
   (setq this-command 'yank)
   (setq mouse-selection-click-count 0)
-  (yank arg))
+  (let (x-select-enable-clipboard)
+    (yank arg)))
 
 (defun mouse-kill-ring-save (click)
   "Copy the region between point and the mouse click in the kill ring.
 This does not delete the region; it acts like \\[kill-ring-save]."
   (interactive "e")
   (mouse-set-mark-fast click)
-  (let (this-command last-command)
+  (let (this-command last-command x-select-enable-clipboard)
     (kill-ring-save (point) (mark t)))
   (mouse-show-mark))
 
@@ -1117,7 +1119,7 @@
     (let ((click-posn (posn-point (event-start click)))
 	  ;; Don't let a subsequent kill command append to this one:
 	  ;; prevent setting this-command to kill-region.
-	  (this-command this-command))
+	  (this-command this-command) x-select-enable-clipboard)
       (if (and (save-excursion
 		 (set-buffer (window-buffer (posn-window (event-start click))))
 		 (and (mark t) (> (mod mouse-selection-click-count 3) 0)
--- 21.2/lisp/mouse-sel.el.clipboard	2002-11-16 19:08:32 +0300
+++ 21.2/lisp/mouse-sel.el	2002-11-16 22:01:59 +0300
@@ -174,7 +174,7 @@
   :type 'boolean
   :group 'mouse-sel)
 
-(defcustom mouse-sel-default-bindings t
+(defcustom mouse-sel-default-bindings (if x-select-enable-clipboard 'interprogram-cut-paste t)
   "*Control mouse bindings."
   :type '(choice (const :tag "none" nil)
 		 (const :tag "cut and paste" interprogram-cut-paste)
@@ -329,10 +329,12 @@
 unless `mouse-sel-default-bindings' is `interprogram-cut-paste'.")
 
 (defvar mouse-sel-get-selection-function
+  (if (eq mouse-sel-default-bindings 'interprogram-cut-paste)
+      'x-get-selection
   (lambda (selection)
     (if (eq selection 'PRIMARY)
 	(or (x-cut-buffer-or-selection-value) x-last-selected-text)
-      (x-get-selection selection)))
+      (x-get-selection selection))))
   "Function to call to get the selection.
 Called with one argument:
 
 
design & coding: Vladimir Lettiev aka crux © 2004-2005