diff options
| author | Jan Djärv | 2010-09-02 11:47:08 +0200 |
|---|---|---|
| committer | Jan Djärv | 2010-09-02 11:47:08 +0200 |
| commit | 6d7cc563820685d94d006116378f155d73bbb915 (patch) | |
| tree | a0c6ac62a4b11640d60567abfdb65e76ce7f673b | |
| parent | f68a93a990c906234ea0c8d77ca5e785d3e56dfe (diff) | |
| download | emacs-6d7cc563820685d94d006116378f155d73bbb915.tar.gz 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.
| -rw-r--r-- | lisp/ChangeLog | 38 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 2 | ||||
| -rw-r--r-- | lisp/mouse-sel.el | 8 | ||||
| -rw-r--r-- | lisp/select.el | 30 | ||||
| -rw-r--r-- | lisp/simple.el | 7 | ||||
| -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 | ||||
| -rw-r--r-- | lisp/w32-fns.el | 23 | ||||
| -rw-r--r-- | src/ChangeLog | 14 | ||||
| -rw-r--r-- | src/xselect.c | 243 | ||||
| -rw-r--r-- | src/xterm.c | 2 | ||||
| -rw-r--r-- | src/xterm.h | 2 |
13 files changed, 107 insertions, 406 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cd86f9d20e4..baa1b0fd353 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,41 @@ | |||
| 1 | 2010-09-02 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * term/x-win.el: Update documentation for x-last-selected-text-*. | ||
| 4 | (x-last-selected-text-cut, x-last-selected-text-cut-encoded) | ||
| 5 | (x-last-cut-buffer-coding, x-cut-buffer-max): Remove. | ||
| 6 | (x-select-text): Remove argument PUSH, update documentation. Remove | ||
| 7 | cut-buffer code. | ||
| 8 | (x-selection-value-internal): Was previously x-selection-value. | ||
| 9 | (x-selection-value): Renamed from x-cut-buffer-or-selection-value. | ||
| 10 | Update documentation, remove cut-buffer code. Call | ||
| 11 | x-selection-value-internal. | ||
| 12 | (x-clipboard-yank): Call x-selection-value-internal. | ||
| 13 | (x-initialize-window-system): Remove setting of x-cut-buffer-max. | ||
| 14 | |||
| 15 | * term/pc-win.el (x-last-selected-text): | ||
| 16 | x-cut-buffer-or-selection-value renamed to x-selection-value | ||
| 17 | (x-select-text): Remove argument PUSH, update documentation. | ||
| 18 | |||
| 19 | * term/ns-win.el (x-setup-function-keys, ns-last-selected-text): | ||
| 20 | x-cut-buffer-or-selection-value renamed to x-selection-value | ||
| 21 | (x-selection-value): Renamed from x-cut-buffer-or-selection-value. | ||
| 22 | (x-select-text): Remove argument PUSH, update documentation. | ||
| 23 | |||
| 24 | * emacs-lisp/cl-macs.el (x-get-cutbuffer, x-get-cut-buffer): Remove. | ||
| 25 | |||
| 26 | * w32-fns.el (x-last-selected-text): | ||
| 27 | x-cut-buffer-or-selection-value renamed to x-selection-value. | ||
| 28 | (x-cut-buffer-max): Remove. | ||
| 29 | (x-select-text): Remove argument PUSH, update documentation. | ||
| 30 | |||
| 31 | * simple.el (interprogram-cut-function): Remove mention of PUSH. | ||
| 32 | |||
| 33 | * select.el (x-get-cut-buffer, x-set-cut-buffer): Remove. | ||
| 34 | |||
| 35 | * mouse-sel.el (mouse-sel-get-selection-function): | ||
| 36 | x-cut-buffer-or-selection-value renamed to x-selection-value. | ||
| 37 | (x-select-text): Optional push removed. | ||
| 38 | |||
| 1 | 2010-09-01 Stefan Monnier <monnier@iro.umontreal.ca> | 39 | 2010-09-01 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 40 | ||
| 3 | * simple.el (blink-paren-function): Move from C to here. | 41 | * simple.el (blink-paren-function): Move from C to here. |
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index db2ab1c91d6..f6d66c64c7a 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el | |||
| @@ -1819,8 +1819,6 @@ Example: | |||
| 1819 | (defsetf window-start set-window-start) | 1819 | (defsetf window-start set-window-start) |
| 1820 | (defsetf window-width () (store) | 1820 | (defsetf window-width () (store) |
| 1821 | (list 'progn (list 'enlarge-window (list '- store '(window-width)) t) store)) | 1821 | (list 'progn (list 'enlarge-window (list '- store '(window-width)) t) store)) |
| 1822 | (defsetf x-get-cutbuffer x-store-cutbuffer t) | ||
| 1823 | (defsetf x-get-cut-buffer x-store-cut-buffer t) ; groan. | ||
| 1824 | (defsetf x-get-secondary-selection x-own-secondary-selection t) | 1822 | (defsetf x-get-secondary-selection x-own-secondary-selection t) |
| 1825 | (defsetf x-get-selection x-own-selection t) | 1823 | (defsetf x-get-selection x-own-selection t) |
| 1826 | 1824 | ||
diff --git a/lisp/mouse-sel.el b/lisp/mouse-sel.el index bd3054a5b94..65a52ef664c 100644 --- a/lisp/mouse-sel.el +++ b/lisp/mouse-sel.el | |||
| @@ -98,7 +98,7 @@ | |||
| 98 | ;; | 98 | ;; |
| 99 | ;; Selection/kill-ring interaction is retained | 99 | ;; Selection/kill-ring interaction is retained |
| 100 | ;; interprogram-cut-function = x-select-text | 100 | ;; interprogram-cut-function = x-select-text |
| 101 | ;; interprogram-paste-function = x-cut-buffer-or-selection-value | 101 | ;; interprogram-paste-function = x-selection-value |
| 102 | ;; | 102 | ;; |
| 103 | ;; What you lose is the ability to select some text in | 103 | ;; What you lose is the ability to select some text in |
| 104 | ;; delete-selection-mode and yank over the top of it. | 104 | ;; delete-selection-mode and yank over the top of it. |
| @@ -299,7 +299,7 @@ where SELECTION-NAME = name of selection | |||
| 299 | SELECTION-THING-SYMBOL = name of variable where the current selection | 299 | SELECTION-THING-SYMBOL = name of variable where the current selection |
| 300 | type for this selection should be stored.") | 300 | type for this selection should be stored.") |
| 301 | 301 | ||
| 302 | (declare-function x-select-text "term/x-win" (text &optional push)) | 302 | (declare-function x-select-text "term/x-win" (text)) |
| 303 | 303 | ||
| 304 | (defvar mouse-sel-set-selection-function | 304 | (defvar mouse-sel-set-selection-function |
| 305 | (if (eq mouse-sel-default-bindings 'interprogram-cut-paste) | 305 | (if (eq mouse-sel-default-bindings 'interprogram-cut-paste) |
| @@ -317,12 +317,12 @@ Called with two arguments: | |||
| 317 | This sets the selection as well as the cut buffer for the older applications, | 317 | This sets the selection as well as the cut buffer for the older applications, |
| 318 | unless `mouse-sel-default-bindings' is `interprogram-cut-paste'.") | 318 | unless `mouse-sel-default-bindings' is `interprogram-cut-paste'.") |
| 319 | 319 | ||
| 320 | (declare-function x-cut-buffer-or-selection-value "term/x-win" ()) | 320 | (declare-function x-selection-value "term/x-win" ()) |
| 321 | 321 | ||
| 322 | (defvar mouse-sel-get-selection-function | 322 | (defvar mouse-sel-get-selection-function |
| 323 | (lambda (selection) | 323 | (lambda (selection) |
| 324 | (if (eq selection 'PRIMARY) | 324 | (if (eq selection 'PRIMARY) |
| 325 | (or (x-cut-buffer-or-selection-value) | 325 | (or (x-selection-value) |
| 326 | (bound-and-true-p x-last-selected-text) | 326 | (bound-and-true-p x-last-selected-text) |
| 327 | (bound-and-true-p x-last-selected-text-primary)) | 327 | (bound-and-true-p x-last-selected-text-primary)) |
| 328 | (x-get-selection selection))) | 328 | (x-get-selection selection))) |
diff --git a/lisp/select.el b/lisp/select.el index 842c250df60..3e9cd2d5d53 100644 --- a/lisp/select.el +++ b/lisp/select.el | |||
| @@ -174,36 +174,6 @@ are not available to other programs." | |||
| 174 | (symbolp data) | 174 | (symbolp data) |
| 175 | (integerp data))) | 175 | (integerp data))) |
| 176 | 176 | ||
| 177 | ;;; Cut Buffer support | ||
| 178 | |||
| 179 | (declare-function x-get-cut-buffer-internal "xselect.c") | ||
| 180 | |||
| 181 | (defun x-get-cut-buffer (&optional which-one) | ||
| 182 | "Return the value of one of the 8 X server cut-buffers. | ||
| 183 | Optional arg WHICH-ONE should be a number from 0 to 7, defaulting to 0. | ||
| 184 | Cut buffers are considered obsolete; you should use selections instead." | ||
| 185 | (x-get-cut-buffer-internal | ||
| 186 | (if which-one | ||
| 187 | (aref [CUT_BUFFER0 CUT_BUFFER1 CUT_BUFFER2 CUT_BUFFER3 | ||
| 188 | CUT_BUFFER4 CUT_BUFFER5 CUT_BUFFER6 CUT_BUFFER7] | ||
| 189 | which-one) | ||
| 190 | 'CUT_BUFFER0))) | ||
| 191 | |||
| 192 | (declare-function x-rotate-cut-buffers-internal "xselect.c") | ||
| 193 | (declare-function x-store-cut-buffer-internal "xselect.c") | ||
| 194 | |||
| 195 | (defun x-set-cut-buffer (string &optional push) | ||
| 196 | "Store STRING into the X server's primary cut buffer. | ||
| 197 | If PUSH is non-nil, also rotate the cut buffers: | ||
| 198 | this means the previous value of the primary cut buffer moves to the second | ||
| 199 | cut buffer, and the second to the third, and so on (there are 8 buffers.) | ||
| 200 | Cut buffers are considered obsolete; you should use selections instead." | ||
| 201 | (or (stringp string) (signal 'wrong-type-argument (list 'stringp string))) | ||
| 202 | (if push | ||
| 203 | (x-rotate-cut-buffers-internal 1)) | ||
| 204 | (x-store-cut-buffer-internal 'CUT_BUFFER0 string)) | ||
| 205 | |||
| 206 | |||
| 207 | ;; Functions to convert the selection into various other selection types. | 177 | ;; Functions to convert the selection into various other selection types. |
| 208 | ;; Every selection type that Emacs handles is implemented this way, except | 178 | ;; Every selection type that Emacs handles is implemented this way, except |
| 209 | ;; for TIMESTAMP, which is a special case. | 179 | ;; for TIMESTAMP, which is a special case. |
diff --git a/lisp/simple.el b/lisp/simple.el index 3cdac1e19f0..9ad776cad08 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -2929,11 +2929,8 @@ This variable holds a function that Emacs calls whenever text | |||
| 2929 | is put in the kill ring, to make the new kill available to other | 2929 | is put in the kill ring, to make the new kill available to other |
| 2930 | programs. | 2930 | programs. |
| 2931 | 2931 | ||
| 2932 | The function takes one or two arguments. | 2932 | The function takes one argument, TEXT, which is a string containing |
| 2933 | The first argument, TEXT, is a string containing | 2933 | the text which should be made available.") |
| 2934 | the text which should be made available. | ||
| 2935 | The second, optional, argument PUSH, has the same meaning as the | ||
| 2936 | similar argument to `x-set-cut-buffer', which see.") | ||
| 2937 | 2934 | ||
| 2938 | (defvar interprogram-paste-function nil | 2935 | (defvar interprogram-paste-function nil |
| 2939 | "Function to call to get text cut from other programs. | 2936 | "Function to call to get text cut from other programs. |
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'." | |||
| 293 | (unless (terminal-parameter frame 'x-setup-function-keys) | 293 | (unless (terminal-parameter frame 'x-setup-function-keys) |
| 294 | (with-selected-frame frame | 294 | (with-selected-frame frame |
| 295 | (setq interprogram-cut-function 'x-select-text | 295 | (setq interprogram-cut-function 'x-select-text |
| 296 | interprogram-paste-function 'x-cut-buffer-or-selection-value) | 296 | interprogram-paste-function 'x-selection-value) |
| 297 | (let ((map (copy-keymap ns-alternatives-map))) | 297 | (let ((map (copy-keymap ns-alternatives-map))) |
| 298 | (set-keymap-parent map (keymap-parent local-function-key-map)) | 298 | (set-keymap-parent map (keymap-parent local-function-key-map)) |
| 299 | (set-keymap-parent local-function-key-map map)) | 299 | (set-keymap-parent local-function-key-map map)) |
| @@ -1015,23 +1015,21 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") | |||
| 1015 | 1015 | ||
| 1016 | ;; We keep track of the last text selected here, so we can check the | 1016 | ;; We keep track of the last text selected here, so we can check the |
| 1017 | ;; current selection against it, and avoid passing back our own text | 1017 | ;; current selection against it, and avoid passing back our own text |
| 1018 | ;; from x-cut-buffer-or-selection-value. | 1018 | ;; from x-selection-value. |
| 1019 | (defvar ns-last-selected-text nil) | 1019 | (defvar ns-last-selected-text nil) |
| 1020 | 1020 | ||
| 1021 | (defun x-select-text (text &optional push) | 1021 | (defun x-select-text (text) |
| 1022 | "Select TEXT, a string, according to the window system. | 1022 | "Select TEXT, a string, according to the window system. |
| 1023 | 1023 | ||
| 1024 | On X, put TEXT in the primary X selection. For backward | 1024 | On X, if `x-select-enable-clipboard' is non-nil, copy TEXT to the |
| 1025 | compatibility with older X applications, set the value of X cut | 1025 | clipboard. If `x-select-enable-primary' is non-nil, put TEXT in |
| 1026 | buffer 0 as well, and if the optional argument PUSH is non-nil, | 1026 | the primary selection. |
| 1027 | rotate the cut buffers. If `x-select-enable-clipboard' is | ||
| 1028 | non-nil, copy the text to the X clipboard as well. | ||
| 1029 | 1027 | ||
| 1030 | On Windows, make TEXT the current selection. If | 1028 | On Windows, make TEXT the current selection. If |
| 1031 | `x-select-enable-clipboard' is non-nil, copy the text to the | 1029 | `x-select-enable-clipboard' is non-nil, copy the text to the |
| 1032 | clipboard as well. The argument PUSH is ignored. | 1030 | clipboard as well. |
| 1033 | 1031 | ||
| 1034 | On Nextstep, put TEXT in the pasteboard; PUSH is ignored." | 1032 | On Nextstep, put TEXT in the pasteboard." |
| 1035 | ;; Don't send the pasteboard too much text. | 1033 | ;; Don't send the pasteboard too much text. |
| 1036 | ;; It becomes slow, and if really big it causes errors. | 1034 | ;; It becomes slow, and if really big it causes errors. |
| 1037 | (ns-set-pasteboard text) | 1035 | (ns-set-pasteboard text) |
| @@ -1040,7 +1038,7 @@ On Nextstep, put TEXT in the pasteboard; PUSH is ignored." | |||
| 1040 | ;; Return the value of the current Nextstep selection. For | 1038 | ;; Return the value of the current Nextstep selection. For |
| 1041 | ;; compatibility with older Nextstep applications, this checks cut | 1039 | ;; compatibility with older Nextstep applications, this checks cut |
| 1042 | ;; buffer 0 before retrieving the value of the primary selection. | 1040 | ;; buffer 0 before retrieving the value of the primary selection. |
| 1043 | (defun x-cut-buffer-or-selection-value () | 1041 | (defun x-selection-value () |
| 1044 | (let (text) | 1042 | (let (text) |
| 1045 | 1043 | ||
| 1046 | ;; Consult the selection, then the cut buffer. Treat empty strings | 1044 | ;; 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.") | |||
| 196 | ; | 196 | ; |
| 197 | ;;; We keep track of the last text selected here, so we can check the | 197 | ;;; We keep track of the last text selected here, so we can check the |
| 198 | ;;; current selection against it, and avoid passing back our own text | 198 | ;;; current selection against it, and avoid passing back our own text |
| 199 | ;;; from x-cut-buffer-or-selection-value. | 199 | ;;; from x-selection-value. |
| 200 | (defvar x-last-selected-text nil) | 200 | (defvar x-last-selected-text nil) |
| 201 | 201 | ||
| 202 | (defcustom x-select-enable-clipboard t | 202 | (defcustom x-select-enable-clipboard t |
| @@ -209,20 +209,18 @@ set by Emacs is not accessible to other programs on Windows.\)" | |||
| 209 | :type 'boolean | 209 | :type 'boolean |
| 210 | :group 'killing) | 210 | :group 'killing) |
| 211 | 211 | ||
| 212 | (defun x-select-text (text &optional push) | 212 | (defun x-select-text (text) |
| 213 | "Select TEXT, a string, according to the window system. | 213 | "Select TEXT, a string, according to the window system. |
| 214 | 214 | ||
| 215 | On X, put TEXT in the primary X selection. For backward | 215 | On X, if `x-select-enable-clipboard' is non-nil, copy TEXT to the |
| 216 | compatibility with older X applications, set the value of X cut | 216 | clipboard. If `x-select-enable-primary' is non-nil, put TEXT in |
| 217 | buffer 0 as well, and if the optional argument PUSH is non-nil, | 217 | the primary selection. |
| 218 | rotate the cut buffers. If `x-select-enable-clipboard' is | ||
| 219 | non-nil, copy the text to the X clipboard as well. | ||
| 220 | 218 | ||
| 221 | On Windows, make TEXT the current selection. If | 219 | On Windows, make TEXT the current selection. If |
| 222 | `x-select-enable-clipboard' is non-nil, copy the text to the | 220 | `x-select-enable-clipboard' is non-nil, copy the text to the |
| 223 | clipboard as well. The argument PUSH is ignored. | 221 | clipboard as well. |
| 224 | 222 | ||
| 225 | On Nextstep, put TEXT in the pasteboard; PUSH is ignored." | 223 | On Nextstep, put TEXT in the pasteboard." |
| 226 | (if x-select-enable-clipboard | 224 | (if x-select-enable-clipboard |
| 227 | (w16-set-clipboard-data text)) | 225 | (w16-set-clipboard-data text)) |
| 228 | (setq x-last-selected-text text)) | 226 | (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'." | |||
| 1196 | 1196 | ||
| 1197 | ;; We keep track of the last text selected here, so we can check the | 1197 | ;; We keep track of the last text selected here, so we can check the |
| 1198 | ;; current selection against it, and avoid passing back our own text | 1198 | ;; current selection against it, and avoid passing back our own text |
| 1199 | ;; from x-cut-buffer-or-selection-value. We track all three | 1199 | ;; from x-selection-value. We track both |
| 1200 | ;; separately in case another X application only sets one of them | 1200 | ;; separately in case another X application only sets one of them |
| 1201 | ;; (say the cut buffer) we aren't fooled by the PRIMARY or | 1201 | ;; we aren't fooled by the PRIMARY or CLIPBOARD selection staying the same. |
| 1202 | ;; CLIPBOARD selection staying the same. | ||
| 1203 | (defvar x-last-selected-text-clipboard nil | 1202 | (defvar x-last-selected-text-clipboard nil |
| 1204 | "The value of the CLIPBOARD X selection last time we selected or | 1203 | "The value of the CLIPBOARD X selection last time we selected or |
| 1205 | pasted text.") | 1204 | pasted text.") |
| 1206 | (defvar x-last-selected-text-primary nil | 1205 | (defvar x-last-selected-text-primary nil |
| 1207 | "The value of the PRIMARY X selection last time we selected or | 1206 | "The value of the PRIMARY X selection last time we selected or |
| 1208 | pasted text.") | 1207 | pasted text.") |
| 1209 | (defvar x-last-selected-text-cut nil | ||
| 1210 | "The value of the X cut buffer last time we selected or pasted text. | ||
| 1211 | The actual text stored in the X cut buffer is what encoded from this value.") | ||
| 1212 | (defvar x-last-selected-text-cut-encoded nil | ||
| 1213 | "The value of the X cut buffer last time we selected or pasted text. | ||
| 1214 | This is the actual text stored in the X cut buffer.") | ||
| 1215 | (defvar x-last-cut-buffer-coding 'iso-latin-1 | ||
| 1216 | "The coding we last used to encode/decode the text from the X cut buffer") | ||
| 1217 | |||
| 1218 | (defvar x-cut-buffer-max 20000 ; Note this value is overridden below. | ||
| 1219 | "Max number of characters to put in the cut buffer. | ||
| 1220 | It is said that overlarge strings are slow to put into the cut buffer.") | ||
| 1221 | 1208 | ||
| 1222 | (defcustom x-select-enable-clipboard t | 1209 | (defcustom x-select-enable-clipboard t |
| 1223 | "Non-nil means cutting and pasting uses the clipboard. | 1210 | "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." | |||
| 1232 | :group 'killing | 1219 | :group 'killing |
| 1233 | :version "24.1") | 1220 | :version "24.1") |
| 1234 | 1221 | ||
| 1235 | (defun x-select-text (text &optional push) | 1222 | (defun x-select-text (text) |
| 1236 | "Select TEXT, a string, according to the window system. | 1223 | "Select TEXT, a string, according to the window system. |
| 1237 | If `x-select-enable-clipboard' is non-nil, copy TEXT to the | 1224 | |
| 1225 | On X, if `x-select-enable-clipboard' is non-nil, copy TEXT to the | ||
| 1238 | clipboard. If `x-select-enable-primary' is non-nil, put TEXT in | 1226 | clipboard. If `x-select-enable-primary' is non-nil, put TEXT in |
| 1239 | the primary selection. For backward compatibility with older X | 1227 | the primary selection. |
| 1240 | applications, this function also sets the value of X cut buffer | 1228 | |
| 1241 | 0, and, if the optional argument PUSH is non-nil, rotates the cut | 1229 | On Windows, make TEXT the current selection. If |
| 1242 | buffers." | 1230 | `x-select-enable-clipboard' is non-nil, copy the text to the |
| 1231 | clipboard as well. | ||
| 1232 | |||
| 1233 | On Nextstep, put TEXT in the pasteboard." | ||
| 1243 | ;; With multi-tty, this function may be called from a tty frame. | 1234 | ;; With multi-tty, this function may be called from a tty frame. |
| 1244 | (when (eq (framep (selected-frame)) 'x) | 1235 | (when (eq (framep (selected-frame)) 'x) |
| 1245 | ;; Don't send the cut buffer too much text. | 1236 | ;; Don't send the cut buffer too much text. |
| 1246 | ;; It becomes slow, and if really big it causes errors. | 1237 | ;; It becomes slow, and if really big it causes errors. |
| 1247 | (cond ((>= (length text) x-cut-buffer-max) | ||
| 1248 | (x-set-cut-buffer "" push) | ||
| 1249 | (setq x-last-selected-text-cut "" | ||
| 1250 | x-last-selected-text-cut-encoded "")) | ||
| 1251 | (t | ||
| 1252 | (setq x-last-selected-text-cut text | ||
| 1253 | x-last-cut-buffer-coding 'iso-latin-1 | ||
| 1254 | x-last-selected-text-cut-encoded | ||
| 1255 | ;; ICCCM says cut buffer always contain ISO-Latin-1 | ||
| 1256 | (encode-coding-string text 'iso-latin-1)) | ||
| 1257 | (x-set-cut-buffer x-last-selected-text-cut-encoded push))) | ||
| 1258 | (when x-select-enable-primary | 1238 | (when x-select-enable-primary |
| 1259 | (x-set-selection 'PRIMARY text) | 1239 | (x-set-selection 'PRIMARY text) |
| 1260 | (setq x-last-selected-text-primary text)) | 1240 | (setq x-last-selected-text-primary text)) |
| @@ -1282,7 +1262,7 @@ The value nil is the same as this list: | |||
| 1282 | ;; The return value is already decoded. If x-get-selection causes an | 1262 | ;; The return value is already decoded. If x-get-selection causes an |
| 1283 | ;; error, this function return nil. | 1263 | ;; error, this function return nil. |
| 1284 | 1264 | ||
| 1285 | (defun x-selection-value (type) | 1265 | (defun x-selection-value-internal (type) |
| 1286 | (let ((request-type (or x-select-request-type | 1266 | (let ((request-type (or x-select-request-type |
| 1287 | '(UTF8_STRING COMPOUND_TEXT STRING))) | 1267 | '(UTF8_STRING COMPOUND_TEXT STRING))) |
| 1288 | text) | 1268 | text) |
| @@ -1300,17 +1280,16 @@ The value nil is the same as this list: | |||
| 1300 | text)) | 1280 | text)) |
| 1301 | 1281 | ||
| 1302 | ;; Return the value of the current X selection. | 1282 | ;; Return the value of the current X selection. |
| 1303 | ;; Consult the selection, and the cut buffer. Treat empty strings | 1283 | ;; Consult the selection. Treat empty strings as if they were unset. |
| 1304 | ;; as if they were unset. | ||
| 1305 | ;; If this function is called twice and finds the same text, | 1284 | ;; If this function is called twice and finds the same text, |
| 1306 | ;; it returns nil the second time. This is so that a single | 1285 | ;; it returns nil the second time. This is so that a single |
| 1307 | ;; selection won't be added to the kill ring over and over. | 1286 | ;; selection won't be added to the kill ring over and over. |
| 1308 | (defun x-cut-buffer-or-selection-value () | 1287 | (defun x-selection-value () |
| 1309 | ;; With multi-tty, this function may be called from a tty frame. | 1288 | ;; With multi-tty, this function may be called from a tty frame. |
| 1310 | (when (eq (framep (selected-frame)) 'x) | 1289 | (when (eq (framep (selected-frame)) 'x) |
| 1311 | (let (clip-text primary-text cut-text) | 1290 | (let (clip-text primary-text) |
| 1312 | (when x-select-enable-clipboard | 1291 | (when x-select-enable-clipboard |
| 1313 | (setq clip-text (x-selection-value 'CLIPBOARD)) | 1292 | (setq clip-text (x-selection-value-internal 'CLIPBOARD)) |
| 1314 | (if (string= clip-text "") (setq clip-text nil)) | 1293 | (if (string= clip-text "") (setq clip-text nil)) |
| 1315 | 1294 | ||
| 1316 | ;; Check the CLIPBOARD selection for 'newness', is it different | 1295 | ;; Check the CLIPBOARD selection for 'newness', is it different |
| @@ -1329,7 +1308,7 @@ The value nil is the same as this list: | |||
| 1329 | (t (setq x-last-selected-text-clipboard clip-text))))) | 1308 | (t (setq x-last-selected-text-clipboard clip-text))))) |
| 1330 | 1309 | ||
| 1331 | (when x-select-enable-primary | 1310 | (when x-select-enable-primary |
| 1332 | (setq primary-text (x-selection-value 'PRIMARY)) | 1311 | (setq primary-text (x-selection-value-internal 'PRIMARY)) |
| 1333 | ;; Check the PRIMARY selection for 'newness', is it different | 1312 | ;; Check the PRIMARY selection for 'newness', is it different |
| 1334 | ;; from what we remebered them to be last time we did a | 1313 | ;; from what we remebered them to be last time we did a |
| 1335 | ;; cut/paste operation. | 1314 | ;; cut/paste operation. |
| @@ -1346,69 +1325,35 @@ The value nil is the same as this list: | |||
| 1346 | (t | 1325 | (t |
| 1347 | (setq x-last-selected-text-primary primary-text))))) | 1326 | (setq x-last-selected-text-primary primary-text))))) |
| 1348 | 1327 | ||
| 1349 | (setq cut-text (x-get-cut-buffer 0)) | ||
| 1350 | |||
| 1351 | ;; Check the x cut buffer for 'newness', is it different | ||
| 1352 | ;; from what we remebered them to be last time we did a | ||
| 1353 | ;; cut/paste operation. | ||
| 1354 | (setq cut-text | ||
| 1355 | (let ((next-coding (or next-selection-coding-system 'iso-latin-1))) | ||
| 1356 | (cond ;; check cut buffer | ||
| 1357 | ((or (not cut-text) (string= cut-text "")) | ||
| 1358 | (setq x-last-selected-text-cut nil)) | ||
| 1359 | ;; This short cut doesn't work because x-get-cut-buffer | ||
| 1360 | ;; always returns a newly created string. | ||
| 1361 | ;; ((eq cut-text x-last-selected-text-cut) nil) | ||
| 1362 | ((and (string= cut-text x-last-selected-text-cut-encoded) | ||
| 1363 | (eq x-last-cut-buffer-coding next-coding)) | ||
| 1364 | ;; See the comment above. No need of this recording. | ||
| 1365 | ;; Record the newer string, | ||
| 1366 | ;; so subsequent calls can use the `eq' test. | ||
| 1367 | ;; (setq x-last-selected-text-cut cut-text) | ||
| 1368 | nil) | ||
| 1369 | (t | ||
| 1370 | (setq x-last-selected-text-cut-encoded cut-text | ||
| 1371 | x-last-cut-buffer-coding next-coding | ||
| 1372 | x-last-selected-text-cut | ||
| 1373 | ;; ICCCM says cut buffer always contain ISO-Latin-1, but | ||
| 1374 | ;; use next-selection-coding-system if not nil. | ||
| 1375 | (decode-coding-string | ||
| 1376 | cut-text next-coding)))))) | ||
| 1377 | |||
| 1378 | ;; As we have done one selection, clear this now. | 1328 | ;; As we have done one selection, clear this now. |
| 1379 | (setq next-selection-coding-system nil) | 1329 | (setq next-selection-coding-system nil) |
| 1380 | 1330 | ||
| 1381 | ;; At this point we have recorded the current values for the | 1331 | ;; At this point we have recorded the current values for the |
| 1382 | ;; selection from clipboard (if we are supposed to) primary, | 1332 | ;; selection from clipboard (if we are supposed to) and primary. |
| 1383 | ;; and cut buffer. So return the first one that has changed | 1333 | ;; So return the first one that has changed |
| 1384 | ;; (which is the first non-null one). | 1334 | ;; (which is the first non-null one). |
| 1385 | ;; | 1335 | ;; |
| 1386 | ;; NOTE: There will be cases where more than one of these has | 1336 | ;; NOTE: There will be cases where more than one of these has |
| 1387 | ;; changed and the new values differ. This indicates that | 1337 | ;; changed and the new values differ. This indicates that |
| 1388 | ;; something like the following has happened since the last time | 1338 | ;; something like the following has happened since the last time |
| 1389 | ;; we looked at the selections: Application X set all the | 1339 | ;; we looked at the selections: Application X set all the |
| 1390 | ;; selections, then Application Y set only one or two of them (say | 1340 | ;; selections, then Application Y set only one of them. |
| 1391 | ;; just the cut-buffer). In this case since we don't have | 1341 | ;; In this case since we don't have |
| 1392 | ;; timestamps there is no way to know what the 'correct' value to | 1342 | ;; timestamps there is no way to know what the 'correct' value to |
| 1393 | ;; return is. The nice thing to do would be to tell the user we | 1343 | ;; return is. The nice thing to do would be to tell the user we |
| 1394 | ;; saw multiple possible selections and ask the user which was the | 1344 | ;; saw multiple possible selections and ask the user which was the |
| 1395 | ;; one they wanted. | 1345 | ;; one they wanted. |
| 1396 | ;; This code is still a big improvement because now the user can | 1346 | (or clip-text primary-text) |
| 1397 | ;; futz with the current selection and get emacs to pay attention | ||
| 1398 | ;; to the cut buffer again (previously as soon as clipboard or | ||
| 1399 | ;; primary had been set the cut buffer would essentially never be | ||
| 1400 | ;; checked again). | ||
| 1401 | (or clip-text primary-text cut-text) | ||
| 1402 | ))) | 1347 | ))) |
| 1403 | 1348 | ||
| 1404 | ;; Arrange for the kill and yank functions to set and check the clipboard. | 1349 | ;; Arrange for the kill and yank functions to set and check the clipboard. |
| 1405 | (setq interprogram-cut-function 'x-select-text) | 1350 | (setq interprogram-cut-function 'x-select-text) |
| 1406 | (setq interprogram-paste-function 'x-cut-buffer-or-selection-value) | 1351 | (setq interprogram-paste-function 'x-selection-value) |
| 1407 | 1352 | ||
| 1408 | (defun x-clipboard-yank () | 1353 | (defun x-clipboard-yank () |
| 1409 | "Insert the clipboard contents, or the last stretch of killed text." | 1354 | "Insert the clipboard contents, or the last stretch of killed text." |
| 1410 | (interactive "*") | 1355 | (interactive "*") |
| 1411 | (let ((clipboard-text (x-selection-value 'CLIPBOARD)) | 1356 | (let ((clipboard-text (x-selection-value-internal 'CLIPBOARD)) |
| 1412 | (x-select-enable-clipboard t)) | 1357 | (x-select-enable-clipboard t)) |
| 1413 | (if (and clipboard-text (> (length clipboard-text) 0)) | 1358 | (if (and clipboard-text (> (length clipboard-text) 0)) |
| 1414 | (kill-new clipboard-text)) | 1359 | (kill-new clipboard-text)) |
| @@ -1465,9 +1410,6 @@ The value nil is the same as this list: | |||
| 1465 | ;; are the initial display. | 1410 | ;; are the initial display. |
| 1466 | (eq initial-window-system 'x)) | 1411 | (eq initial-window-system 'x)) |
| 1467 | 1412 | ||
| 1468 | (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100) | ||
| 1469 | x-cut-buffer-max)) | ||
| 1470 | |||
| 1471 | ;; Create the default fontset. | 1413 | ;; Create the default fontset. |
| 1472 | (create-default-fontset) | 1414 | (create-default-fontset) |
| 1473 | 1415 | ||
diff --git a/lisp/w32-fns.el b/lisp/w32-fns.el index e08ecf880e7..3bd239f73f8 100644 --- a/lisp/w32-fns.el +++ b/lisp/w32-fns.el | |||
| @@ -429,28 +429,21 @@ bit output with no translation." | |||
| 429 | 429 | ||
| 430 | ;; We keep track of the last text selected here, so we can check the | 430 | ;; We keep track of the last text selected here, so we can check the |
| 431 | ;; current selection against it, and avoid passing back our own text | 431 | ;; current selection against it, and avoid passing back our own text |
| 432 | ;; from x-cut-buffer-or-selection-value. | 432 | ;; from x-selection-value. |
| 433 | (defvar x-last-selected-text nil) | 433 | (defvar x-last-selected-text nil) |
| 434 | 434 | ||
| 435 | ;; It is said that overlarge strings are slow to put into the cut buffer. | 435 | (defun x-select-text (text) |
| 436 | ;; Note this value is overridden below. | ||
| 437 | (defvar x-cut-buffer-max 20000 | ||
| 438 | "Max number of characters to put in the cut buffer.") | ||
| 439 | |||
| 440 | (defun x-select-text (text &optional push) | ||
| 441 | "Select TEXT, a string, according to the window system. | 436 | "Select TEXT, a string, according to the window system. |
| 442 | 437 | ||
| 443 | On X, put TEXT in the primary X selection. For backward | 438 | On X, if `x-select-enable-clipboard' is non-nil, copy TEXT to the |
| 444 | compatibility with older X applications, set the value of X cut | 439 | clipboard. If `x-select-enable-primary' is non-nil, put TEXT in |
| 445 | buffer 0 as well, and if the optional argument PUSH is non-nil, | 440 | the primary selection. |
| 446 | rotate the cut buffers. If `x-select-enable-clipboard' is | ||
| 447 | non-nil, copy the text to the X clipboard as well. | ||
| 448 | 441 | ||
| 449 | On Windows, make TEXT the current selection. If | 442 | On Windows, make TEXT the current selection. If |
| 450 | `x-select-enable-clipboard' is non-nil, copy the text to the | 443 | `x-select-enable-clipboard' is non-nil, copy the text to the |
| 451 | clipboard as well. The argument PUSH is ignored. | 444 | clipboard as well. |
| 452 | 445 | ||
| 453 | On Nextstep, put TEXT in the pasteboard; PUSH is ignored." | 446 | On Nextstep, put TEXT in the pasteboard." |
| 454 | (if x-select-enable-clipboard | 447 | (if x-select-enable-clipboard |
| 455 | (w32-set-clipboard-data text)) | 448 | (w32-set-clipboard-data text)) |
| 456 | (setq x-last-selected-text text)) | 449 | (setq x-last-selected-text text)) |
| @@ -476,7 +469,7 @@ they were unset." | |||
| 476 | (t | 469 | (t |
| 477 | (setq x-last-selected-text text)))))) | 470 | (setq x-last-selected-text text)))))) |
| 478 | 471 | ||
| 479 | (defalias 'x-cut-buffer-or-selection-value 'x-get-selection-value) | 472 | (defalias 'x-selection-value 'x-get-selection-value) |
| 480 | 473 | ||
| 481 | ;; Arrange for the kill and yank functions to set and check the clipboard. | 474 | ;; Arrange for the kill and yank functions to set and check the clipboard. |
| 482 | (setq interprogram-cut-function 'x-select-text) | 475 | (setq interprogram-cut-function 'x-select-text) |
diff --git a/src/ChangeLog b/src/ChangeLog index 8e656b525ef..c70db2ad69a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2010-09-02 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * xterm.h (struct dpyinfo): Remove cut_buffers_initialized. | ||
| 4 | |||
| 5 | * xterm.c (x_term_init): Don't set dpyinfo->cut_buffers_initialized. | ||
| 6 | |||
| 7 | * xselect.c: Remove declaration of cut-buffer objects and functions. | ||
| 8 | (symbol_to_x_atom): Remove mapping to XA_CUT_BUFFERn. | ||
| 9 | (x_atom_to_symbol): Remove mapping to QCUT_BUFFERn. | ||
| 10 | (Fx_get_cut_buffer_internal, Fx_store_cut_buffer_internal) | ||
| 11 | (Fx_rotate_cut_buffers_internal): Remove. | ||
| 12 | (syms_of_xselect): Remove defsubr of above. | ||
| 13 | Remove intern of QCUT_BUFFERn. | ||
| 14 | |||
| 1 | 2010-09-01 Stefan Monnier <monnier@iro.umontreal.ca> | 15 | 2010-09-01 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 16 | ||
| 3 | * cmds.c (Vblink_paren_function): Remove. | 17 | * cmds.c (Vblink_paren_function): Remove. |
diff --git a/src/xselect.c b/src/xselect.c index 21684c83088..7479f245a77 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -83,8 +83,6 @@ static void lisp_data_to_selection_data (Display *, Lisp_Object, | |||
| 83 | unsigned char **, Atom *, | 83 | unsigned char **, Atom *, |
| 84 | unsigned *, int *, int *); | 84 | unsigned *, int *, int *); |
| 85 | static Lisp_Object clean_local_selection_data (Lisp_Object); | 85 | static Lisp_Object clean_local_selection_data (Lisp_Object); |
| 86 | static void initialize_cut_buffers (Display *, Window); | ||
| 87 | |||
| 88 | 86 | ||
| 89 | /* Printing traces to stderr. */ | 87 | /* Printing traces to stderr. */ |
| 90 | 88 | ||
| @@ -105,8 +103,6 @@ static void initialize_cut_buffers (Display *, Window); | |||
| 105 | #endif | 103 | #endif |
| 106 | 104 | ||
| 107 | 105 | ||
| 108 | #define CUT_BUFFER_SUPPORT | ||
| 109 | |||
| 110 | Lisp_Object QSECONDARY, QSTRING, QINTEGER, QCLIPBOARD, QTIMESTAMP, | 106 | Lisp_Object QSECONDARY, QSTRING, QINTEGER, QCLIPBOARD, QTIMESTAMP, |
| 111 | QTEXT, QDELETE, QMULTIPLE, QINCR, QEMACS_TMP, QTARGETS, QATOM, QNULL, | 107 | QTEXT, QDELETE, QMULTIPLE, QINCR, QEMACS_TMP, QTARGETS, QATOM, QNULL, |
| 112 | QATOM_PAIR; | 108 | QATOM_PAIR; |
| @@ -116,11 +112,6 @@ Lisp_Object QUTF8_STRING; /* This is a type of selection. */ | |||
| 116 | 112 | ||
| 117 | Lisp_Object Qcompound_text_with_extensions; | 113 | Lisp_Object Qcompound_text_with_extensions; |
| 118 | 114 | ||
| 119 | #ifdef CUT_BUFFER_SUPPORT | ||
| 120 | Lisp_Object QCUT_BUFFER0, QCUT_BUFFER1, QCUT_BUFFER2, QCUT_BUFFER3, | ||
| 121 | QCUT_BUFFER4, QCUT_BUFFER5, QCUT_BUFFER6, QCUT_BUFFER7; | ||
| 122 | #endif | ||
| 123 | |||
| 124 | static Lisp_Object Vx_lost_selection_functions; | 115 | static Lisp_Object Vx_lost_selection_functions; |
| 125 | static Lisp_Object Vx_sent_selection_functions; | 116 | static Lisp_Object Vx_sent_selection_functions; |
| 126 | static Lisp_Object Qforeign_selection; | 117 | static Lisp_Object Qforeign_selection; |
| @@ -270,16 +261,6 @@ symbol_to_x_atom (struct x_display_info *dpyinfo, Display *display, Lisp_Object | |||
| 270 | if (EQ (sym, QEMACS_TMP)) return dpyinfo->Xatom_EMACS_TMP; | 261 | if (EQ (sym, QEMACS_TMP)) return dpyinfo->Xatom_EMACS_TMP; |
| 271 | if (EQ (sym, QTARGETS)) return dpyinfo->Xatom_TARGETS; | 262 | if (EQ (sym, QTARGETS)) return dpyinfo->Xatom_TARGETS; |
| 272 | if (EQ (sym, QNULL)) return dpyinfo->Xatom_NULL; | 263 | if (EQ (sym, QNULL)) return dpyinfo->Xatom_NULL; |
| 273 | #ifdef CUT_BUFFER_SUPPORT | ||
| 274 | if (EQ (sym, QCUT_BUFFER0)) return XA_CUT_BUFFER0; | ||
| 275 | if (EQ (sym, QCUT_BUFFER1)) return XA_CUT_BUFFER1; | ||
| 276 | if (EQ (sym, QCUT_BUFFER2)) return XA_CUT_BUFFER2; | ||
| 277 | if (EQ (sym, QCUT_BUFFER3)) return XA_CUT_BUFFER3; | ||
| 278 | if (EQ (sym, QCUT_BUFFER4)) return XA_CUT_BUFFER4; | ||
| 279 | if (EQ (sym, QCUT_BUFFER5)) return XA_CUT_BUFFER5; | ||
| 280 | if (EQ (sym, QCUT_BUFFER6)) return XA_CUT_BUFFER6; | ||
| 281 | if (EQ (sym, QCUT_BUFFER7)) return XA_CUT_BUFFER7; | ||
| 282 | #endif | ||
| 283 | if (!SYMBOLP (sym)) abort (); | 264 | if (!SYMBOLP (sym)) abort (); |
| 284 | 265 | ||
| 285 | TRACE1 (" XInternAtom %s", (char *) SDATA (SYMBOL_NAME (sym))); | 266 | TRACE1 (" XInternAtom %s", (char *) SDATA (SYMBOL_NAME (sym))); |
| @@ -315,24 +296,6 @@ x_atom_to_symbol (Display *dpy, Atom atom) | |||
| 315 | return QINTEGER; | 296 | return QINTEGER; |
| 316 | case XA_ATOM: | 297 | case XA_ATOM: |
| 317 | return QATOM; | 298 | return QATOM; |
| 318 | #ifdef CUT_BUFFER_SUPPORT | ||
| 319 | case XA_CUT_BUFFER0: | ||
| 320 | return QCUT_BUFFER0; | ||
| 321 | case XA_CUT_BUFFER1: | ||
| 322 | return QCUT_BUFFER1; | ||
| 323 | case XA_CUT_BUFFER2: | ||
| 324 | return QCUT_BUFFER2; | ||
| 325 | case XA_CUT_BUFFER3: | ||
| 326 | return QCUT_BUFFER3; | ||
| 327 | case XA_CUT_BUFFER4: | ||
| 328 | return QCUT_BUFFER4; | ||
| 329 | case XA_CUT_BUFFER5: | ||
| 330 | return QCUT_BUFFER5; | ||
| 331 | case XA_CUT_BUFFER6: | ||
| 332 | return QCUT_BUFFER6; | ||
| 333 | case XA_CUT_BUFFER7: | ||
| 334 | return QCUT_BUFFER7; | ||
| 335 | #endif | ||
| 336 | } | 299 | } |
| 337 | 300 | ||
| 338 | dpyinfo = x_display_info_for_display (dpy); | 301 | dpyinfo = x_display_info_for_display (dpy); |
| @@ -2258,195 +2221,6 @@ and t is the same as `SECONDARY'. */) | |||
| 2258 | } | 2221 | } |
| 2259 | 2222 | ||
| 2260 | 2223 | ||
| 2261 | #ifdef CUT_BUFFER_SUPPORT | ||
| 2262 | |||
| 2263 | /* Ensure that all 8 cut buffers exist. ICCCM says we gotta... */ | ||
| 2264 | static void | ||
| 2265 | initialize_cut_buffers (Display *display, Window window) | ||
| 2266 | { | ||
| 2267 | unsigned char *data = (unsigned char *) ""; | ||
| 2268 | BLOCK_INPUT; | ||
| 2269 | #define FROB(atom) XChangeProperty (display, window, atom, XA_STRING, 8, \ | ||
| 2270 | PropModeAppend, data, 0) | ||
| 2271 | FROB (XA_CUT_BUFFER0); | ||
| 2272 | FROB (XA_CUT_BUFFER1); | ||
| 2273 | FROB (XA_CUT_BUFFER2); | ||
| 2274 | FROB (XA_CUT_BUFFER3); | ||
| 2275 | FROB (XA_CUT_BUFFER4); | ||
| 2276 | FROB (XA_CUT_BUFFER5); | ||
| 2277 | FROB (XA_CUT_BUFFER6); | ||
| 2278 | FROB (XA_CUT_BUFFER7); | ||
| 2279 | #undef FROB | ||
| 2280 | UNBLOCK_INPUT; | ||
| 2281 | } | ||
| 2282 | |||
| 2283 | |||
| 2284 | #define CHECK_CUT_BUFFER(symbol) \ | ||
| 2285 | do { CHECK_SYMBOL ((symbol)); \ | ||
| 2286 | if (!EQ((symbol), QCUT_BUFFER0) && !EQ((symbol), QCUT_BUFFER1) \ | ||
| 2287 | && !EQ((symbol), QCUT_BUFFER2) && !EQ((symbol), QCUT_BUFFER3) \ | ||
| 2288 | && !EQ((symbol), QCUT_BUFFER4) && !EQ((symbol), QCUT_BUFFER5) \ | ||
| 2289 | && !EQ((symbol), QCUT_BUFFER6) && !EQ((symbol), QCUT_BUFFER7)) \ | ||
| 2290 | signal_error ("Doesn't name a cut buffer", (symbol)); \ | ||
| 2291 | } while (0) | ||
| 2292 | |||
| 2293 | DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal, | ||
| 2294 | Sx_get_cut_buffer_internal, 1, 1, 0, | ||
| 2295 | doc: /* Returns the value of the named cut buffer (typically CUT_BUFFER0). */) | ||
| 2296 | (Lisp_Object buffer) | ||
| 2297 | { | ||
| 2298 | Window window; | ||
| 2299 | Atom buffer_atom; | ||
| 2300 | unsigned char *data = NULL; | ||
| 2301 | int bytes; | ||
| 2302 | Atom type; | ||
| 2303 | int format; | ||
| 2304 | unsigned long size; | ||
| 2305 | Lisp_Object ret; | ||
| 2306 | Display *display; | ||
| 2307 | struct x_display_info *dpyinfo; | ||
| 2308 | struct frame *sf = SELECTED_FRAME (); | ||
| 2309 | |||
| 2310 | check_x (); | ||
| 2311 | |||
| 2312 | if (! FRAME_X_P (sf)) | ||
| 2313 | return Qnil; | ||
| 2314 | |||
| 2315 | display = FRAME_X_DISPLAY (sf); | ||
| 2316 | dpyinfo = FRAME_X_DISPLAY_INFO (sf); | ||
| 2317 | window = RootWindow (display, 0); /* Cut buffers are on screen 0 */ | ||
| 2318 | CHECK_CUT_BUFFER (buffer); | ||
| 2319 | buffer_atom = symbol_to_x_atom (dpyinfo, display, buffer); | ||
| 2320 | |||
| 2321 | x_get_window_property (display, window, buffer_atom, &data, &bytes, | ||
| 2322 | &type, &format, &size, 0); | ||
| 2323 | |||
| 2324 | if (!data || !format) | ||
| 2325 | { | ||
| 2326 | xfree (data); | ||
| 2327 | return Qnil; | ||
| 2328 | } | ||
| 2329 | |||
| 2330 | if (format != 8 || type != XA_STRING) | ||
| 2331 | signal_error ("Cut buffer doesn't contain 8-bit data", | ||
| 2332 | list2 (x_atom_to_symbol (display, type), | ||
| 2333 | make_number (format))); | ||
| 2334 | |||
| 2335 | ret = (bytes ? make_unibyte_string ((char *) data, bytes) : Qnil); | ||
| 2336 | /* Use xfree, not XFree, because x_get_window_property | ||
| 2337 | calls xmalloc itself. */ | ||
| 2338 | xfree (data); | ||
| 2339 | return ret; | ||
| 2340 | } | ||
| 2341 | |||
| 2342 | |||
| 2343 | DEFUN ("x-store-cut-buffer-internal", Fx_store_cut_buffer_internal, | ||
| 2344 | Sx_store_cut_buffer_internal, 2, 2, 0, | ||
| 2345 | doc: /* Sets the value of the named cut buffer (typically CUT_BUFFER0). */) | ||
| 2346 | (Lisp_Object buffer, Lisp_Object string) | ||
| 2347 | { | ||
| 2348 | Window window; | ||
| 2349 | Atom buffer_atom; | ||
| 2350 | unsigned char *data; | ||
| 2351 | int bytes; | ||
| 2352 | int bytes_remaining; | ||
| 2353 | int max_bytes; | ||
| 2354 | Display *display; | ||
| 2355 | struct frame *sf = SELECTED_FRAME (); | ||
| 2356 | |||
| 2357 | check_x (); | ||
| 2358 | |||
| 2359 | if (! FRAME_X_P (sf)) | ||
| 2360 | return Qnil; | ||
| 2361 | |||
| 2362 | display = FRAME_X_DISPLAY (sf); | ||
| 2363 | window = RootWindow (display, 0); /* Cut buffers are on screen 0 */ | ||
| 2364 | |||
| 2365 | max_bytes = SELECTION_QUANTUM (display); | ||
| 2366 | if (max_bytes > MAX_SELECTION_QUANTUM) | ||
| 2367 | max_bytes = MAX_SELECTION_QUANTUM; | ||
| 2368 | |||
| 2369 | CHECK_CUT_BUFFER (buffer); | ||
| 2370 | CHECK_STRING (string); | ||
| 2371 | buffer_atom = symbol_to_x_atom (FRAME_X_DISPLAY_INFO (sf), | ||
| 2372 | display, buffer); | ||
| 2373 | data = (unsigned char *) SDATA (string); | ||
| 2374 | bytes = SBYTES (string); | ||
| 2375 | bytes_remaining = bytes; | ||
| 2376 | |||
| 2377 | if (! FRAME_X_DISPLAY_INFO (sf)->cut_buffers_initialized) | ||
| 2378 | { | ||
| 2379 | initialize_cut_buffers (display, window); | ||
| 2380 | FRAME_X_DISPLAY_INFO (sf)->cut_buffers_initialized = 1; | ||
| 2381 | } | ||
| 2382 | |||
| 2383 | BLOCK_INPUT; | ||
| 2384 | |||
| 2385 | /* Don't mess up with an empty value. */ | ||
| 2386 | if (!bytes_remaining) | ||
| 2387 | XChangeProperty (display, window, buffer_atom, XA_STRING, 8, | ||
| 2388 | PropModeReplace, data, 0); | ||
| 2389 | |||
| 2390 | while (bytes_remaining) | ||
| 2391 | { | ||
| 2392 | int chunk = (bytes_remaining < max_bytes | ||
| 2393 | ? bytes_remaining : max_bytes); | ||
| 2394 | XChangeProperty (display, window, buffer_atom, XA_STRING, 8, | ||
| 2395 | (bytes_remaining == bytes | ||
| 2396 | ? PropModeReplace | ||
| 2397 | : PropModeAppend), | ||
| 2398 | data, chunk); | ||
| 2399 | data += chunk; | ||
| 2400 | bytes_remaining -= chunk; | ||
| 2401 | } | ||
| 2402 | UNBLOCK_INPUT; | ||
| 2403 | return string; | ||
| 2404 | } | ||
| 2405 | |||
| 2406 | |||
| 2407 | DEFUN ("x-rotate-cut-buffers-internal", Fx_rotate_cut_buffers_internal, | ||
| 2408 | Sx_rotate_cut_buffers_internal, 1, 1, 0, | ||
| 2409 | doc: /* Rotate the values of the cut buffers by N steps. | ||
| 2410 | Positive N means shift the values forward, negative means backward. */) | ||
| 2411 | (Lisp_Object n) | ||
| 2412 | { | ||
| 2413 | Window window; | ||
| 2414 | Atom props[8]; | ||
| 2415 | Display *display; | ||
| 2416 | struct frame *sf = SELECTED_FRAME (); | ||
| 2417 | |||
| 2418 | check_x (); | ||
| 2419 | |||
| 2420 | if (! FRAME_X_P (sf)) | ||
| 2421 | return Qnil; | ||
| 2422 | |||
| 2423 | display = FRAME_X_DISPLAY (sf); | ||
| 2424 | window = RootWindow (display, 0); /* Cut buffers are on screen 0 */ | ||
| 2425 | CHECK_NUMBER (n); | ||
| 2426 | if (XINT (n) == 0) | ||
| 2427 | return n; | ||
| 2428 | if (! FRAME_X_DISPLAY_INFO (sf)->cut_buffers_initialized) | ||
| 2429 | { | ||
| 2430 | initialize_cut_buffers (display, window); | ||
| 2431 | FRAME_X_DISPLAY_INFO (sf)->cut_buffers_initialized = 1; | ||
| 2432 | } | ||
| 2433 | |||
| 2434 | props[0] = XA_CUT_BUFFER0; | ||
| 2435 | props[1] = XA_CUT_BUFFER1; | ||
| 2436 | props[2] = XA_CUT_BUFFER2; | ||
| 2437 | props[3] = XA_CUT_BUFFER3; | ||
| 2438 | props[4] = XA_CUT_BUFFER4; | ||
| 2439 | props[5] = XA_CUT_BUFFER5; | ||
| 2440 | props[6] = XA_CUT_BUFFER6; | ||
| 2441 | props[7] = XA_CUT_BUFFER7; | ||
| 2442 | BLOCK_INPUT; | ||
| 2443 | XRotateWindowProperties (display, window, props, 8, XINT (n)); | ||
| 2444 | UNBLOCK_INPUT; | ||
| 2445 | return n; | ||
| 2446 | } | ||
| 2447 | |||
| 2448 | #endif | ||
| 2449 | |||
| 2450 | /*********************************************************************** | 2224 | /*********************************************************************** |
| 2451 | Drag and drop support | 2225 | Drag and drop support |
| 2452 | ***********************************************************************/ | 2226 | ***********************************************************************/ |
| @@ -2850,12 +2624,6 @@ syms_of_xselect (void) | |||
| 2850 | defsubr (&Sx_selection_owner_p); | 2624 | defsubr (&Sx_selection_owner_p); |
| 2851 | defsubr (&Sx_selection_exists_p); | 2625 | defsubr (&Sx_selection_exists_p); |
| 2852 | 2626 | ||
| 2853 | #ifdef CUT_BUFFER_SUPPORT | ||
| 2854 | defsubr (&Sx_get_cut_buffer_internal); | ||
| 2855 | defsubr (&Sx_store_cut_buffer_internal); | ||
| 2856 | defsubr (&Sx_rotate_cut_buffers_internal); | ||
| 2857 | #endif | ||
| 2858 | |||
| 2859 | defsubr (&Sx_get_atom_name); | 2627 | defsubr (&Sx_get_atom_name); |
| 2860 | defsubr (&Sx_send_client_message); | 2628 | defsubr (&Sx_send_client_message); |
| 2861 | defsubr (&Sx_register_dnd_atom); | 2629 | defsubr (&Sx_register_dnd_atom); |
| @@ -2937,17 +2705,6 @@ A value of 0 means wait as long as necessary. This is initialized from the | |||
| 2937 | Qcompound_text_with_extensions = intern_c_string ("compound-text-with-extensions"); | 2705 | Qcompound_text_with_extensions = intern_c_string ("compound-text-with-extensions"); |
| 2938 | staticpro (&Qcompound_text_with_extensions); | 2706 | staticpro (&Qcompound_text_with_extensions); |
| 2939 | 2707 | ||
| 2940 | #ifdef CUT_BUFFER_SUPPORT | ||
| 2941 | QCUT_BUFFER0 = intern_c_string ("CUT_BUFFER0"); staticpro (&QCUT_BUFFER0); | ||
| 2942 | QCUT_BUFFER1 = intern_c_string ("CUT_BUFFER1"); staticpro (&QCUT_BUFFER1); | ||
| 2943 | QCUT_BUFFER2 = intern_c_string ("CUT_BUFFER2"); staticpro (&QCUT_BUFFER2); | ||
| 2944 | QCUT_BUFFER3 = intern_c_string ("CUT_BUFFER3"); staticpro (&QCUT_BUFFER3); | ||
| 2945 | QCUT_BUFFER4 = intern_c_string ("CUT_BUFFER4"); staticpro (&QCUT_BUFFER4); | ||
| 2946 | QCUT_BUFFER5 = intern_c_string ("CUT_BUFFER5"); staticpro (&QCUT_BUFFER5); | ||
| 2947 | QCUT_BUFFER6 = intern_c_string ("CUT_BUFFER6"); staticpro (&QCUT_BUFFER6); | ||
| 2948 | QCUT_BUFFER7 = intern_c_string ("CUT_BUFFER7"); staticpro (&QCUT_BUFFER7); | ||
| 2949 | #endif | ||
| 2950 | |||
| 2951 | Qforeign_selection = intern_c_string ("foreign-selection"); | 2708 | Qforeign_selection = intern_c_string ("foreign-selection"); |
| 2952 | staticpro (&Qforeign_selection); | 2709 | staticpro (&Qforeign_selection); |
| 2953 | } | 2710 | } |
diff --git a/src/xterm.c b/src/xterm.c index c049ce78913..2ebe8a80378 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -10124,8 +10124,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 10124 | dpyinfo->Xatom_net_wm_name | 10124 | dpyinfo->Xatom_net_wm_name |
| 10125 | = XInternAtom (dpyinfo->display, "_NET_WM_NAME", False); | 10125 | = XInternAtom (dpyinfo->display, "_NET_WM_NAME", False); |
| 10126 | 10126 | ||
| 10127 | dpyinfo->cut_buffers_initialized = 0; | ||
| 10128 | |||
| 10129 | dpyinfo->x_dnd_atoms_size = 8; | 10127 | dpyinfo->x_dnd_atoms_size = 8; |
| 10130 | dpyinfo->x_dnd_atoms_length = 0; | 10128 | dpyinfo->x_dnd_atoms_length = 0; |
| 10131 | dpyinfo->x_dnd_atoms = xmalloc (sizeof (*dpyinfo->x_dnd_atoms) | 10129 | dpyinfo->x_dnd_atoms = xmalloc (sizeof (*dpyinfo->x_dnd_atoms) |
diff --git a/src/xterm.h b/src/xterm.h index 972bfb50dc3..d884945f985 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -299,8 +299,6 @@ struct x_display_info | |||
| 299 | /* Atom used in XEmbed client messages. */ | 299 | /* Atom used in XEmbed client messages. */ |
| 300 | Atom Xatom_XEMBED; | 300 | Atom Xatom_XEMBED; |
| 301 | 301 | ||
| 302 | int cut_buffers_initialized; /* Whether we're sure they all exist */ | ||
| 303 | |||
| 304 | /* The frame (if any) which has the X window that has keyboard focus. | 302 | /* The frame (if any) which has the X window that has keyboard focus. |
| 305 | Zero if none. This is examined by Ffocus_frame in xfns.c. Note | 303 | Zero if none. This is examined by Ffocus_frame in xfns.c. Note |
| 306 | that a mere EnterNotify event can set this; if you need to know the | 304 | that a mere EnterNotify event can set this; if you need to know the |