diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-08-19 16:48:59 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-08-19 16:48:59 -0700 |
commit | 07fcbb558d797272b9f43547da60beda485873a3 (patch) | |
tree | 77d5da14e9f9d9d8b1d877c70c01296fd3893796 /lisp/select.el | |
parent | c9bdeff3e45a7ac84a74a81bb048046f82dddc91 (diff) | |
parent | fb81c8c3adf8633f2f617c82f6019aef630860c7 (diff) | |
download | emacs-07fcbb558d797272b9f43547da60beda485873a3.tar.gz |
Merge remote-tracking branch 'origin/master' into athena/unstable
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)))) |