From: Richard M. Stallman Date: Fri, 19 Apr 1996 02:40:44 +0000 (+0000) Subject: (x-select-text): Remember selected text. X-Git-Tag: emacs-19.34~813 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b2b9ff5e6d4f4ad232b669295d212ee54e934d34;p=emacs.git (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. --- 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.