diff options
author | Jan Djärv <jan.h.d@swipnet.se> | 2010-09-02 11:47:08 +0200 |
---|---|---|
committer | Jan Djärv <jan.h.d@swipnet.se> | 2010-09-02 11:47:08 +0200 |
commit | 6d7cc563820685d94d006116378f155d73bbb915 (patch) | |
tree | a0c6ac62a4b11640d60567abfdb65e76ce7f673b /lisp/term | |
parent | f68a93a990c906234ea0c8d77ca5e785d3e56dfe (diff) | |
download | emacs-6d7cc563820685d94d006116378f155d73bbb915.tar.gz emacs-6d7cc563820685d94d006116378f155d73bbb915.tar.bz2 emacs-6d7cc563820685d94d006116378f155d73bbb915.zip |
Removed cut-buffer code.
* lisp/mouse-sel.el (mouse-sel-get-selection-function):
x-cut-buffer-or-selection-value renamed to x-selection-value.
(x-select-text): Optional push removed.
* lisp/select.el (x-get-cut-buffer, x-set-cut-buffer): Remove.
* lisp/simple.el (interprogram-cut-function): Remove mention of PUSH.
* lisp/w32-fns.el (x-last-selected-text):
x-cut-buffer-or-selection-value renamed to x-selection-value.
(x-cut-buffer-max): Remove.
(x-select-text): Remove argument PUSH, update documentation.
* lisp/emacs-lisp/cl-macs.el (x-get-cutbuffer, x-get-cut-buffer): Remove.
* lisp/term/ns-win.el (x-setup-function-keys, ns-last-selected-text):
x-cut-buffer-or-selection-value renamed to x-selection-value
(x-selection-value): Renamed from x-cut-buffer-or-selection-value.
(x-select-text): Remove argument PUSH, update documentation.
* lisp/term/pc-win.el (x-last-selected-text):
x-cut-buffer-or-selection-value renamed to x-selection-value
(x-select-text): Remove argument PUSH, update documentation.
* lisp/term/x-win.el: Update documentation for x-last-selected-text-*.
(x-last-selected-text-cut, x-last-selected-text-cut-encoded)
(x-last-cut-buffer-coding, x-cut-buffer-max): Remove.
(x-select-text): Remove argument PUSH, update documentation. Remove
cut-buffer code.
(x-selection-value-internal): Was previously x-selection-value.
(x-selection-value): Renamed from x-cut-buffer-or-selection-value.
Update documentation, remove cut-buffer code. Call
x-selection-value-internal.
(x-clipboard-yank): Call x-selection-value-internal.
(x-initialize-window-system): Remove setting of x-cut-buffer-max.
* src/xselect.c: Remove declaration of cut-buffer objects and functions.
(symbol_to_x_atom): Remove mapping to XA_CUT_BUFFERn.
(x_atom_to_symbol): Remove mapping to QCUT_BUFFERn.
(Fx_get_cut_buffer_internal, Fx_store_cut_buffer_internal)
(Fx_rotate_cut_buffers_internal): Remove.
(syms_of_xselect): Remove defsubr of above.
Remove intern of QCUT_BUFFERn.
* src/xterm.c (x_term_init): Don't set dpyinfo->cut_buffers_initialized.
* src/xterm.h (struct dpyinfo): Remove cut_buffers_initialized.
Diffstat (limited to 'lisp/term')
-rw-r--r-- | lisp/term/ns-win.el | 20 | ||||
-rw-r--r-- | lisp/term/pc-win.el | 16 | ||||
-rw-r--r-- | lisp/term/x-win.el | 108 |
3 files changed, 41 insertions, 103 deletions
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el index d42632c3f23..ffd230d596f 100644 --- a/lisp/term/ns-win.el +++ b/lisp/term/ns-win.el @@ -293,7 +293,7 @@ The properties returned may include `top', `left', `height', and `width'." (unless (terminal-parameter frame 'x-setup-function-keys) (with-selected-frame frame (setq interprogram-cut-function 'x-select-text - interprogram-paste-function 'x-cut-buffer-or-selection-value) + interprogram-paste-function 'x-selection-value) (let ((map (copy-keymap ns-alternatives-map))) (set-keymap-parent map (keymap-parent local-function-key-map)) (set-keymap-parent local-function-key-map map)) @@ -1015,23 +1015,21 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") ;; We keep track of the last text selected here, so we can check the ;; current selection against it, and avoid passing back our own text -;; from x-cut-buffer-or-selection-value. +;; from x-selection-value. (defvar ns-last-selected-text nil) -(defun x-select-text (text &optional push) +(defun x-select-text (text) "Select TEXT, a string, according to the window system. -On X, put TEXT in the primary X selection. For backward -compatibility with older X applications, set the value of X cut -buffer 0 as well, and if the optional argument PUSH is non-nil, -rotate the cut buffers. If `x-select-enable-clipboard' is -non-nil, copy the text to the X clipboard as well. +On X, if `x-select-enable-clipboard' is non-nil, copy TEXT to the +clipboard. If `x-select-enable-primary' is non-nil, put TEXT in +the primary selection. On Windows, make TEXT the current selection. If `x-select-enable-clipboard' is non-nil, copy the text to the -clipboard as well. The argument PUSH is ignored. +clipboard as well. -On Nextstep, put TEXT in the pasteboard; PUSH is ignored." +On Nextstep, put TEXT in the pasteboard." ;; Don't send the pasteboard too much text. ;; It becomes slow, and if really big it causes errors. (ns-set-pasteboard text) @@ -1040,7 +1038,7 @@ On Nextstep, put TEXT in the pasteboard; PUSH is ignored." ;; Return the value of the current Nextstep selection. For ;; compatibility with older Nextstep applications, this checks cut ;; buffer 0 before retrieving the value of the primary selection. -(defun x-cut-buffer-or-selection-value () +(defun x-selection-value () (let (text) ;; Consult the selection, then the cut buffer. Treat empty strings diff --git a/lisp/term/pc-win.el b/lisp/term/pc-win.el index d9d4e3851fe..b3dc488ad77 100644 --- a/lisp/term/pc-win.el +++ b/lisp/term/pc-win.el @@ -196,7 +196,7 @@ the operating system.") ; ;;; We keep track of the last text selected here, so we can check the ;;; current selection against it, and avoid passing back our own text -;;; from x-cut-buffer-or-selection-value. +;;; from x-selection-value. (defvar x-last-selected-text nil) (defcustom x-select-enable-clipboard t @@ -209,20 +209,18 @@ set by Emacs is not accessible to other programs on Windows.\)" :type 'boolean :group 'killing) -(defun x-select-text (text &optional push) +(defun x-select-text (text) "Select TEXT, a string, according to the window system. -On X, put TEXT in the primary X selection. For backward -compatibility with older X applications, set the value of X cut -buffer 0 as well, and if the optional argument PUSH is non-nil, -rotate the cut buffers. If `x-select-enable-clipboard' is -non-nil, copy the text to the X clipboard as well. +On X, if `x-select-enable-clipboard' is non-nil, copy TEXT to the +clipboard. If `x-select-enable-primary' is non-nil, put TEXT in +the primary selection. On Windows, make TEXT the current selection. If `x-select-enable-clipboard' is non-nil, copy the text to the -clipboard as well. The argument PUSH is ignored. +clipboard as well. -On Nextstep, put TEXT in the pasteboard; PUSH is ignored." +On Nextstep, put TEXT in the pasteboard." (if x-select-enable-clipboard (w16-set-clipboard-data text)) (setq x-last-selected-text text)) diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 65ba534de42..1dcf0fed530 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -1196,28 +1196,15 @@ as returned by `x-server-vendor'." ;; We keep track of the last text selected here, so we can check the ;; current selection against it, and avoid passing back our own text -;; from x-cut-buffer-or-selection-value. We track all three +;; from x-selection-value. We track both ;; separately in case another X application only sets one of them -;; (say the cut buffer) we aren't fooled by the PRIMARY or -;; CLIPBOARD selection staying the same. +;; we aren't fooled by the PRIMARY or CLIPBOARD selection staying the same. (defvar x-last-selected-text-clipboard nil "The value of the CLIPBOARD X selection last time we selected or pasted text.") (defvar x-last-selected-text-primary nil "The value of the PRIMARY X selection last time we selected or pasted text.") -(defvar x-last-selected-text-cut nil - "The value of the X cut buffer last time we selected or pasted text. -The actual text stored in the X cut buffer is what encoded from this value.") -(defvar x-last-selected-text-cut-encoded nil - "The value of the X cut buffer last time we selected or pasted text. -This is the actual text stored in the X cut buffer.") -(defvar x-last-cut-buffer-coding 'iso-latin-1 - "The coding we last used to encode/decode the text from the X cut buffer") - -(defvar x-cut-buffer-max 20000 ; Note this value is overridden below. - "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 t "Non-nil means cutting and pasting uses the clipboard. @@ -1232,29 +1219,22 @@ This is in addition to, but in preference to, the primary selection." :group 'killing :version "24.1") -(defun x-select-text (text &optional push) +(defun x-select-text (text) "Select TEXT, a string, according to the window system. -If `x-select-enable-clipboard' is non-nil, copy TEXT to the + +On X, if `x-select-enable-clipboard' is non-nil, copy TEXT to the clipboard. If `x-select-enable-primary' is non-nil, put TEXT in -the primary selection. For backward compatibility with older X -applications, this function also sets the value of X cut buffer -0, and, if the optional argument PUSH is non-nil, rotates the cut -buffers." +the primary selection. + +On Windows, make TEXT the current selection. If +`x-select-enable-clipboard' is non-nil, copy the text to the +clipboard as well. + +On Nextstep, put TEXT in the pasteboard." ;; With multi-tty, this function may be called from a tty frame. (when (eq (framep (selected-frame)) 'x) ;; Don't send the cut buffer too much text. ;; It becomes slow, and if really big it causes errors. - (cond ((>= (length text) x-cut-buffer-max) - (x-set-cut-buffer "" push) - (setq x-last-selected-text-cut "" - x-last-selected-text-cut-encoded "")) - (t - (setq x-last-selected-text-cut text - x-last-cut-buffer-coding 'iso-latin-1 - x-last-selected-text-cut-encoded - ;; ICCCM says cut buffer always contain ISO-Latin-1 - (encode-coding-string text 'iso-latin-1)) - (x-set-cut-buffer x-last-selected-text-cut-encoded push))) (when x-select-enable-primary (x-set-selection 'PRIMARY text) (setq x-last-selected-text-primary text)) @@ -1282,7 +1262,7 @@ The value nil is the same as this list: ;; The return value is already decoded. If x-get-selection causes an ;; error, this function return nil. -(defun x-selection-value (type) +(defun x-selection-value-internal (type) (let ((request-type (or x-select-request-type '(UTF8_STRING COMPOUND_TEXT STRING))) text) @@ -1300,17 +1280,16 @@ The value nil is the same as this list: text)) ;; Return the value of the current X selection. -;; Consult the selection, and the cut buffer. Treat empty strings -;; as if they were unset. +;; Consult the selection. Treat empty strings as if they were unset. ;; If this function is called twice and finds the same text, ;; it returns nil the second time. This is so that a single ;; selection won't be added to the kill ring over and over. -(defun x-cut-buffer-or-selection-value () +(defun x-selection-value () ;; With multi-tty, this function may be called from a tty frame. (when (eq (framep (selected-frame)) 'x) - (let (clip-text primary-text cut-text) + (let (clip-text primary-text) (when x-select-enable-clipboard - (setq clip-text (x-selection-value 'CLIPBOARD)) + (setq clip-text (x-selection-value-internal 'CLIPBOARD)) (if (string= clip-text "") (setq clip-text nil)) ;; Check the CLIPBOARD selection for 'newness', is it different @@ -1329,7 +1308,7 @@ The value nil is the same as this list: (t (setq x-last-selected-text-clipboard clip-text))))) (when x-select-enable-primary - (setq primary-text (x-selection-value 'PRIMARY)) + (setq primary-text (x-selection-value-internal 'PRIMARY)) ;; Check the PRIMARY selection for 'newness', is it different ;; from what we remebered them to be last time we did a ;; cut/paste operation. @@ -1346,69 +1325,35 @@ The value nil is the same as this list: (t (setq x-last-selected-text-primary primary-text))))) - (setq cut-text (x-get-cut-buffer 0)) - - ;; Check the x cut buffer for 'newness', is it different - ;; from what we remebered them to be last time we did a - ;; cut/paste operation. - (setq cut-text - (let ((next-coding (or next-selection-coding-system 'iso-latin-1))) - (cond ;; check cut buffer - ((or (not cut-text) (string= cut-text "")) - (setq x-last-selected-text-cut nil)) - ;; This short cut doesn't work because x-get-cut-buffer - ;; always returns a newly created string. - ;; ((eq cut-text x-last-selected-text-cut) nil) - ((and (string= cut-text x-last-selected-text-cut-encoded) - (eq x-last-cut-buffer-coding next-coding)) - ;; See the comment above. No need of this recording. - ;; Record the newer string, - ;; so subsequent calls can use the `eq' test. - ;; (setq x-last-selected-text-cut cut-text) - nil) - (t - (setq x-last-selected-text-cut-encoded cut-text - x-last-cut-buffer-coding next-coding - x-last-selected-text-cut - ;; ICCCM says cut buffer always contain ISO-Latin-1, but - ;; use next-selection-coding-system if not nil. - (decode-coding-string - cut-text next-coding)))))) - ;; As we have done one selection, clear this now. (setq next-selection-coding-system nil) ;; At this point we have recorded the current values for the - ;; selection from clipboard (if we are supposed to) primary, - ;; and cut buffer. So return the first one that has changed + ;; selection from clipboard (if we are supposed to) and primary. + ;; So return the first one that has changed ;; (which is the first non-null one). ;; ;; NOTE: There will be cases where more than one of these has ;; changed and the new values differ. This indicates that ;; something like the following has happened since the last time ;; we looked at the selections: Application X set all the - ;; selections, then Application Y set only one or two of them (say - ;; just the cut-buffer). In this case since we don't have + ;; selections, then Application Y set only one of them. + ;; In this case since we don't have ;; timestamps there is no way to know what the 'correct' value to ;; return is. The nice thing to do would be to tell the user we ;; saw multiple possible selections and ask the user which was the ;; one they wanted. - ;; This code is still a big improvement because now the user can - ;; futz with the current selection and get emacs to pay attention - ;; to the cut buffer again (previously as soon as clipboard or - ;; primary had been set the cut buffer would essentially never be - ;; checked again). - (or clip-text primary-text cut-text) + (or clip-text primary-text) ))) ;; Arrange for the kill and yank functions to set and check the clipboard. (setq interprogram-cut-function 'x-select-text) -(setq interprogram-paste-function 'x-cut-buffer-or-selection-value) +(setq interprogram-paste-function 'x-selection-value) (defun x-clipboard-yank () "Insert the clipboard contents, or the last stretch of killed text." (interactive "*") - (let ((clipboard-text (x-selection-value 'CLIPBOARD)) + (let ((clipboard-text (x-selection-value-internal 'CLIPBOARD)) (x-select-enable-clipboard t)) (if (and clipboard-text (> (length clipboard-text) 0)) (kill-new clipboard-text)) @@ -1465,9 +1410,6 @@ The value nil is the same as this list: ;; are the initial display. (eq initial-window-system 'x)) - (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100) - x-cut-buffer-max)) - ;; Create the default fontset. (create-default-fontset) |