summaryrefslogtreecommitdiff
path: root/lisp/select.el
diff options
context:
space:
mode:
authorYuuki Harano <masm+github@masm11.me>2021-07-18 18:44:54 +0900
committerYuuki Harano <masm+github@masm11.me>2021-07-18 18:44:54 +0900
commitb242394f24b154f8e20f5abf4b2f826629e99ea6 (patch)
tree9d20e7baa90bd4039ff08c098a09a8c729ce2f12 /lisp/select.el
parent492a0ae5927eda83b65dd08d3e1655a62fc2c43d (diff)
parent6b802a08cabfb23bdf1f65faa2ee163d3efa820d (diff)
downloademacs-b242394f24b154f8e20f5abf4b2f826629e99ea6.tar.gz
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'lisp/select.el')
-rw-r--r--lisp/select.el16
1 files changed, 11 insertions, 5 deletions
diff --git a/lisp/select.el b/lisp/select.el
index 72f03e76c48..ab744efcf09 100644
--- a/lisp/select.el
+++ b/lisp/select.el
@@ -187,11 +187,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)