aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-04-19 02:40:44 +0000
committerRichard M. Stallman1996-04-19 02:40:44 +0000
commitb2b9ff5e6d4f4ad232b669295d212ee54e934d34 (patch)
tree671a7e6c5ad617a1071adcf174a9705f876dc766
parentbf8aeaf981c6f6096c7e1a07d076b8bbb5e41e02 (diff)
downloademacs-b2b9ff5e6d4f4ad232b669295d212ee54e934d34.tar.gz
emacs-b2b9ff5e6d4f4ad232b669295d212ee54e934d34.zip
(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.
-rw-r--r--lisp/term/w32-win.el13
1 files 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.")
488 488
489(defun x-select-text (text &optional push) 489(defun x-select-text (text &optional push)
490 (if x-select-enable-clipboard 490 (if x-select-enable-clipboard
491 (win32-set-clipboard-data text))) 491 (win32-set-clipboard-data text))
492 (setq x-last-selected-text text))
492 493
493;;; Return the value of the current selection. 494;;; Return the value of the current selection.
494;;; Consult the selection, then the cut buffer. Treat empty strings 495;;; Consult the selection, then the cut buffer. Treat empty strings
@@ -501,7 +502,15 @@ This is in addition to the primary selection.")
501 (setq text (win32-get-clipboard-data)) 502 (setq text (win32-get-clipboard-data))
502 (error (message "win32-get-clipboard-data:%s" c))) 503 (error (message "win32-get-clipboard-data:%s" c)))
503 (if (string= text "") (setq text nil)) 504 (if (string= text "") (setq text nil))
504 text))) 505 (cond
506 ((not text) nil)
507 ((eq text x-last-selected-text) nil)
508 ((string= text x-last-selected-text)
509 ;; Record the newer string, so subsequent calls can use the 'eq' test.
510 (setq x-last-selected-text text)
511 nil)
512 (t
513 (setq x-last-selected-text text))))))
505 514
506;;; Do the actual Windows setup here; the above code just defines 515;;; Do the actual Windows setup here; the above code just defines
507;;; functions and variables that we use now. 516;;; functions and variables that we use now.