unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* term/screen.el - screen terminfo/color setup
@ 2011-10-14 20:49 Michael Raitza
  2011-10-16 11:04 ` Thomas Hisch
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Michael Raitza @ 2011-10-14 20:49 UTC (permalink / raw)
  To: emacs-devel

Hi,

I've written a term/screen.el to correctly setup colors in the screen
terminal multiplexer. So no more workarounds must be done to get 256
colors to work when using emacs in terminal-only mode. I found that
feasable because screen relies on its correct settings in TERM.

So now I don't know how to distribute this to you.

Any pointer where I can deliver my solution to would be nice.

Regards,


M




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: term/screen.el - screen terminfo/color setup
  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>
  2 siblings, 0 replies; 7+ messages in thread
From: Thomas Hisch @ 2011-10-16 11:04 UTC (permalink / raw)
  To: Michael Raitza; +Cc: emacs-devel

Hey,

what about directly posting it in this thread ?

Regards,
Thomas

On Fri, Oct 14, 2011 at 10:49 PM, Michael Raitza
<spacefrogg-emacs@instandbesetzt.net> wrote:
> Hi,
>
> I've written a term/screen.el to correctly setup colors in the screen
> terminal multiplexer. So no more workarounds must be done to get 256
> colors to work when using emacs in terminal-only mode. I found that
> feasable because screen relies on its correct settings in TERM.
>
> So now I don't know how to distribute this to you.
>
> Any pointer where I can deliver my solution to would be nice.
>
> Regards,
>
>
> M
>
>
>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: term/screen.el - screen terminfo/color setup
  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>
  2 siblings, 0 replies; 7+ messages in thread
From: Carsten Mattner @ 2011-10-16 13:32 UTC (permalink / raw)
  To: Michael Raitza; +Cc: emacs-devel

On Fri, Oct 14, 2011 at 10:49 PM, Michael Raitza
<spacefrogg-emacs@instandbesetzt.net> wrote:
> Hi,
>
> I've written a term/screen.el to correctly setup colors in the screen
> terminal multiplexer. So no more workarounds must be done to get 256
> colors to work when using emacs in terminal-only mode. I found that
> feasable because screen relies on its correct settings in TERM.

What does it exactly solve?
For me tmux with
set -g default-terminal "screen-256color"
and stock emacs from bzr displays colors right (for most themes).

> So now I don't know how to distribute this to you.
>
> Any pointer where I can deliver my solution to would be nice.

Put it in some paste service, gist, git/hg repo or one of the
emacs package repos?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: term/screen.el - screen terminfo/color setup
       [not found] ` <jwvy5wluek0.fsf-monnier+emacs@gnu.org>
@ 2011-10-16 16:59   ` Michael Raitza
  2011-11-05 20:22     ` Thomas Hisch
  2011-11-18 21:29     ` Samuel Bronson
  0 siblings, 2 replies; 7+ messages in thread
From: Michael Raitza @ 2011-10-16 16:59 UTC (permalink / raw)
  To: emacs-devel

[-- 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: term/screen.el - screen terminfo/color setup
  2011-10-16 16:59   ` Michael Raitza
@ 2011-11-05 20:22     ` Thomas Hisch
  2011-11-09 17:20       ` Michael Raitza
  2011-11-18 21:29     ` Samuel Bronson
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Hisch @ 2011-11-05 20:22 UTC (permalink / raw)
  To: Michael Raitza; +Cc: emacs-devel

@martin

what do I need to use your screen.el ? Should a simple load-file in a
running emacs session inside gnu screen be sufficient ?

Regards
thomas

On Sun, Oct 16, 2011 at 6:59 PM, Michael Raitza
<spacefrogg-emacs@instandbesetzt.net> wrote:
> 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
>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: term/screen.el - screen terminfo/color setup
  2011-11-05 20:22     ` Thomas Hisch
@ 2011-11-09 17:20       ` Michael Raitza
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Raitza @ 2011-11-09 17:20 UTC (permalink / raw)
  To: Thomas Hisch; +Cc: emacs-devel

Thomas,

you need to put screen.el under <some-path>/term/screen.el with
<some-path> in 'load-path.

emacs searches for <TERM>.el in terms of the TERM environment variable
at startup time. See also comments in screen.el.

M

Excerpts from Thomas Hisch's message of Sat Nov 05 21:22:36 +0100 2011:
> @martin
> 
> what do I need to use your screen.el ? Should a simple load-file in a
> running emacs session inside gnu screen be sufficient ?
> 
> Regards
> thomas
> 
> On Sun, Oct 16, 2011 at 6:59 PM, Michael Raitza
> <spacefrogg-emacs@instandbesetzt.net> wrote:
> > 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
> >




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: term/screen.el - screen terminfo/color setup
  2011-10-16 16:59   ` Michael Raitza
  2011-11-05 20:22     ` Thomas Hisch
@ 2011-11-18 21:29     ` Samuel Bronson
  1 sibling, 0 replies; 7+ messages in thread
From: Samuel Bronson @ 2011-11-18 21:29 UTC (permalink / raw)
  To: Michael Raitza; +Cc: emacs-devel

On Sun, Oct 16, 2011 at 12:59 PM, Michael Raitza
<spacefrogg-emacs@instandbesetzt.net> wrote:
> 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?

So, you're saying that emacs can't just figure it out from the
terminfo and the following:

% cat ~/.emacs/term/screen.el
;;; From http://www.xvx.ca/~awg/emacs-colors-howto.txt

;;; This is for GNU Emacs 22
(defun terminal-init-screen ()
  "Terminal initialization function for screen."
  ;; Use the xterm color initialization code.
  (load "term/xterm")
  (xterm-register-default-colors)
  (tty-set-up-initial-frame-faces))
%

Because that seems to have worked pretty well for me in Emacs 22/23 so far.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-11-18 21:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2011-11-05 20:22     ` Thomas Hisch
2011-11-09 17:20       ` Michael Raitza
2011-11-18 21:29     ` Samuel Bronson

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).