From: Michael Raitza <spacefrogg-emacs@instandbesetzt.net>
To: emacs-devel@gnu.org
Subject: Re: term/screen.el - screen terminfo/color setup
Date: Sun, 16 Oct 2011 18:59:37 +0200 [thread overview]
Message-ID: <1318783815-sup-295@leandros> (raw)
In-Reply-To: <jwvy5wluek0.fsf-monnier+emacs@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 503 bytes --]
Hi,
the screen.el in bzr is incomplete as it just tries to impersonate xterm.
The screen terminfo description defines its own (different from e.g.
xterm) key bindings. As you can see my solution makes use of the
COLORTERM environment variable (as does xterm.el itself) and correctly
specifies the key bindings.
One question: According to term/README the key binding for END should be
[end], but everyone else seems to specify [select] there (See comment
below in screen.el). Which one is correct?
M
[-- Attachment #2: screen.el --]
[-- Type: application/octet-stream, Size: 2364 bytes --]
;;; screen.el --- define function key sequences and standard colors for screen
;; Author: Michael Raitza
;; Keywords: terminals
;;; Commentary:
;;; screen (and tmux) itself do not specify own colouring settings because they
;;; always run on-top of another terminal (emulator). Thus we cannot make any
;;; assumption about default colours. We relay this to the other terminal's
;;; initialisation functions. We inspect the COLORTERM environment variable
;;; for another terminal that is supported by emacs and actually specifies a
;;; color mapping on its own. So this only works if the COLORTERM
;;; environment variable is set appropriately.
;;;
;;; In short, for maximum performance set:
;;;
;;; TERM=screen-256color COLORTERM={rxvt,xterm}
;;; Code:
(defvar screen-function-map
(let ((map (make-sparse-keymap)))
(define-key map "\e[A" [up])
(define-key map "\e[B" [down])
(define-key map "\e[C" [right])
(define-key map "\e[D" [left])
(define-key map "\e[2~" [insert])
(define-key map "\e[3~" [delete])
(define-key map "\e[4~" [end]) ; everybody else seems to bind this to [select]. why?
(define-key map "\e[1~" [home])
(define-key map "\e[5~" [prior])
(define-key map "\e[6~" [next])
(define-key map "\eOP" [f1])
(define-key map "\eOQ" [f2])
(define-key map "\eOR" [f3])
(define-key map "\eOS" [f4])
(define-key map "\e[15~" [f5])
(define-key map "\e[17~" [f6])
(define-key map "\e[18~" [f7])
(define-key map "\e[19~" [f8])
(define-key map "\e[20~" [f9])
(define-key map "\e[21~" [f10])
map)
"Function key overrides for screen. They should correspond to vt100's.")
(defun terminal-init-screen ()
"Terminal initialization function for screen."
;; screen runs inside another terminal emulator maybe providing
;; coloured output, but some of the keybindings might be incompatible
;; with screen's. (cf. xterm.el)
;; So try to load whatever terminal is providing the COLORTERM environment
;; variable.
(if (getenv "COLORTERM" (selected-frame))
(tty-run-terminal-initialization (selected-frame) (getenv "COLORTERM" (selected-frame))))
(let ((m (copy-keymap screen-function-map)))
(set-keymap-parent m (keymap-parent input-decode-map))
(set-keymap-parent input-decode-map m))
(tty-set-up-initial-frame-faces))
;;; screen.el ends here
next prev parent reply other threads:[~2011-10-16 16:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-14 20:49 term/screen.el - screen terminfo/color setup Michael Raitza
2011-10-16 11:04 ` Thomas Hisch
2011-10-16 13:32 ` Carsten Mattner
[not found] ` <jwvy5wluek0.fsf-monnier+emacs@gnu.org>
2011-10-16 16:59 ` Michael Raitza [this message]
2011-11-05 20:22 ` Thomas Hisch
2011-11-09 17:20 ` Michael Raitza
2011-11-18 21:29 ` Samuel Bronson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1318783815-sup-295@leandros \
--to=spacefrogg-emacs@instandbesetzt.net \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.