diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2021-07-06 19:25:41 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-07-06 19:25:41 +0200 |
commit | 855fd921201a75a21ff225128a8dced16cd95b52 (patch) | |
tree | d0b6d4323fd54927f11b111d1096f32a86cf81ce /lisp/select.el | |
parent | abe5eb9adda956ccc72af02d714025701e528b55 (diff) | |
download | emacs-855fd921201a75a21ff225128a8dced16cd95b52.tar.gz |
Make `M-x clipboard-yank' work reliably
* lisp/menu-bar.el (clipboard-yank): Make the command work
consistently (bug#27442).
* lisp/select.el (gui-selection-value): Try to explain why the
logic is the way it is.
Diffstat (limited to 'lisp/select.el')
-rw-r--r-- | lisp/select.el | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lisp/select.el b/lisp/select.el index c39bc93deab..eaa74cebd80 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) |