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 /lisp | |
| 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.
Diffstat (limited to 'lisp')
| -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 |
9 files changed, 93 insertions, 159 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) |