diff options
| author | Jim Blandy | 1992-06-24 05:09:26 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-06-24 05:09:26 +0000 |
| commit | daa3760289bd389e8c174c8d24b375cd875cd911 (patch) | |
| tree | 0abe3e6108e0e5a7c98f4c4aa68a495b0ecef09a /lisp/term | |
| parent | a4275ad1c8f60239b0bad43cef97ca86d35a51a3 (diff) | |
| download | emacs-daa3760289bd389e8c174c8d24b375cd875cd911.tar.gz emacs-daa3760289bd389e8c174c8d24b375cd875cd911.zip | |
*** empty log message ***
Diffstat (limited to 'lisp/term')
| -rw-r--r-- | lisp/term/x-win.el | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 3f6cefe0a6f..22237e5e21a 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el | |||
| @@ -447,6 +447,11 @@ This returns ARGS with the arguments that have been processed removed." | |||
| 447 | '(lambda () | 447 | '(lambda () |
| 448 | (error "Suspending an emacs running under X makes no sense"))) | 448 | (error "Suspending an emacs running under X makes no sense"))) |
| 449 | 449 | ||
| 450 | ;;; We keep track of the last text selected here, so we can check the | ||
| 451 | ;;; current selection against it, and avoid passing back our own text | ||
| 452 | ;;; from x-cut-buffer-or-selection-value. | ||
| 453 | (defvar x-last-selected-text nil) | ||
| 454 | |||
| 450 | ;;; Make TEXT, a string, the primary and clipboard X selections. | 455 | ;;; Make TEXT, a string, the primary and clipboard X selections. |
| 451 | ;;; If you are running xclipboard, this means you can effectively | 456 | ;;; If you are running xclipboard, this means you can effectively |
| 452 | ;;; have a window on a copy of the kill-ring. | 457 | ;;; have a window on a copy of the kill-ring. |
| @@ -455,14 +460,19 @@ This returns ARGS with the arguments that have been processed removed." | |||
| 455 | (defun x-select-text (text) | 460 | (defun x-select-text (text) |
| 456 | (x-own-selection text 'cut-buffer0) | 461 | (x-own-selection text 'cut-buffer0) |
| 457 | (x-own-selection text 'clipboard) | 462 | (x-own-selection text 'clipboard) |
| 458 | (x-own-selection text)) | 463 | (x-own-selection text) |
| 464 | (setq x-last-selected-text text)) | ||
| 459 | 465 | ||
| 460 | ;;; Return the value of the current X selection. For compatibility | 466 | ;;; Return the value of the current X selection. For compatibility |
| 461 | ;;; with older X applications, this checks cut buffer 0 before | 467 | ;;; with older X applications, this checks cut buffer 0 before |
| 462 | ;;; retrieving the value of the primary selection. | 468 | ;;; retrieving the value of the primary selection. |
| 463 | (defun x-cut-buffer-or-selection-value () | 469 | (defun x-cut-buffer-or-selection-value () |
| 464 | (or (x-selection-value 'cut-buffer0) | 470 | (let ((text (or (x-selection-value 'cut-buffer0) |
| 465 | (x-selection-value))) | 471 | (x-selection-value)))) |
| 472 | (if (string= text x-last-selected-text) | ||
| 473 | nil | ||
| 474 | (setq x-last-selected-text nil) | ||
| 475 | text))) | ||
| 466 | 476 | ||
| 467 | ;;; Arrange for the kill and yank functions to set and check the clipboard. | 477 | ;;; Arrange for the kill and yank functions to set and check the clipboard. |
| 468 | (setq interprogram-cut-function 'x-select-text) | 478 | (setq interprogram-cut-function 'x-select-text) |