# HG changeset patch # User Jim Blandy # Date 717788625 0 # Node ID bf6b4bc3ccc04741485cc6e28024256c560e2e47 # Parent cfda1fa93624fb2f91bcf08cd42a5983e35bbc50 *** empty log message *** diff -r cfda1fa93624 -r bf6b4bc3ccc0 lisp/term/x-win.el --- a/lisp/term/x-win.el Tue Sep 29 17:27:47 1992 +0000 +++ b/lisp/term/x-win.el Tue Sep 29 17:43:45 1992 +0000 @@ -482,12 +482,24 @@ ;;; with older X applications, this checks cut buffer 0 before ;;; retrieving the value of the primary selection. (defun x-cut-buffer-or-selection-value () - (let ((text (or (x-selection-value)))) - (if (or (string= text x-last-selected-text) - (string= "")) - nil - (setq x-last-selected-text nil) - text))) + (let (text) + + ;; Consult the cut buffer, then the selection. Treat empty strings + ;; as if they were unset. + (setq text (x-get-cut-buffer 0)) + (if (string= text "") (setq text nil)) + (or text (setq text (x-get-cut-buffer 0))) + (if (string= text "") (setq text nil)) + + (cond + ((not text) nil) + ((eq text x-last-selected-text) nil) + ((string= text x-last-selected-text) + ;; Record the newer string, so subsequent calls can use the `eq' test. + (setq x-last-selected-text text) + nil) + (t + (setq x-last-selected-text text))))) ;;; Arrange for the kill and yank functions to set and check the clipboard. (setq interprogram-cut-function 'x-select-text)