all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Is it possible to have 256 colors in Emacs on framebuffer-enabled tty
@ 2011-08-28 14:33 zwz
  2011-08-28 15:18 ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: zwz @ 2011-08-28 14:33 UTC (permalink / raw)
  To: emacs-devel


I use Emacs both in GUI mode and text mode. In text mode, however, it
only shows 8 colors (M-x list-color-display). So I create a consistent
color-theme for Emacs in both modes. 

But one thing still bothers me. In my system, framebuffer is enabled (by
KMS) and fbterm is adopted as the terminal, in which "tput colors" gives
256, and I can watch movies on tty with mplayer. However, in Emacs, only
8 colors available.

I googled and found 
http://code.google.com/p/fbterm/issues/detail?id=44,
in which one comment suggest the issue root in Emacs.

Is it right, or is there any way to have 256 colors in Emacs (tty)?




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

* Re: Is it possible to have 256 colors in Emacs on framebuffer-enabled tty
  2011-08-28 14:33 Is it possible to have 256 colors in Emacs on framebuffer-enabled tty zwz
@ 2011-08-28 15:18 ` Eli Zaretskii
  2011-08-29  6:06   ` zwz
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2011-08-28 15:18 UTC (permalink / raw)
  To: zwz; +Cc: emacs-devel

> From: zwz <zhangweize@gmail.com>
> Date: Sun, 28 Aug 2011 22:33:23 +0800
> 
> 
> I use Emacs both in GUI mode and text mode. In text mode, however, it
> only shows 8 colors (M-x list-color-display). So I create a consistent
> color-theme for Emacs in both modes. 
> 
> But one thing still bothers me. In my system, framebuffer is enabled (by
> KMS) and fbterm is adopted as the terminal, in which "tput colors" gives
> 256, and I can watch movies on tty with mplayer. However, in Emacs, only
> 8 colors available.
> 
> I googled and found 
> http://code.google.com/p/fbterm/issues/detail?id=44,
> in which one comment suggest the issue root in Emacs.
> 
> Is it right

No.

> or is there any way to have 256 colors in Emacs (tty)?

First, your terminal should report to Emacs that it has 256 colors.
Does it?



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

* Re: Is it possible to have 256 colors in Emacs on framebuffer-enabled tty
  2011-08-28 15:18 ` Eli Zaretskii
@ 2011-08-29  6:06   ` zwz
  2011-08-29  6:34     ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: zwz @ 2011-08-29  6:06 UTC (permalink / raw)
  To: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: zwz <zhangweize@gmail.com>
>> Date: Sun, 28 Aug 2011 22:33:23 +0800
>> 
>> 
>> I use Emacs both in GUI mode and text mode. In text mode, however, it
>> only shows 8 colors (M-x list-color-display). So I create a consistent
>> color-theme for Emacs in both modes. 
>> 
>> But one thing still bothers me. In my system, framebuffer is enabled
> (by
>> KMS) and fbterm is adopted as the terminal, in which "tput colors"
> gives
>> 256, and I can watch movies on tty with mplayer. However, in Emacs,
> only
>> 8 colors available.
>> 
>> I googled and found 
>> http://code.google.com/p/fbterm/issues/detail?id=44,
>> in which one comment suggest the issue root in Emacs.
>> 
>> Is it right
>
> No.
>
>> or is there any way to have 256 colors in Emacs (tty)?
>
> First, your terminal should report to Emacs that it has 256 colors.
> Does it?
How to get the report?
In bash, the cmd "tput colors" reports 256.
While in Emacs, it does show 256 color *names* (by M-x
list-color-display). But in fact only the first 8 colors are showable,
as the 8 color names are shown in the background with the corresponding
color; the other color names are shown with no color background.




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

* Re: Is it possible to have 256 colors in Emacs on framebuffer-enabled tty
  2011-08-29  6:06   ` zwz
@ 2011-08-29  6:34     ` Eli Zaretskii
  2011-08-29  9:06       ` zwz
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2011-08-29  6:34 UTC (permalink / raw)
  To: zwz; +Cc: emacs-devel

> From: zwz <zhangweize@gmail.com>
> Date: Mon, 29 Aug 2011 14:06:02 +0800
> 
> > First, your terminal should report to Emacs that it has 256 colors.
> > Does it?
> How to get the report?
> In bash, the cmd "tput colors" reports 256.
> While in Emacs, it does show 256 color *names* (by M-x
> list-color-display).

list-color-display _is_ the correct way.

> But in fact only the first 8 colors are showable,
> as the 8 color names are shown in the background with the corresponding
> color; the other color names are shown with no color background.

What are the names of the other colors, beyond the first 8, shown by
list-color-display?

Also, which of the lisp/term/*.el files is being loaded by Emacs on
startup for that terminal?



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

* Re: Is it possible to have 256 colors in Emacs on framebuffer-enabled tty
  2011-08-29  6:34     ` Eli Zaretskii
@ 2011-08-29  9:06       ` zwz
  2011-08-29  9:42         ` Eli Zaretskii
  2011-08-29 22:01         ` David De La Harpe Golden
  0 siblings, 2 replies; 15+ messages in thread
From: zwz @ 2011-08-29  9:06 UTC (permalink / raw)
  To: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: zwz <zhangweize@gmail.com>
>> Date: Mon, 29 Aug 2011 14:06:02 +0800
>> 
>> > First, your terminal should report to Emacs that it has 256 colors.
>> > Does it?
>> How to get the report?
>> In bash, the cmd "tput colors" reports 256.
>> While in Emacs, it does show 256 color *names* (by M-x
>> list-color-display).
>
> list-color-display _is_ the correct way.
>
>> But in fact only the first 8 colors are showable,
>> as the 8 color names are shown in the background with the
> corresponding
>> color; the other color names are shown with no color background.
>
> What are the names of the other colors, beyond the first 8, shown by
> list-color-display?

I made some mistake. The problem "tput color -> 256; Emacs -> 256 but in
fact 8" only happens when I set TERM=xterm-256color, which is not the
case since I am actually using fbterm.


When I set TERM=fbterm. "tput color" also reports 256; while in Emacs
list-color-display just shows 8 colors. The issue remains.


BTW, the other color names are (when TERM=xterm-256color):
brightblack	       brightblack							      #7f7f7f
brightred	       brightred							      #ff0000
brightgreen	       brightgreen							      #00ff00
brightyellow	       brightyellow							      #ffff00
brightblue	       brightblue							      #5c5cff
brightmagenta	       brightmagenta							      #ff00ff
brightcyan	       brightcyan							      #00ffff
brightwhite	       brightwhite							      #ffffff
color-16	       color-16								      #000000
color-17	       color-17								      #00005f
...
color-255	       color-255							      #eeeeee


>
> Also, which of the lisp/term/*.el files is being loaded by Emacs on
> startup for that terminal?
How can I tell which lisp/term/*.el is loaded?




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

* Re: Is it possible to have 256 colors in Emacs on framebuffer-enabled tty
  2011-08-29  9:06       ` zwz
@ 2011-08-29  9:42         ` Eli Zaretskii
  2011-08-29 22:01         ` David De La Harpe Golden
  1 sibling, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2011-08-29  9:42 UTC (permalink / raw)
  To: zwz; +Cc: emacs-devel

> From: zwz <zhangweize@gmail.com>
> Date: Mon, 29 Aug 2011 17:06:03 +0800
> 
> When I set TERM=fbterm. "tput color" also reports 256; while in Emacs
> list-color-display just shows 8 colors. The issue remains.

Then please see the "Colors are not available on a tty or in xterm"
entry in etc/PROBLEMS, it tells how Emacs detects the number of colors
supported by the terminal.

> > Also, which of the lisp/term/*.el files is being loaded by Emacs on
> > startup for that terminal?
> How can I tell which lisp/term/*.el is loaded?

What does the following display?

  M-: (tty-type) RET

Assuming this displays "SOMETHING", Emacs tries to load the file
lisp/term/SOMETHING.el, if such a file is available.



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

* Re: Is it possible to have 256 colors in Emacs on framebuffer-enabled tty
  2011-08-29  9:06       ` zwz
  2011-08-29  9:42         ` Eli Zaretskii
@ 2011-08-29 22:01         ` David De La Harpe Golden
  2011-08-30 14:05           ` zwz
  1 sibling, 1 reply; 15+ messages in thread
From: David De La Harpe Golden @ 2011-08-29 22:01 UTC (permalink / raw)
  To: emacs-devel

On 29/08/11 10:06, zwz wrote:

> I made some mistake. The problem "tput color ->  256; Emacs ->  256 but in
> fact 8" only happens when I set TERM=xterm-256color, which is not the
> case since I am actually using fbterm.

That was unlikely to work anyway, as the fbterm guys have apparenrtly 
chosen to use quite different escapes to xterm for 256 colors.  I 
understand that they were seeking to retain compat with linux kernel vt, 
and the linux vt was already using that escape (for something fairly 
unimportant IIRC*), but since they are _not_ the linux vts and they 
_are_ a different terminal anyway, IMO they would have been better off 
using the same escapes as xterm (and everyone else) for 256 colors and 
just moving the linux vt one somewhere, but anyway. At the same time, 
they're probably "in the right" insofar as apps properly using terminfo 
should be able to cope with both.

Emacs probably should be querying more from terminfo and hardcoding less 
(yeah yeah, "patches welcome", I know).  In any case, right now, we 
probably do need a lisp/term/fbterm.el, and unfortunately it probably 
can't completely reuse the xterm.el code, unlike screen.el

* I remember looking at feasibility of a linux kernel patch for native 
256-color vts on framebuffers years ago but my attention rapidly wandered...



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

* Re: Is it possible to have 256 colors in Emacs on framebuffer-enabled tty
  2011-08-29 22:01         ` David De La Harpe Golden
@ 2011-08-30 14:05           ` zwz
  2011-08-30 17:58             ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: zwz @ 2011-08-30 14:05 UTC (permalink / raw)
  To: emacs-devel

David De La Harpe Golden <david@harpegolden.net> writes:

> On 29/08/11 10:06, zwz wrote:
>
>> I made some mistake. The problem "tput color -> 256; Emacs -> 256 but
> in
>> fact 8" only happens when I set TERM=xterm-256color, which is not the
>> case since I am actually using fbterm.
>
> That was unlikely to work anyway, as the fbterm guys have apparenrtly
> chosen to use quite different escapes to xterm for 256 colors.  I
> understand that they were seeking to retain compat with linux kernel vt,
> and the linux vt was already using that escape (for something fairly
> unimportant IIRC*), but since they are _not_ the linux vts and they
> _are_ a different terminal anyway, IMO they would have been better off
> using the same escapes as xterm (and everyone else) for 256 colors and
> just moving the linux vt one somewhere, but anyway. At the same time,
> they're probably "in the right" insofar as apps properly using terminfo
> should be able to cope with both.
>
> Emacs probably should be querying more from terminfo and hardcoding less
> (yeah yeah, "patches welcome", I know).  In any case, right now, we
> probably do need a lisp/term/fbterm.el, and unfortunately it probably
> can't completely reuse the xterm.el code, unlike screen.el

Do you mean if there is a lisp/term/fbterm.el that deals with the
escapes, then it is possible to have 256 colors in Emacs on fbterm?

>
> * I remember looking at feasibility of a linux kernel patch for native
> 256-color vts on framebuffers years ago but my attention rapidly
> wandered...

This seems to be a better solution.




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

* Re: Is it possible to have 256 colors in Emacs on framebuffer-enabled tty
  2011-08-30 14:05           ` zwz
@ 2011-08-30 17:58             ` Eli Zaretskii
  2011-08-31 16:23               ` Wolfgang Jenkner
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2011-08-30 17:58 UTC (permalink / raw)
  To: zwz; +Cc: emacs-devel

> From: zwz <zhangweize@gmail.com>
> Date: Tue, 30 Aug 2011 22:05:50 +0800
> 
> Do you mean if there is a lisp/term/fbterm.el that deals with the
> escapes, then it is possible to have 256 colors in Emacs on fbterm?

No, such an fbterm.el does not exist.  But given enough information
about this terminal, it could be written in a way that's similar to
xterm.el.



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

* Re: Is it possible to have 256 colors in Emacs on framebuffer-enabled tty
  2011-08-30 17:58             ` Eli Zaretskii
@ 2011-08-31 16:23               ` Wolfgang Jenkner
  2011-08-31 17:44                 ` Eli Zaretskii
  2011-09-01 14:28                 ` zwz
  0 siblings, 2 replies; 15+ messages in thread
From: Wolfgang Jenkner @ 2011-08-31 16:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel, zwz

Eli Zaretskii <eliz@gnu.org> writes:

>> From: zwz <zhangweize@gmail.com>
>> Date: Tue, 30 Aug 2011 22:05:50 +0800
>> 
>> Do you mean if there is a lisp/term/fbterm.el that deals with the
>> escapes, then it is possible to have 256 colors in Emacs on fbterm?
>
> No, such an fbterm.el does not exist.  But given enough information
> about this terminal, it could be written in a way that's similar to
> xterm.el.

I think the 256 colors support in term/xterm.el is general enough to
support fbterm as well.  At least the following quick'n'dirty adaption
from term/linux.el seems to work for that (provided the terminfo stuff
is correctly installed, TERM is set to fbterm and the code below is
saved to term/fbterm.el somewhere in load-path).

#+BEGIN_SRC emacs-lisp
;; -*- no-byte-compile: t -*-

(load "term/xterm")

(defun terminal-init-fbterm ()
  "Terminal initialization function for linux fbterm."
  (unless (terminal-coding-system)
    (set-terminal-coding-system 'utf-8-unix))

  ;; It can't really display underlines.
  (tty-no-underline)

  (ignore-errors (when gpm-mouse-mode (require 't-mouse) (gpm-mouse-enable)))

  (xterm-register-default-colors))

;;; fbterm.el ends here
#+END_SRC



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

* Re: Is it possible to have 256 colors in Emacs on framebuffer-enabled tty
  2011-08-31 16:23               ` Wolfgang Jenkner
@ 2011-08-31 17:44                 ` Eli Zaretskii
  2011-09-01 14:35                   ` zwz
  2011-09-01 14:28                 ` zwz
  1 sibling, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2011-08-31 17:44 UTC (permalink / raw)
  To: Wolfgang Jenkner; +Cc: emacs-devel, zhangweize

> From: Wolfgang Jenkner <wjenkner@inode.at>
> Cc: zwz <zhangweize@gmail.com>,  emacs-devel@gnu.org
> Date: Wed, 31 Aug 2011 18:23:27 +0200
> 
> I think the 256 colors support in term/xterm.el is general enough to
> support fbterm as well.

The setting of the colors themselves is not the terminal specific
part; the part that queries xterm about the number of colors is.

If fbterm always supports only 256 colors, then similar code can be
used there unconditionally.

Another aspect of this is the RGB values: the ones in xterm.el were
taken from the xterm source code.  We should make sure fbterm uses the
same colors, before we use these values for fbterm.

Finally, the color names in xterm.el were also taken from the xterm
nomenclature.  Does fbterm use the same names? if not, we should
probably use its own names, for consistency.



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

* Re: Is it possible to have 256 colors in Emacs on framebuffer-enabled tty
  2011-08-31 16:23               ` Wolfgang Jenkner
  2011-08-31 17:44                 ` Eli Zaretskii
@ 2011-09-01 14:28                 ` zwz
  2011-09-01 15:36                   ` Eli Zaretskii
  1 sibling, 1 reply; 15+ messages in thread
From: zwz @ 2011-09-01 14:28 UTC (permalink / raw)
  To: emacs-devel

Wolfgang Jenkner <wjenkner@inode.at> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: zwz <zhangweize@gmail.com>
>>> Date: Tue, 30 Aug 2011 22:05:50 +0800
>>> 
>>> Do you mean if there is a lisp/term/fbterm.el that deals with the
>>> escapes, then it is possible to have 256 colors in Emacs on fbterm?
>>
>> No, such an fbterm.el does not exist.  But given enough information
>> about this terminal, it could be written in a way that's similar to
>> xterm.el.
>
> I think the 256 colors support in term/xterm.el is general enough to
> support fbterm as well.  At least the following quick'n'dirty adaption
> from term/linux.el seems to work for that (provided the terminfo stuff
> is correctly installed, TERM is set to fbterm and the code below is
> saved to term/fbterm.el somewhere in load-path).
>
> #+BEGIN_SRC emacs-lisp
> ;; -*- no-byte-compile: t -*-
>
> (load "term/xterm")
>
> (defun terminal-init-fbterm ()
>   "Terminal initialization function for linux fbterm."
>   (unless (terminal-coding-system)
>     (set-terminal-coding-system 'utf-8-unix))
>
>   ;; It can't really display underlines.
>   (tty-no-underline)
>
>   (ignore-errors (when gpm-mouse-mode (require 't-mouse)
> (gpm-mouse-enable)))
>
>   (xterm-register-default-colors))
>
> ;;; fbterm.el ends here
> #+END_SRC

Great, the code works!

Is it a good idea to make it the default code to run when Emacs can not
find the right term/*.el if term/xterm.el is really general enough?




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

* Re: Is it possible to have 256 colors in Emacs on framebuffer-enabled tty
  2011-08-31 17:44                 ` Eli Zaretskii
@ 2011-09-01 14:35                   ` zwz
  2011-09-01 15:37                     ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: zwz @ 2011-09-01 14:35 UTC (permalink / raw)
  To: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Wolfgang Jenkner <wjenkner@inode.at>
>> Cc: zwz <zhangweize@gmail.com>,  emacs-devel@gnu.org
>> Date: Wed, 31 Aug 2011 18:23:27 +0200
>> 
>> I think the 256 colors support in term/xterm.el is general enough to
>> support fbterm as well.
>
> The setting of the colors themselves is not the terminal specific
> part; the part that queries xterm about the number of colors is.
>
> If fbterm always supports only 256 colors, then similar code can be
> used there unconditionally.
>
> Another aspect of this is the RGB values: the ones in xterm.el were
> taken from the xterm source code.  We should make sure fbterm uses the
> same colors, before we use these values for fbterm.
>
> Finally, the color names in xterm.el were also taken from the xterm
> nomenclature.  Does fbterm use the same names? if not, we should
> probably use its own names, for consistency.

I compared the outputs of (list-color-display) with Emacs on xterm (X)
and fbterm (tty, with the code by Wolfgang Jenkner). They are the same.




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

* Re: Is it possible to have 256 colors in Emacs on framebuffer-enabled tty
  2011-09-01 14:28                 ` zwz
@ 2011-09-01 15:36                   ` Eli Zaretskii
  0 siblings, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2011-09-01 15:36 UTC (permalink / raw)
  To: zwz; +Cc: emacs-devel

> From: zwz <zhangweize@gmail.com>
> Date: Thu, 01 Sep 2011 22:28:18 +0800
> 
> Is it a good idea to make it the default code to run when Emacs can not
> find the right term/*.el if term/xterm.el is really general enough?

xterm.el is not general enough.  It's just that fbterm supports
xterm's 256-color extensions.



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

* Re: Is it possible to have 256 colors in Emacs on framebuffer-enabled tty
  2011-09-01 14:35                   ` zwz
@ 2011-09-01 15:37                     ` Eli Zaretskii
  0 siblings, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2011-09-01 15:37 UTC (permalink / raw)
  To: zwz; +Cc: emacs-devel

> From: zwz <zhangweize@gmail.com>
> Date: Thu, 01 Sep 2011 22:35:14 +0800
> 
> I compared the outputs of (list-color-display) with Emacs on xterm (X)
> and fbterm (tty, with the code by Wolfgang Jenkner). They are the same.

Then Someone(TM) should write fbterm.el and submit it for inclusion in
Emacs.



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

end of thread, other threads:[~2011-09-01 15:37 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-28 14:33 Is it possible to have 256 colors in Emacs on framebuffer-enabled tty zwz
2011-08-28 15:18 ` Eli Zaretskii
2011-08-29  6:06   ` zwz
2011-08-29  6:34     ` Eli Zaretskii
2011-08-29  9:06       ` zwz
2011-08-29  9:42         ` Eli Zaretskii
2011-08-29 22:01         ` David De La Harpe Golden
2011-08-30 14:05           ` zwz
2011-08-30 17:58             ` Eli Zaretskii
2011-08-31 16:23               ` Wolfgang Jenkner
2011-08-31 17:44                 ` Eli Zaretskii
2011-09-01 14:35                   ` zwz
2011-09-01 15:37                     ` Eli Zaretskii
2011-09-01 14:28                 ` zwz
2011-09-01 15:36                   ` Eli Zaretskii

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.