aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/emacs/killing.texi4
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/select.el3
-rw-r--r--lisp/term/w32-win.el2
4 files changed, 12 insertions, 1 deletions
diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi
index 47de0531292..0b5efd04a18 100644
--- a/doc/emacs/killing.texi
+++ b/doc/emacs/killing.texi
@@ -519,6 +519,10 @@ when exiting Emacs; if you wish to prevent Emacs from transferring
519data to the clipboard manager, change the variable 519data to the clipboard manager, change the variable
520@code{x-select-enable-clipboard-manager} to @code{nil}. 520@code{x-select-enable-clipboard-manager} to @code{nil}.
521 521
522 Since strings containing NUL bytes are usually truncated when passed
523through the clipboard, Emacs replaces such characters with ``\0''
524before transfering them to the system's clipboard.
525
522@vindex select-enable-primary 526@vindex select-enable-primary
523@findex clipboard-kill-region 527@findex clipboard-kill-region
524@findex clipboard-kill-ring-save 528@findex clipboard-kill-ring-save
diff --git a/etc/NEWS b/etc/NEWS
index 319b40f5d1a..dc9393c87d4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -326,6 +326,10 @@ The old behaviour of using 'prin1' can be restored by customizing the
326new option 'debugger-print-function'. 326new option 'debugger-print-function'.
327 327
328+++ 328+++
329** NUL bytes in strings copied to the system clipboard are now
330replaced with "\0".
331
332+++
329** The new variable 'x-ctrl-keysym' has been added to the existing 333** The new variable 'x-ctrl-keysym' has been added to the existing
330roster of X keysyms. It can be used in combination with another 334roster of X keysyms. It can be used in combination with another
331variable of this kind to swap modifiers in Emacs. 335variable of this kind to swap modifiers in Emacs.
diff --git a/lisp/select.el b/lisp/select.el
index 4849d7d515e..579c5c7e2ee 100644
--- a/lisp/select.el
+++ b/lisp/select.el
@@ -475,6 +475,9 @@ two markers or an overlay. Otherwise, it is nil."
475 (t 475 (t
476 (error "Unknown selection type: %S" type))))) 476 (error "Unknown selection type: %S" type)))))
477 477
478 ;; Most programs are unable to handle NUL bytes in strings.
479 (setq str (replace-regexp-in-string "\0" "\\0" str t t))
480
478 (setq next-selection-coding-system nil) 481 (setq next-selection-coding-system nil)
479 (cons type str)))) 482 (cons type str))))
480 483
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index fda93884c40..be895a040da 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -396,7 +396,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
396;;; Fix interface to (X-specific) mouse.el 396;;; Fix interface to (X-specific) mouse.el
397(defun w32--set-selection (type value) 397(defun w32--set-selection (type value)
398 (if (eq type 'CLIPBOARD) 398 (if (eq type 'CLIPBOARD)
399 (w32-set-clipboard-data value) 399 (w32-set-clipboard-data (replace-regexp-in-string "\0" "\\0" value t t))
400 (put 'x-selections (or type 'PRIMARY) value))) 400 (put 'x-selections (or type 'PRIMARY) value)))
401 401
402(defun w32--get-selection (&optional type data-type) 402(defun w32--get-selection (&optional type data-type)