diff options
Diffstat (limited to 'lisp/term')
-rw-r--r-- | lisp/term/AT386.el | 2 | ||||
-rw-r--r-- | lisp/term/README | 8 | ||||
-rw-r--r-- | lisp/term/apollo.el | 5 | ||||
-rw-r--r-- | lisp/term/news.el | 2 | ||||
-rw-r--r-- | lisp/term/screen.el | 11 | ||||
-rw-r--r-- | lisp/term/tvi970.el | 2 | ||||
-rw-r--r-- | lisp/term/vt100.el | 2 | ||||
-rw-r--r-- | lisp/term/vt102.el | 6 | ||||
-rw-r--r-- | lisp/term/vt125.el | 6 | ||||
-rw-r--r-- | lisp/term/vt201.el | 10 | ||||
-rw-r--r-- | lisp/term/vt220.el | 10 | ||||
-rw-r--r-- | lisp/term/vt240.el | 10 | ||||
-rw-r--r-- | lisp/term/vt300.el | 8 | ||||
-rw-r--r-- | lisp/term/vt320.el | 8 | ||||
-rw-r--r-- | lisp/term/vt400.el | 8 | ||||
-rw-r--r-- | lisp/term/vt420.el | 8 | ||||
-rw-r--r-- | lisp/term/wyse50.el | 1 | ||||
-rw-r--r-- | lisp/term/xterm.el | 151 |
18 files changed, 122 insertions, 136 deletions
diff --git a/lisp/term/AT386.el b/lisp/term/AT386.el index 9750da15c72..dc6899e3835 100644 --- a/lisp/term/AT386.el +++ b/lisp/term/AT386.el @@ -22,8 +22,6 @@ ;;; Commentary: -;; Uses the Emacs 19 terminal initialization features --- won't work with 18. - ;;; Code: (defun terminal-init-AT386 () diff --git a/lisp/term/README b/lisp/term/README index b8756c3873d..b523063c0fd 100644 --- a/lisp/term/README +++ b/lisp/term/README @@ -5,9 +5,11 @@ See the end of the file for license conditions. This directory contains files of elisp that customize Emacs for certain terminal types. - When Emacs opens a new terminal, it checks the TERM environment variable to -see what type of terminal the user is running on, searches for an elisp file -named "term/${TERM}.el", and if one exists, loads it. If Emacs finds no + When Emacs opens a new terminal, it checks the TERM environment variable +to see what type of terminal the user is running on. (If there is an entry +for TERM in the `term-file-aliases' variable, Emacs uses the associated value +in place of TERM in the following.) Emacs searches for an elisp file named +"term/${TERM}.el", and if one exists, loads it. If Emacs finds no suitable file, then it strips the last hyphen and what follows it from TERM, and tries again. If that still doesn't yield a file, then the previous hyphen is stripped, and so on until all hyphens are gone. For example, if the diff --git a/lisp/term/apollo.el b/lisp/term/apollo.el deleted file mode 100644 index e4cabac3bf1..00000000000 --- a/lisp/term/apollo.el +++ /dev/null @@ -1,5 +0,0 @@ -(defun terminal-init-apollo () - "Terminal initialization function for apollo." - (tty-run-terminal-initialization (selected-frame) "vt100")) - -;;; apollo.el ends here diff --git a/lisp/term/news.el b/lisp/term/news.el index a58ff76aefe..a1e459a1261 100644 --- a/lisp/term/news.el +++ b/lisp/term/news.el @@ -22,8 +22,6 @@ ;;; Commentary: -;; Uses the Emacs 19 terminal initialization features --- won't work with 18. - ;;; Code: (defun terminal-init-news () diff --git a/lisp/term/screen.el b/lisp/term/screen.el index d37a695086a..69ddda80983 100644 --- a/lisp/term/screen.el +++ b/lisp/term/screen.el @@ -1,12 +1,9 @@ -;; Treat a screen terminal similar to an xterm. -(load "term/xterm") - -(declare-function xterm-register-default-colors "xterm" ()) +;;; screen.el --- terminal initialization for screen and tmux -*- lexical-binding: t -*- +;; Copyright (C) 1995, 2001-2014 Free Software Foundation, Inc. (defun terminal-init-screen () "Terminal initialization function for screen." - ;; Use the xterm color initialization code. - (xterm-register-default-colors) - (tty-set-up-initial-frame-faces)) + ;; Treat a screen terminal similar to an xterm. + (tty-run-terminal-initialization (selected-frame) "xterm")) ;; screen.el ends here diff --git a/lisp/term/tvi970.el b/lisp/term/tvi970.el index 841d88d4e19..3b77ab46400 100644 --- a/lisp/term/tvi970.el +++ b/lisp/term/tvi970.el @@ -23,8 +23,6 @@ ;;; Commentary: -;; Uses the Emacs 19 terminal initialization features --- won't work with 18. - ;;; Code: (defvar tvi970-terminal-map diff --git a/lisp/term/vt100.el b/lisp/term/vt100.el index 19e64d2bd90..6761e83891e 100644 --- a/lisp/term/vt100.el +++ b/lisp/term/vt100.el @@ -22,8 +22,6 @@ ;;; Commentary: -;; Uses the Emacs 19 terminal initialization features --- won't work with 18. - ;; Handles all VT100 clones, including the Apollo terminal. Also handles ;; the VT200 --- its PF- and arrow- keys are different, but all those ;; are really set up by the terminal initialization code, which mines them diff --git a/lisp/term/vt102.el b/lisp/term/vt102.el deleted file mode 100644 index 261b0bb5fd6..00000000000 --- a/lisp/term/vt102.el +++ /dev/null @@ -1,6 +0,0 @@ - -(defun terminal-init-vt102 () - "Terminal initialization function for vt102." - (tty-run-terminal-initialization (selected-frame) "vt100")) - -;;; vt102.el ends here diff --git a/lisp/term/vt125.el b/lisp/term/vt125.el deleted file mode 100644 index 2b2098d483d..00000000000 --- a/lisp/term/vt125.el +++ /dev/null @@ -1,6 +0,0 @@ - -(defun terminal-init-vt125 () - "Terminal initialization function for vt125." - (tty-run-terminal-initialization (selected-frame) "vt100")) - -;;; vt125.el ends here diff --git a/lisp/term/vt201.el b/lisp/term/vt201.el deleted file mode 100644 index a65b4737731..00000000000 --- a/lisp/term/vt201.el +++ /dev/null @@ -1,10 +0,0 @@ -;; For our purposes we can treat the vt200 and vt100 almost alike. -;; Most differences are handled by the termcap entry. -(defun terminal-init-vt201 () - "Terminal initialization function for vt201." - (tty-run-terminal-initialization (selected-frame) "vt100") - ;; Make F11 an escape key. - (define-key input-decode-map "\e[23~" [f11]) ;Probably redundant. - (define-key local-function-key-map [f11] [?\e])) - -;;; vt201.el ends here diff --git a/lisp/term/vt220.el b/lisp/term/vt220.el deleted file mode 100644 index 0dd43353c55..00000000000 --- a/lisp/term/vt220.el +++ /dev/null @@ -1,10 +0,0 @@ -;; For our purposes we can treat the vt200 and vt100 almost alike. -;; Most differences are handled by the termcap entry. -(defun terminal-init-vt220 () - "Terminal initialization function for vt220." - (tty-run-terminal-initialization (selected-frame) "vt100") - ;; Make F11 an escape key. - (define-key input-decode-map "\e[23~" [f11]) ;Probably redundant. - (define-key local-function-key-map [f11] [?\e])) - -;;; vt220.el ends here diff --git a/lisp/term/vt240.el b/lisp/term/vt240.el deleted file mode 100644 index b58d4211ce7..00000000000 --- a/lisp/term/vt240.el +++ /dev/null @@ -1,10 +0,0 @@ -;; For our purposes we can treat the vt200 and vt100 almost alike. -;; Most differences are handled by the termcap entry. -(defun terminal-init-vt240 () - "Terminal initialization function for vt240." - (tty-run-terminal-initialization (selected-frame) "vt100") - ;; Make F11 an escape key. - (define-key input-decode-map "\e[23~" [f11]) ;Probably redundant. - (define-key local-function-key-map [f11] [?\e])) - -;;; vt240.el ends here diff --git a/lisp/term/vt300.el b/lisp/term/vt300.el deleted file mode 100644 index a2664552a64..00000000000 --- a/lisp/term/vt300.el +++ /dev/null @@ -1,8 +0,0 @@ -(defun terminal-init-vt300 () - "Terminal initialization function for vt300." - (tty-run-terminal-initialization (selected-frame) "vt100") - ;; Make F11 an escape key. - (define-key input-decode-map "\e[23~" [f11]) ;Probably redundant. - (define-key local-function-key-map [f11] [?\e])) - -;;; vt300.el ends here diff --git a/lisp/term/vt320.el b/lisp/term/vt320.el deleted file mode 100644 index 08ed9a8ffb9..00000000000 --- a/lisp/term/vt320.el +++ /dev/null @@ -1,8 +0,0 @@ -(defun terminal-init-vt320 () - "Terminal initialization function for vt320." - (tty-run-terminal-initialization (selected-frame) "vt100") - ;; Make F11 an escape key. - (define-key input-decode-map "\e[23~" [f11]) ;Probably redundant. - (define-key local-function-key-map [f11] [?\e])) - -;;; vt320.el ends here diff --git a/lisp/term/vt400.el b/lisp/term/vt400.el deleted file mode 100644 index ad4a5fdbb4f..00000000000 --- a/lisp/term/vt400.el +++ /dev/null @@ -1,8 +0,0 @@ -(defun terminal-init-vt400 () - "Terminal initialization function for vt400." - (tty-run-terminal-initialization (selected-frame) "vt100") - ;; Make F11 an escape key. - (define-key input-decode-map "\e[23~" [f11]) ;Probably redundant. - (define-key local-function-key-map [f11] [?\e])) - -;;; vt400.el ends here diff --git a/lisp/term/vt420.el b/lisp/term/vt420.el deleted file mode 100644 index f6745a3953a..00000000000 --- a/lisp/term/vt420.el +++ /dev/null @@ -1,8 +0,0 @@ -(defun terminal-init-vt420 () - "Terminal initialization function for vt420." - (tty-run-terminal-initialization (selected-frame) "vt100") - ;; Make F11 an escape key. - (define-key input-decode-map "\e[23~" [f11]) ;Probably redundant. - (define-key local-function-key-map [f11] [?\e])) - -;;; vt420.el ends here diff --git a/lisp/term/wyse50.el b/lisp/term/wyse50.el index aa9ba43d3d7..77c1655dfd1 100644 --- a/lisp/term/wyse50.el +++ b/lisp/term/wyse50.el @@ -23,7 +23,6 @@ ;;; Commentary: -;; Uses the Emacs 19 terminal initialization features --- won't work with 18. ;; Rewritten for Emacs 19 by jimb, January 1992 ;; Cleaned up for new terminal package conventions by esr, March 1993 ;; Should work well for Televideo TVI 925 although it's overkill. diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index 5d4112b24fd..20d4d415254 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -43,10 +43,40 @@ The relevant features are: :type '(choice (const :tag "No" nil) (const :tag "Check" check) ;; NOTE: If you add entries here, make sure to update - ;; `tocheck-capabilities' in `terminal-init-xterm' as well. + ;; `terminal-init-xterm' as well. (set (const :tag "modifyOtherKeys support" modifyOtherKeys) (const :tag "report background" reportBackground)))) +(defconst xterm-paste-ending-sequence "\e[201~" + "Characters send by the terminal to end a bracketed paste.") + +(defun xterm-paste () + "Handle the start of a terminal paste operation." + (interactive) + (let* ((end-marker-length (length xterm-paste-ending-sequence)) + (pasted-text (with-temp-buffer + (set-buffer-multibyte nil) + (while (not (search-backward + xterm-paste-ending-sequence + (- (point) end-marker-length) t)) + (let ((event (read-event + nil nil + ;; Use finite timeout to avoid + ;; glomming the event onto + ;; this-command-keys. + most-positive-fixnum))) + (when (eql event ?\r) + (setf event ?\n)) + (insert event))) + (let ((last-coding-system-used)) + (decode-coding-region + (point-min) (point) + (keyboard-coding-system) t)))) + (interprogram-paste-function (lambda () pasted-text))) + (yank))) + +(define-key global-map [xterm-paste] #'xterm-paste) + (defvar xterm-function-map (let ((map (make-sparse-keymap))) @@ -248,6 +278,70 @@ The relevant features are: (define-key map "\eOx" [kp-8]) (define-key map "\eOy" [kp-9]) + (define-key map "\eO2j" [S-kp-multiply]) + (define-key map "\eO2k" [S-kp-add]) + (define-key map "\eO2l" [S-kp-separator]) + (define-key map "\eO2m" [S-kp-subtract]) + (define-key map "\eO2o" [S-kp-divide]) + (define-key map "\eO2p" [S-kp-0]) + (define-key map "\eO2q" [S-kp-1]) + (define-key map "\eO2r" [S-kp-2]) + (define-key map "\eO2s" [S-kp-3]) + (define-key map "\eO2t" [S-kp-4]) + (define-key map "\eO2u" [S-kp-5]) + (define-key map "\eO2v" [S-kp-6]) + (define-key map "\eO2w" [S-kp-7]) + (define-key map "\eO2x" [S-kp-8]) + (define-key map "\eO2y" [S-kp-9]) + + (define-key map "\eO4j" [M-S-kp-multiply]) + (define-key map "\eO4k" [M-S-kp-add]) + (define-key map "\eO4l" [M-S-kp-separator]) + (define-key map "\eO4m" [M-S-kp-subtract]) + (define-key map "\eO4o" [M-S-kp-divide]) + (define-key map "\eO4p" [M-S-kp-0]) + (define-key map "\eO4q" [M-S-kp-1]) + (define-key map "\eO4r" [M-S-kp-2]) + (define-key map "\eO4s" [M-S-kp-3]) + (define-key map "\eO4t" [M-S-kp-4]) + (define-key map "\eO4u" [M-S-kp-5]) + (define-key map "\eO4v" [M-S-kp-6]) + (define-key map "\eO4w" [M-S-kp-7]) + (define-key map "\eO4x" [M-S-kp-8]) + (define-key map "\eO4y" [M-S-kp-9]) + + (define-key map "\eO6j" [C-S-kp-multiply]) + (define-key map "\eO6k" [C-S-kp-add]) + (define-key map "\eO6l" [C-S-kp-separator]) + (define-key map "\eO6m" [C-S-kp-subtract]) + (define-key map "\eO6o" [C-S-kp-divide]) + (define-key map "\eO6p" [C-S-kp-0]) + (define-key map "\eO6q" [C-S-kp-1]) + (define-key map "\eO6r" [C-S-kp-2]) + (define-key map "\eO6s" [C-S-kp-3]) + (define-key map "\eO6t" [C-S-kp-4]) + (define-key map "\eO6u" [C-S-kp-5]) + (define-key map "\eO6v" [C-S-kp-6]) + (define-key map "\eO6w" [C-S-kp-7]) + (define-key map "\eO6x" [C-S-kp-8]) + (define-key map "\eO6y" [C-S-kp-9]) + + (define-key map "\eO8j" [C-M-S-kp-multiply]) + (define-key map "\eO8k" [C-M-S-kp-add]) + (define-key map "\eO8l" [C-M-S-kp-separator]) + (define-key map "\eO8m" [C-M-S-kp-subtract]) + (define-key map "\eO8o" [C-M-S-kp-divide]) + (define-key map "\eO8p" [C-M-S-kp-0]) + (define-key map "\eO8q" [C-M-S-kp-1]) + (define-key map "\eO8r" [C-M-S-kp-2]) + (define-key map "\eO8s" [C-M-S-kp-3]) + (define-key map "\eO8t" [C-M-S-kp-4]) + (define-key map "\eO8u" [C-M-S-kp-5]) + (define-key map "\eO8v" [C-M-S-kp-6]) + (define-key map "\eO8w" [C-M-S-kp-7]) + (define-key map "\eO8x" [C-M-S-kp-8]) + (define-key map "\eO8y" [C-M-S-kp-9]) + ;; These keys are available in xterm starting from version 216 ;; if the modifyOtherKeys resource is set to 1. (dolist (bind '((5 9 [C-tab]) @@ -394,6 +488,11 @@ The relevant features are: (define-key map "\e[12~" [f2]) (define-key map "\e[13~" [f3]) (define-key map "\e[14~" [f4]) + + ;; Recognize the start of a bracketed paste sequence. The handler + ;; internally recognizes the end. + (define-key map "\e[200~" [xterm-paste]) + map) "Function key map overrides for xterm.") @@ -463,9 +562,6 @@ The relevant features are: map) "Keymap of possible alternative meanings for some keys.") -;; List of terminals for which modify-other-keys has been turned on. -(defvar xterm-modify-other-keys-terminal-list nil) - (defun xterm--report-background-handler () (let ((str "") chr) @@ -605,21 +701,23 @@ We run the first FUNCTION whose STRING matches the input events." (when (memq 'modifyOtherKeys xterm-extra-capabilities) (terminal-init-xterm-modify-other-keys))) + ;; Unconditionally enable bracketed paste mode: terminals that don't + ;; support it just ignore the sequence. + (terminal-init-xterm-bracketed-paste-mode) + (run-hooks 'terminal-init-xterm-hook)) (defun terminal-init-xterm-modify-other-keys () "Terminal initialization for xterm's modifyOtherKeys support." - ;; Make sure that the modifyOtherKeys state is restored when - ;; suspending, resuming and exiting. - (add-hook 'suspend-hook 'xterm-turn-off-modify-other-keys) - (add-hook 'suspend-resume-hook 'xterm-turn-on-modify-other-keys) - (add-hook 'kill-emacs-hook 'xterm-remove-modify-other-keys) - (add-hook 'delete-terminal-functions 'xterm-remove-modify-other-keys) - ;; Add the selected frame to the list of frames that - ;; need to deal with modify-other-keys. - (push (frame-terminal) - xterm-modify-other-keys-terminal-list) - (xterm-turn-on-modify-other-keys)) + (send-string-to-terminal "\e[>4;1m") + (push "\e[>4m" (terminal-parameter nil 'tty-mode-reset-strings)) + (push "\e[>4;1m" (terminal-parameter nil 'tty-mode-set-strings))) + +(defun terminal-init-xterm-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))) ;; Set up colors, for those versions of xterm that support it. (defvar xterm-standard-colors @@ -737,29 +835,6 @@ versions of xterm." ;; right colors, so clear them. (clear-face-cache))) -(defun xterm-turn-on-modify-other-keys () - "Turn the modifyOtherKeys feature of xterm back on." - (let ((terminal (frame-terminal))) - (when (and (terminal-live-p terminal) - (memq terminal xterm-modify-other-keys-terminal-list)) - (send-string-to-terminal "\e[>4;1m" terminal)))) - -(defun xterm-turn-off-modify-other-keys (&optional frame) - "Temporarily turn off the modifyOtherKeys feature of xterm." - (let ((terminal (when frame (frame-terminal frame)))) - (when (and (terminal-live-p terminal) - (memq terminal xterm-modify-other-keys-terminal-list)) - (send-string-to-terminal "\e[>4m" terminal)))) - -(defun xterm-remove-modify-other-keys (&optional terminal) - "Turn off the modifyOtherKeys feature of xterm for good." - (setq terminal (or terminal (frame-terminal))) - (when (and (terminal-live-p terminal) - (memq terminal xterm-modify-other-keys-terminal-list)) - (setq xterm-modify-other-keys-terminal-list - (delq terminal xterm-modify-other-keys-terminal-list)) - (send-string-to-terminal "\e[>4m" terminal))) - (defun xterm-maybe-set-dark-background-mode (redc greenc bluec) ;; Use the heuristic in `frame-set-background-mode' to decide if a ;; frame is dark. |