[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master e5cdb5c: Revert "Disable bracketed paste in a termi
From: |
Daniel Colascione |
Subject: |
[Emacs-diffs] master e5cdb5c: Revert "Disable bracketed paste in a terminal in char mode" |
Date: |
Thu, 3 Nov 2016 04:18:30 +0000 (UTC) |
branch: master
commit e5cdb5ce7d4ad96b7cd5ca7888e34076b9267eee
Author: Daniel Colascione <address@hidden>
Commit: Daniel Colascione <address@hidden>
Revert "Disable bracketed paste in a terminal in char mode"
This change causes regressions, and besides, disabling BPM frame-wide
for the sake of one buffer is the wrong solution.
This reverts commit cf566b46a6cf85c6d54d0b0db80e32ed6ae8d1ca.
---
lisp/term.el | 7 ----
lisp/term/xterm.el | 90 ++++++----------------------------------------------
2 files changed, 9 insertions(+), 88 deletions(-)
diff --git a/lisp/term.el b/lisp/term.el
index 5177ab4..c067254 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1247,11 +1247,6 @@ intervention from Emacs, except for the escape character
(usually C-c)."
(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 ()
@@ -1261,8 +1256,6 @@ you type \\[term-send-input] which sends the current line
to the inferior."
(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 faf8991..01c0113 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -24,8 +24,6 @@
;;; Code:
-(require 'cl-lib)
-
(defgroup xterm nil
"XTerm support."
:version "24.1"
@@ -767,78 +765,6 @@ We run the first FUNCTION whose STRING matches the input
events."
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 buffer.
-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
@@ -876,8 +802,9 @@ return nil. If there is no such buffer, return non-nil."
(when (memq 'setSelection xterm-extra-capabilities)
(xterm--init-activate-set-selection)))
- (add-hook 'window-configuration-change-hook #'xterm--update-bracketed-paste)
- (xterm--update-bracketed-paste)
+ ;; Unconditionally enable bracketed paste mode: terminals that don't
+ ;; support it just ignore the sequence.
+ (xterm--init-bracketed-paste-mode)
(run-hooks 'terminal-init-xterm-hook))
@@ -887,6 +814,12 @@ return nil. If there is no such buffer, return non-nil."
(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))
@@ -1067,11 +1000,6 @@ versions of xterm."
(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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master e5cdb5c: Revert "Disable bracketed paste in a terminal in char mode",
Daniel Colascione <=