mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-04-25 15:52:01 -07:00
(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.
This commit is contained in:
parent
bf8aeaf981
commit
b2b9ff5e6d
1 changed files with 11 additions and 2 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue