From b2b9ff5e6d4f4ad232b669295d212ee54e934d34 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 19 Apr 1996 02:40:44 +0000 Subject: [PATCH] (x-select-text): Remember selected text. (x-get-selection-value): Return nil if the clipboard data is is the same as the remembered selected text. --- lisp/term/w32-win.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index c6d94f09252..b2c6b923a27 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el @@ -488,7 +488,8 @@ This is in addition to the primary selection.") (defun x-select-text (text &optional push) (if x-select-enable-clipboard - (win32-set-clipboard-data text))) + (win32-set-clipboard-data text)) + (setq x-last-selected-text text)) ;;; Return the value of the current selection. ;;; Consult the selection, then the cut buffer. Treat empty strings @@ -501,7 +502,15 @@ This is in addition to the primary selection.") (setq text (win32-get-clipboard-data)) (error (message "win32-get-clipboard-data:%s" c))) (if (string= text "") (setq text nil)) - text))) + (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)))))) ;;; Do the actual Windows setup here; the above code just defines ;;; functions and variables that we use now. -- 2.39.2