* bug#24639: 26.0.50; Terminal paste doesn't work right in term char mode
@ 2016-10-07 18:02 Philipp
2016-10-07 19:05 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Philipp @ 2016-10-07 18:02 UTC (permalink / raw)
To: 24639
In a GNOME Terminal window, run
emacs -nw -Q -f term
RET to start the terminal. Make sure it's in char mode. Select
some text in another X window. Go back to the Emacs term buffer, press
middle click, then press RET.
Expected behavior: Selected text gets inserted and interpreted as shell
command.
Actual behavior in Emacs 24.3: Expected behavior.
Actual behavior in Emacs built from master branch: Selected text gets
inserted, but not interpreted as shell command (i.e. nothing happens
after pressing RET).
This appears to be a regression, possibly caused by
bracketed-paste-mode.
In GNU Emacs 26.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
of 2016-10-07 built on localhost
Repository revision: d48369db9c97b6f2accf702e5bbe0bda11cb92a1
Windowing system distributor 'The X.Org Foundation', version 11.0.11702000
System Description: Ubuntu 14.04 LTS
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Configured features:
XPM JPEG TIFF GIF PNG SOUND GSETTINGS NOTIFY GNUTLS FREETYPE XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message subr-x puny seq byte-opt gv
bytecomp byte-compile cl-extra help-mode cconv cl-loaddefs pcase cl-lib
dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec
password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)
Memory information:
((conses 16 97221 7197)
(symbols 48 20242 0)
(miscs 40 330 118)
(strings 32 17818 3448)
(string-bytes 1 578527)
(vectors 16 13700)
(vector-slots 8 448602 7351)
(floats 8 181 64)
(intervals 56 190 0)
(buffers 976 11)
(heap 1024 48904 1169))
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#24639: 26.0.50; Terminal paste doesn't work right in term char mode
2016-10-07 18:02 bug#24639: 26.0.50; Terminal paste doesn't work right in term char mode Philipp
@ 2016-10-07 19:05 ` Eli Zaretskii
2016-10-07 19:19 ` Philipp Stephani
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2016-10-07 19:05 UTC (permalink / raw)
To: Philipp; +Cc: 24639
> From: Philipp <p.stephani2@gmail.com>
> Date: Fri, 07 Oct 2016 20:02:45 +0200
>
> emacs -nw -Q -f term
>
> RET to start the terminal. Make sure it's in char mode. Select
> some text in another X window. Go back to the Emacs term buffer, press
> middle click, then press RET.
> Expected behavior: Selected text gets inserted and interpreted as shell
> command.
> Actual behavior in Emacs 24.3: Expected behavior.
> Actual behavior in Emacs built from master branch: Selected text gets
> inserted, but not interpreted as shell command (i.e. nothing happens
> after pressing RET).
>
> This appears to be a regression, possibly caused by
> bracketed-paste-mode.
Does it help to disable the bracketed-paste-mode in term.el?
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#24639: 26.0.50; Terminal paste doesn't work right in term char mode
2016-10-07 19:05 ` Eli Zaretskii
@ 2016-10-07 19:19 ` Philipp Stephani
2016-10-07 19:25 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Philipp Stephani @ 2016-10-07 19:19 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 24639
[-- Attachment #1: Type: text/plain, Size: 999 bytes --]
Eli Zaretskii <eliz@gnu.org> schrieb am Fr., 7. Okt. 2016 um 21:05 Uhr:
> > From: Philipp <p.stephani2@gmail.com>
> > Date: Fri, 07 Oct 2016 20:02:45 +0200
> >
> > emacs -nw -Q -f term
> >
> > RET to start the terminal. Make sure it's in char mode. Select
> > some text in another X window. Go back to the Emacs term buffer, press
> > middle click, then press RET.
> > Expected behavior: Selected text gets inserted and interpreted as shell
> > command.
> > Actual behavior in Emacs 24.3: Expected behavior.
> > Actual behavior in Emacs built from master branch: Selected text gets
> > inserted, but not interpreted as shell command (i.e. nothing happens
> > after pressing RET).
> >
> > This appears to be a regression, possibly caused by
> > bracketed-paste-mode.
>
> Does it help to disable the bracketed-paste-mode in term.el?
>
Yes, uncommenting (xterm--init-bracketed-paste-mode) in term/xterm.el fixes
the issue. Maybe M-x term should temporarily bracketed paste mode when in
char mode.
[-- Attachment #2: Type: text/html, Size: 1801 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#24639: 26.0.50; Terminal paste doesn't work right in term char mode
2016-10-07 19:19 ` Philipp Stephani
@ 2016-10-07 19:25 ` Eli Zaretskii
2016-10-07 20:19 ` Philipp Stephani
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2016-10-07 19:25 UTC (permalink / raw)
To: Philipp Stephani; +Cc: 24639
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Fri, 07 Oct 2016 19:19:28 +0000
> Cc: 24639@debbugs.gnu.org
>
> Maybe M-x term should temporarily bracketed paste mode when in char
> mode.
That's what I was trying to suggest. Does this have downsides?
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#24639: 26.0.50; Terminal paste doesn't work right in term char mode
2016-10-07 19:25 ` Eli Zaretskii
@ 2016-10-07 20:19 ` Philipp Stephani
2016-10-08 5:27 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Philipp Stephani @ 2016-10-07 20:19 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 24639
[-- Attachment #1: Type: text/plain, Size: 474 bytes --]
Eli Zaretskii <eliz@gnu.org> schrieb am Fr., 7. Okt. 2016 um 21:25 Uhr:
> > From: Philipp Stephani <p.stephani2@gmail.com>
> > Date: Fri, 07 Oct 2016 19:19:28 +0000
> > Cc: 24639@debbugs.gnu.org
> >
> > Maybe M-x term should temporarily bracketed paste mode when in char
> > mode.
>
> That's what I was trying to suggest. Does this have downsides?
>
I wouldn't expect any. Bracketed paste mode is a bit faster, but running a
bit slower is better than not working at all.
[-- Attachment #2: Type: text/html, Size: 1093 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#24639: 26.0.50; Terminal paste doesn't work right in term char mode
2016-10-07 20:19 ` Philipp Stephani
@ 2016-10-08 5:27 ` Eli Zaretskii
2016-10-09 20:48 ` Philipp Stephani
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2016-10-08 5:27 UTC (permalink / raw)
To: Philipp Stephani; +Cc: 24639
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Fri, 07 Oct 2016 20:19:47 +0000
> Cc: 24639@debbugs.gnu.org
>
> > Maybe M-x term should temporarily bracketed paste mode when in char
> > mode.
>
> That's what I was trying to suggest. Does this have downsides?
>
> I wouldn't expect any. Bracketed paste mode is a bit faster, but running a bit slower is better than not working
> at all.
Then please push such a change to the emacs-25 branch.
Thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#24639: 26.0.50; Terminal paste doesn't work right in term char mode
2016-10-08 5:27 ` Eli Zaretskii
@ 2016-10-09 20:48 ` Philipp Stephani
2016-10-10 5:56 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Philipp Stephani @ 2016-10-09 20:48 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 24639
[-- Attachment #1: Type: text/plain, Size: 814 bytes --]
Eli Zaretskii <eliz@gnu.org> schrieb am Sa., 8. Okt. 2016 um 07:27 Uhr:
> > From: Philipp Stephani <p.stephani2@gmail.com>
>
> > Date: Fri, 07 Oct 2016 20:19:47 +0000
>
> > Cc: 24639@debbugs.gnu.org
>
> >
>
> > > Maybe M-x term should temporarily bracketed paste mode when in char
>
> > > mode.
>
> >
>
> > That's what I was trying to suggest. Does this have downsides?
>
> >
>
> > I wouldn't expect any. Bracketed paste mode is a bit faster, but running
> a bit slower is better than not working
>
> > at all.
>
>
>
> Then please push such a change to the emacs-25 branch.
>
>
>
Unfortunately it's not that simple: Bracketed paste more should only be
disabled when a term buffer is active on an xterm and in char mode. So this
will probably require an addition to window-configuration-change-hook or
similar.
[-- Attachment #2: Type: text/html, Size: 1566 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#24639: 26.0.50; Terminal paste doesn't work right in term char mode
2016-10-09 20:48 ` Philipp Stephani
@ 2016-10-10 5:56 ` Eli Zaretskii
2016-10-15 13:25 ` Philipp Stephani
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2016-10-10 5:56 UTC (permalink / raw)
To: Philipp Stephani; +Cc: 24639
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Sun, 09 Oct 2016 20:48:59 +0000
> Cc: 24639@debbugs.gnu.org
>
> > > Maybe M-x term should temporarily bracketed paste mode when in char
> > > mode.
> >
> > That's what I was trying to suggest. Does this have downsides?
> >
> > I wouldn't expect any. Bracketed paste mode is a bit faster, but running a bit slower is better than not
> working
> > at all.
>
> Then please push such a change to the emacs-25 branch.
>
> Unfortunately it's not that simple: Bracketed paste more should only be disabled when a term buffer is active
> on an xterm and in char mode. So this will probably require an addition to window-configuration-change-hook
> or similar.
Sorry, I don't understand the reasons for the complication. The "in
char mode" part was already on the table when we discussed this
previously. Presumably, there's a function in term-mode which
switches to and from char mode, and that function should turn
bracketed paste mode on or off, accordingly. Is that right?
For the "term buffer is active" part, do you mean re-enable the
bracketed paste mode when the user switches to another buffer? If so,
won't it be easier, simpler, and more reliable to do that in a
post-command-hook?
Or maybe it's easier to arrange for xterm-paste to realize the current
buffer is in term char mode, and do the "normal" paste part? Is that
possible?
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#24639: 26.0.50; Terminal paste doesn't work right in term char mode
2016-10-10 5:56 ` Eli Zaretskii
@ 2016-10-15 13:25 ` Philipp Stephani
2016-10-15 14:31 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Philipp Stephani @ 2016-10-15 13:25 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 24639
[-- Attachment #1.1: Type: text/plain, Size: 1344 bytes --]
Eli Zaretskii <eliz@gnu.org> schrieb am Mo., 10. Okt. 2016 um 07:56 Uhr:
> > From: Philipp Stephani <p.stephani2@gmail.com>
>
> > Date: Sun, 09 Oct 2016 20:48:59 +0000
>
> > Cc: 24639@debbugs.gnu.org
>
> >
>
> > > > Maybe M-x term should temporarily bracketed paste mode when in char
>
> > > > mode.
>
> > >
>
> > > That's what I was trying to suggest. Does this have downsides?
>
> > >
>
> > > I wouldn't expect any. Bracketed paste mode is a bit faster, but
> running a bit slower is better than not
>
> > working
>
> > > at all.
>
> >
>
> > Then please push such a change to the emacs-25 branch.
>
> >
>
> > Unfortunately it's not that simple: Bracketed paste more should only be
> disabled when a term buffer is active
>
> > on an xterm and in char mode. So this will probably require an addition
> to window-configuration-change-hook
>
> > or similar.
>
>
>
> Sorry, I don't understand the reasons for the complication. The "in
>
> char mode" part was already on the table when we discussed this
>
> previously. Presumably, there's a function in term-mode which
>
> switches to and from char mode, and that function should turn
>
> bracketed paste mode on or off, accordingly. Is that right?
>
>
>
>
The complication arises because char-mode is per-buffer, but bracketed
paste mode is per terminal. I've attached a patch now.
[-- Attachment #1.2: Type: text/html, Size: 2418 bytes --]
[-- Attachment #2: 0001-Disable-bracketed-paste-in-a-terminal-in-char-mode.txt --]
[-- Type: text/plain, Size: 7614 bytes --]
From ceb210fee033f59bb2f80a80cc1b988996933700 Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Sat, 15 Oct 2016 15:19:56 +0200
Subject: [PATCH] Disable bracketed paste in a terminal in char mode
In char mode, a terminal doesn't accept bracketed paste events,
therefore we should disable them; see Bug#24639. To decouple the XTerm
management from term.el, introduce a per-buffer setting to disable
bracketed paste for that buffer. If bracketed paste is inhiited for at
least one buffer in a terminal, it is disabled for the whole terminal.
* term/xterm.el (xterm-inhibit-bracketed-paste-mode): New mode to
inhibit XTerm bracketed paste per buffer.
(xterm--buffer-terminals, xterm--update-bracketed-paste)
(xterm--bracketed-paste-possible, xterm--is-xterm): New helper
functions.
(xterm--init-bracketed-paste-mode): Remove unused helper
function.
(terminal-init-xterm): Update bracketed paste status when
initializing an XTerm and on window configuration change.
* term.el (term-char-mode, term-line-mode): Inhibit XTerm
bracketed paste in char mode.
---
lisp/term.el | 7 +++++
lisp/term/xterm.el | 88 ++++++++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 86 insertions(+), 9 deletions(-)
diff --git a/lisp/term.el b/lisp/term.el
index f477bcc..fcaa01d 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1246,6 +1246,11 @@ term-char-mode
(end-of-line)
(term-send-input))
(setq term-input-sender save-input-sender))))
+
+ ;; Turn off XTerm bracketed paste (Bug#24639).
+ (when (fboundp 'xterm-inhibit-bracketed-paste-mode)
+ (xterm-inhibit-bracketed-paste-mode))
+
(term-update-mode-line)))
(defun term-line-mode ()
@@ -1255,6 +1260,8 @@ term-line-mode
(interactive)
(when (term-in-char-mode)
(use-local-map term-old-mode-map)
+ (when (fboundp 'xterm-inhibit-bracketed-paste-mode)
+ (xterm-inhibit-bracketed-paste-mode 0))
(term-update-mode-line)))
(defun term-update-mode-line ()
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 19eb37a..5292e65 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -752,6 +752,78 @@ xterm--push-map
basemap
(make-composed-keymap map (keymap-parent basemap))))
+(define-minor-mode xterm-inhibit-bracketed-paste-mode
+ "Toggle whether XTerm bracketed paste should be allowed in this bugger.
+With a prefix argument ARG, forbid bracketed paste if ARG is
+positive, and allow it otherwise. If called from Lisp, forbid
+bracketed paste if ARG is omitted or nil, and toggle the state of
+ARG is `toggle'. If XTerm bracketed paste is allowed (the
+default), it will be used to paste text from an X selection upon
+reception of the `xterm-paste' event. Otherwise the selection
+will be inserted character by character, which is much slower.
+Therefore, bracketed paste should only be disabled in buffers
+that can't deal with the `xterm-paste' event, such as terminal
+emulation buffers."
+ :group xterm
+ ;; Update the bracketed paste flag in all terminals that display the
+ ;; current buffer.
+ (mapc #'xterm--update-bracketed-paste (xterm--buffer-terminals)))
+
+(defun xterm--buffer-terminals (&optional buffer)
+ "Return all terminals that contain a window that displays BUFFER.
+BUFFER defaults to the current buffer."
+ (cl-delete-duplicates
+ (cl-loop for window in (get-buffer-window-list buffer nil t)
+ for terminal = (frame-terminal (window-frame window))
+ collect terminal)
+ :test 'eq))
+
+(defun xterm--update-bracketed-paste (&optional terminal)
+ "Enable or disable bracketed paste for TERMINAL.
+TERMINAL must be a live terminal; it defaults to the terminal
+displaying the selected frame. If any buffer displayed on the
+frames of TERMINAL inhibits bracketed paste by enabling
+`xterm-inhibit-bracketed-paste-mode', disable bracketed paste for
+TERMINAL. If there is no such buffer, enable bracketed paste."
+ (unless terminal (setq terminal (frame-terminal)))
+ (cl-check-type terminal terminal-live)
+ (when (xterm--is-xterm terminal)
+ (cl-symbol-macrolet
+ ((enabled-param (terminal-parameter terminal 'xterm--bracketed-paste))
+ (set-strings-param (terminal-parameter terminal 'tty-mode-set-strings))
+ (reset-strings-param
+ (terminal-parameter terminal 'tty-mode-reset-strings)))
+ (let ((is-enabled enabled-param)
+ (should-enable (xterm--bracketed-paste-possible terminal))
+ (enable-seq "\e[?2004h")
+ (disable-seq "\e[?2004l"))
+ (cond
+ ;; Unconditionally send terminal sequences: terminals that
+ ;; don't support bracketed paste just ignore the sequences.
+ ((and (not is-enabled) should-enable)
+ (send-string-to-terminal enable-seq terminal)
+ (push disable-seq reset-strings-param)
+ (push enable-seq set-strings-param)
+ (setq enabled-param t))
+ ((and is-enabled (not should-enable))
+ (send-string-to-terminal disable-seq)
+ (cl-callf2 delete disable-seq reset-strings-param)
+ (cl-callf2 delete enable-seq set-strings-param)
+ (setq enabled-param nil)))))))
+
+(defun xterm--bracketed-paste-possible (terminal)
+ "Return non-nil if bracketed paste could be enabled on TERMINAL.
+If any buffer displayed on the frames of TERMINAL inhibits
+bracketed paste by enabling `xterm-inhibit-bracketed-paste-mode',
+return nil. If there is no such buffer, return non-nil."
+ (cl-check-type terminal terminal-live)
+ (cl-loop for frame being the frames
+ if (eq (frame-terminal frame) terminal)
+ always (cl-loop
+ for window being the windows of frame
+ never (buffer-local-value 'xterm-inhibit-bracketed-paste-mode
+ (window-buffer window)))))
+
(defun terminal-init-xterm ()
"Terminal initialization function for xterm."
;; rxvt terminals sometimes set the TERM variable to "xterm", but
@@ -789,9 +861,8 @@ terminal-init-xterm
(when (memq 'setSelection xterm-extra-capabilities)
(xterm--init-activate-set-selection)))
- ;; Unconditionally enable bracketed paste mode: terminals that don't
- ;; support it just ignore the sequence.
- (xterm--init-bracketed-paste-mode)
+ (add-hook 'window-configuration-change-hook #'xterm--update-bracketed-paste)
+ (xterm--update-bracketed-paste)
(run-hooks 'terminal-init-xterm-hook))
@@ -801,12 +872,6 @@ xterm--init-modify-other-keys
(push "\e[>4m" (terminal-parameter nil 'tty-mode-reset-strings))
(push "\e[>4;1m" (terminal-parameter nil 'tty-mode-set-strings)))
-(defun xterm--init-bracketed-paste-mode ()
- "Terminal initialization for bracketed paste mode."
- (send-string-to-terminal "\e[?2004h")
- (push "\e[?2004l" (terminal-parameter nil 'tty-mode-reset-strings))
- (push "\e[?2004h" (terminal-parameter nil 'tty-mode-set-strings)))
-
(defun xterm--init-activate-get-selection ()
"Terminal initialization for `gui-get-selection'."
(set-terminal-parameter nil 'xterm--get-selection t))
@@ -987,6 +1052,11 @@ xterm-maybe-set-dark-background-mode
(set-terminal-parameter nil 'background-mode 'dark)
t))
+(defun xterm--is-xterm (&optional terminal)
+ "Return non-nil if TERMINAL is an XTerm-like terminal.
+TERMINAL defaults to the terminal of the selected frame."
+ (eq (terminal-parameter terminal 'terminal-initted) 'terminal-init-xterm))
+
(provide 'xterm) ;Backward compatibility.
(provide 'term/xterm)
;;; xterm.el ends here
--
2.10.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* bug#24639: 26.0.50; Terminal paste doesn't work right in term char mode
2016-10-15 13:25 ` Philipp Stephani
@ 2016-10-15 14:31 ` Eli Zaretskii
2016-10-15 14:38 ` Philipp Stephani
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2016-10-15 14:31 UTC (permalink / raw)
To: Philipp Stephani; +Cc: 24639
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Sat, 15 Oct 2016 13:25:18 +0000
> Cc: 24639@debbugs.gnu.org
>
> The complication arises because char-mode is per-buffer, but bracketed paste mode is per terminal. I've
> attached a patch now.
Frankly, I hoped for a simpler solution that doesn't involve so much
non-trivial code.
I plan to release Emacs 25.2 very soon, like in a few weeks. If you
are okay with installing this on the release branch given that
schedule, please go ahead.
Thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#24639: 26.0.50; Terminal paste doesn't work right in term char mode
2016-10-15 14:31 ` Eli Zaretskii
@ 2016-10-15 14:38 ` Philipp Stephani
2016-10-15 15:07 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Philipp Stephani @ 2016-10-15 14:38 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 24639
[-- Attachment #1: Type: text/plain, Size: 680 bytes --]
Eli Zaretskii <eliz@gnu.org> schrieb am Sa., 15. Okt. 2016 um 16:31 Uhr:
> > From: Philipp Stephani <p.stephani2@gmail.com>
>
> > Date: Sat, 15 Oct 2016 13:25:18 +0000
>
> > Cc: 24639@debbugs.gnu.org
>
> >
>
> > The complication arises because char-mode is per-buffer, but bracketed
> paste mode is per terminal. I've
>
> > attached a patch now.
>
>
>
> Frankly, I hoped for a simpler solution that doesn't involve so much
>
> non-trivial code.
>
>
>
> I plan to release Emacs 25.2 very soon, like in a few weeks. If you
>
> are okay with installing this on the release branch given that
>
> schedule, please go ahead.
>
>
>
I can also install it on master, if you prefer that.
[-- Attachment #2: Type: text/html, Size: 1408 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#24639: 26.0.50; Terminal paste doesn't work right in term char mode
2016-10-15 14:38 ` Philipp Stephani
@ 2016-10-15 15:07 ` Eli Zaretskii
2016-11-06 18:43 ` Philipp Stephani
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2016-10-15 15:07 UTC (permalink / raw)
To: Philipp Stephani; +Cc: 24639
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Sat, 15 Oct 2016 14:38:57 +0000
> Cc: 24639@debbugs.gnu.org
>
> Frankly, I hoped for a simpler solution that doesn't involve so much
> non-trivial code.
> I plan to release Emacs 25.2 very soon, like in a few weeks. If you
> are okay with installing this on the release branch given that
> schedule, please go ahead.
>
> I can also install it on master, if you prefer that.
I'm okay with installing this on master, but I'd like _some_ solution
on the release branch, because I think it's unreasonable to let users
live with this problem until v26.1 is released.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#24639: 26.0.50; Terminal paste doesn't work right in term char mode
2016-10-15 15:07 ` Eli Zaretskii
@ 2016-11-06 18:43 ` Philipp Stephani
2016-11-06 18:43 ` bug#24639: [PATCH] Send text received by bracketed paste to process Philipp Stephani
0 siblings, 1 reply; 16+ messages in thread
From: Philipp Stephani @ 2016-11-06 18:43 UTC (permalink / raw)
To: eliz; +Cc: 24639
I've finally managed to implement a simpler solution for this.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#24639: [PATCH] Send text received by bracketed paste to process
2016-11-06 18:43 ` Philipp Stephani
@ 2016-11-06 18:43 ` Philipp Stephani
2016-11-07 18:35 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Philipp Stephani @ 2016-11-06 18:43 UTC (permalink / raw)
To: eliz; +Cc: Philipp Stephani, 24639
From: Philipp Stephani <phst@google.com>
Fixes #24639
* term.el (term--xterm-paste): New function.
(term-raw-map): Use it.
(xterm--pasted-text): Declare function from xterm.el.
---
lisp/term.el | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lisp/term.el b/lisp/term.el
index 993e580..18d6775 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -845,6 +845,7 @@ term-raw-map
(define-key map [S-insert] 'term-paste)
(define-key map [prior] 'term-send-prior)
(define-key map [next] 'term-send-next)
+ (define-key map [xterm-paste] #'term--xterm-paste)
map)
"Keyboard map for sending characters directly to the inferior process.")
@@ -1211,6 +1212,13 @@ term-paste
(interactive)
(term-send-raw-string (current-kill 0)))
+(defun term--xterm-paste ()
+ "Insert the text pasted in an XTerm bracketed paste operation."
+ (interactive)
+ (term-send-raw-string (xterm--pasted-text)))
+
+(declare-function xterm--pasted-text "term/xterm" ())
+
;; Which would be better: "\e[A" or "\eOA"? readline accepts either.
;; For my configuration it's definitely better \eOA but YMMV. -mm
;; For example: vi works with \eOA while elm wants \e[A ...
--
2.10.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* bug#24639: [PATCH] Send text received by bracketed paste to process
2016-11-06 18:43 ` bug#24639: [PATCH] Send text received by bracketed paste to process Philipp Stephani
@ 2016-11-07 18:35 ` Eli Zaretskii
2016-11-10 21:57 ` Philipp Stephani
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2016-11-07 18:35 UTC (permalink / raw)
To: Philipp Stephani; +Cc: phst, 24639
> From: Philipp Stephani <p.stephani2@gmail.com>
> Cc: 24639@debbugs.gnu.org,
> Philipp Stephani <phst@google.com>
> Date: Sun, 6 Nov 2016 19:43:05 +0100
>
> From: Philipp Stephani <phst@google.com>
>
> Fixes #24639
>
> * term.el (term--xterm-paste): New function.
> (term-raw-map): Use it.
> (xterm--pasted-text): Declare function from xterm.el.
Thanks. If there are no further comments in a few days, please push
to emacs-25.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#24639: [PATCH] Send text received by bracketed paste to process
2016-11-07 18:35 ` Eli Zaretskii
@ 2016-11-10 21:57 ` Philipp Stephani
0 siblings, 0 replies; 16+ messages in thread
From: Philipp Stephani @ 2016-11-10 21:57 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: phst, 24639-done
[-- Attachment #1: Type: text/plain, Size: 550 bytes --]
Eli Zaretskii <eliz@gnu.org> schrieb am Mo., 7. Nov. 2016 um 19:35 Uhr:
> > From: Philipp Stephani <p.stephani2@gmail.com>
> > Cc: 24639@debbugs.gnu.org,
> > Philipp Stephani <phst@google.com>
> > Date: Sun, 6 Nov 2016 19:43:05 +0100
> >
> > From: Philipp Stephani <phst@google.com>
> >
> > Fixes #24639
> >
> > * term.el (term--xterm-paste): New function.
> > (term-raw-map): Use it.
> > (xterm--pasted-text): Declare function from xterm.el.
>
> Thanks. If there are no further comments in a few days, please push
> to emacs-25.
>
Pushed.
[-- Attachment #2: Type: text/html, Size: 1485 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2016-11-10 21:57 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-07 18:02 bug#24639: 26.0.50; Terminal paste doesn't work right in term char mode Philipp
2016-10-07 19:05 ` Eli Zaretskii
2016-10-07 19:19 ` Philipp Stephani
2016-10-07 19:25 ` Eli Zaretskii
2016-10-07 20:19 ` Philipp Stephani
2016-10-08 5:27 ` Eli Zaretskii
2016-10-09 20:48 ` Philipp Stephani
2016-10-10 5:56 ` Eli Zaretskii
2016-10-15 13:25 ` Philipp Stephani
2016-10-15 14:31 ` Eli Zaretskii
2016-10-15 14:38 ` Philipp Stephani
2016-10-15 15:07 ` Eli Zaretskii
2016-11-06 18:43 ` Philipp Stephani
2016-11-06 18:43 ` bug#24639: [PATCH] Send text received by bracketed paste to process Philipp Stephani
2016-11-07 18:35 ` Eli Zaretskii
2016-11-10 21:57 ` Philipp Stephani
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.