Группа :: Редакторы
Пакет: emacs22
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: emacs-22.0.50-alt0.7-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 *clipboard*, 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.el (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 patch it for this before.)
imz@altlinux.ru, Apr 2003.
diff -Naur emacs/lisp/mouse.el emacs.build/lisp/mouse.el
--- emacs/lisp/mouse.el 2006-01-04 00:02:07 +0500
+++ emacs.build/lisp/mouse.el 2006-01-22 18:01:20 +0500
@@ -665,7 +665,7 @@
;; C-w will not double the text in the kill ring.
;; Ignore last-command so we don't append to a preceding kill.
(when mouse-drag-copy-region
- (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)))
@@ -990,7 +990,7 @@
(delete-overlay mouse-drag-overlay)
;; Don't let copy-region-as-kill set deactivate-mark.
(when mouse-drag-copy-region
- (let (deactivate-mark)
+ (let (deactivate-mark x-select-enable-clipboard)
(copy-region-as-kill (point) (mark t))))
(let ((buffer (current-buffer)))
(mouse-show-mark)
@@ -1276,8 +1276,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.
@@ -1292,14 +1293,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))
@@ -1364,7 +1366,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 (with-current-buffer
(window-buffer (posn-window (event-start click)))
(and (mark t) (> (mod mouse-selection-click-count 3) 0)
diff -Naur emacs/lisp/mouse-sel.el emacs.build/lisp/mouse-sel.el
--- emacs/lisp/mouse-sel.el 2005-08-07 04:13:43 +0600
+++ emacs.build/lisp/mouse-sel.el 2006-01-22 18:05:24 +0500
@@ -164,7 +164,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)
@@ -320,12 +320,14 @@
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)
(bound-and-true-p x-last-selected-text)
(bound-and-true-p x-last-selected-text-primary))
- (x-get-selection selection)))
+ (x-get-selection selection))))
"Function to call to get the selection.
Called with one argument:
diff -Naur emacs/lisp/term/x-win.el emacs.build/lisp/term/x-win.el
--- emacs/lisp/term/x-win.el 2005-11-03 13:56:36 +0500
+++ emacs.build/lisp/term/x-win.el 2006-01-22 18:08:07 +0500
@@ -2139,9 +2139,14 @@
"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."
+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)