[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master e1c893f: Allow not putting pasted text onto the kill ring under x
From: |
Lars Ingebrigtsen |
Subject: |
master e1c893f: Allow not putting pasted text onto the kill ring under xterm |
Date: |
Fri, 3 Sep 2021 03:47:23 -0400 (EDT) |
branch: master
commit e1c893f4a3ae005a76f34d2393fccb9a219abed1
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Allow not putting pasted text onto the kill ring under xterm
* lisp/term/xterm.el (xterm-paste): Don't put pasted text onto the
kill ring (bug#28868).
(xterm-store-paste-on-kill-ring): New user option.
---
etc/NEWS | 7 +++++++
lisp/term/xterm.el | 19 ++++++++++++++++---
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index bf371a1..0fe988a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3152,6 +3152,13 @@ It used to be mapped to 'print' but we couldn't find a
terminal
that uses this sequence for any kind of 'Print' key.
This makes the Menu key (see https://en.wikipedia.org/wiki/Menu_key)
work for `context-menu-mode` in Xterm.
+
+---
+** New user option 'xterm-store-paste-on-kill-ring'.
+If non-nil (the default), Emacs pushes pasted text onto the kill ring
+(if using an xterm-like terminal that supports bracketed paste).
+Setting this to nil inhibits that.
+
* Incompatible Lisp Changes in Emacs 28.1
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 43a89ff..de5f000 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -73,6 +73,13 @@ string bytes that can be copied is 3/4 of this value."
:version "27.1"
:type 'boolean)
+(defcustom xterm-store-paste-on-kill-ring t
+ "If non-nil, pasting text into Emacs will put the text onto the kill ring.
+This user option is only heeded when using a terminal using xterm
+capabilities, and only when that terminal understands bracketed paste."
+ :version "28.1"
+ :type 'boolean)
+
(defconst xterm-paste-ending-sequence "\e[201~"
"Characters sent by the terminal to end a bracketed paste.")
@@ -100,9 +107,15 @@ Return the pasted text as a string."
(interactive "e")
(unless (eq (car-safe event) 'xterm-paste)
(error "xterm-paste must be found to xterm-paste event"))
- (let* ((pasted-text (nth 1 event))
- (interprogram-paste-function (lambda () pasted-text)))
- (yank)))
+ (let ((pasted-text (nth 1 event)))
+ (if xterm-store-paste-on-kill-ring
+ ;; Put the text onto the kill ring and then insert it into the
+ ;; buffer.
+ (let ((interprogram-paste-function (lambda () pasted-text)))
+ (yank))
+ ;; Insert the text without putting it onto the kill ring.
+ (push-mark)
+ (insert-for-yank pasted-text))))
;; Put xterm-paste itself in global-map because, after translation,
;; it's just a normal input event.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master e1c893f: Allow not putting pasted text onto the kill ring under xterm,
Lars Ingebrigtsen <=