diff options
Diffstat (limited to 'lisp/select.el')
-rw-r--r-- | lisp/select.el | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lisp/select.el b/lisp/select.el index c39bc93deab..15e171c13f9 100644 --- a/lisp/select.el +++ b/lisp/select.el @@ -184,11 +184,17 @@ decoded. If `gui-get-selection' signals an error, return nil." (let ((clip-text (when select-enable-clipboard (let ((text (gui--selection-value-internal 'CLIPBOARD))) - (if (string= text "") (setq text nil)) - - ;; Check the CLIPBOARD selection for 'newness', is it different - ;; from what we remembered them to be last time we did a - ;; cut/paste operation. + (when (string= text "") + (setq text nil)) + ;; When `select-enable-clipboard' is non-nil, + ;; killing/copying text (with, say, `C-w') will push the + ;; text to the clipboard (and store it in + ;; `gui--last-selected-text-clipboard'). We check + ;; whether the text on the clipboard is identical to this + ;; text, and if so, we report that the clipboard is + ;; empty. See (bug#27442) for further discussion about + ;; this DWIM action, and possible ways to make this check + ;; less fragile, if so desired. (prog1 (unless (equal text gui--last-selected-text-clipboard) text) @@ -490,7 +496,7 @@ two markers or an overlay. Otherwise, it is nil." (error "Unknown selection type: %S" type))))) ;; Most programs are unable to handle NUL bytes in strings. - (setq str (replace-regexp-in-string "\0" "\\0" str t t)) + (setq str (string-replace "\0" "\\0" str)) (setq next-selection-coding-system nil) (cons type str)))) |