all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* emacs -nw conflicts with (set-foreground-color "xxx")
@ 2007-10-08 18:10 sigma.sullivan
  2007-10-08 20:44 ` Peter Dyballa
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: sigma.sullivan @ 2007-10-08 18:10 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: sigma.sullivan


Hi,

When I run "emacs -nw" in an xterm or konsole, the colors all come out
wrong.

When I use emacs without "-nw" the colors are fine,
and when I don't specify colors in the .emacs file then emacs
accurately picks up the konsole
defaults.  But with both "-nw" and colors in the .emacs file, it's as
if all the colors are
blended with gray.

My .emacs file contains:
(set-foreground-color "black")
(set-background-color "#ffff00")
I'm running emacs 21.4.1 on Debian sarge, kernel 2.6.18, with KDE on
intel 32-bit hardware.

I often need emacs -nw when using X-less situations ... is there a way
I can specify
the foreground and background colors?

Many thanks,

Steve

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

* Re: emacs -nw conflicts with (set-foreground-color "xxx")
  2007-10-08 18:10 emacs -nw conflicts with (set-foreground-color "xxx") sigma.sullivan
@ 2007-10-08 20:44 ` Peter Dyballa
  2007-10-08 21:40 ` David Hansen
       [not found] ` <mailman.1852.1191876273.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 8+ messages in thread
From: Peter Dyballa @ 2007-10-08 20:44 UTC (permalink / raw)
  To: sigma.sullivan; +Cc: help-gnu-emacs


Am 08.10.2007 um 20:10 schrieb sigma.sullivan:

> When I run "emacs -nw" in an xterm or konsole, the colors all come out
> wrong.

How many and which colours in particular can your terminal emulation  
display? GNU Emacs can help you:

	M-x list-colors-display RET

Now you choose from those colours that your terminal emulation can  
display.

--
Greetings

   Pete

We also sponsor National Invisible Chronic Illness Awareness Week  
annually in September.
Join the millions

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

* Re: emacs -nw conflicts with (set-foreground-color "xxx")
  2007-10-08 18:10 emacs -nw conflicts with (set-foreground-color "xxx") sigma.sullivan
  2007-10-08 20:44 ` Peter Dyballa
@ 2007-10-08 21:40 ` David Hansen
       [not found] ` <mailman.1852.1191876273.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 8+ messages in thread
From: David Hansen @ 2007-10-08 21:40 UTC (permalink / raw)
  To: help-gnu-emacs

On Mon, 08 Oct 2007 11:10:40 -0700 sigma sullivan wrote:

> I often need emacs -nw when using X-less situations ... is there a way
> I can specify the foreground and background colors?

With the customize interface you can specify different colors for a
X11-Frame or the console.

David

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

* Re: emacs -nw conflicts with (set-foreground-color "xxx")
       [not found] ` <mailman.1852.1191876273.18990.help-gnu-emacs@gnu.org>
@ 2007-10-09  4:27   ` sigma.sullivan
  2007-10-09  9:09     ` Peter Dyballa
  2007-10-09 21:46     ` Eli Zaretskii
  0 siblings, 2 replies; 8+ messages in thread
From: sigma.sullivan @ 2007-10-09  4:27 UTC (permalink / raw)
  To: help-gnu-emacs

On Oct 8, 2:44 pm, Peter Dyballa <Peter_Dyba...@Web.DE> wrote:
>         M-x list-colors-display RET

Peter,

Thanks for the tip.  I tried list-colors-display in "emacs -nw" and
got the following 8 colors:
black, red, green, yellow, blue, magenta, cyan, white

This is odd, since I know the konsole can display far more colors than
that.
For example, if I put in my .emacs file
    (set-background-color "yellow")
    (set-foreground-color "black")
then when I run "emacs -nw" the background is a dark brown-orange, and
the foreground text is black.  xmag shows the background to be
#b26818.
This can make it difficult to read the text.

If I use
    (set-background-color "green")
    (set-foreground-color "red")
then the colors I actually end up with, according to xmag, are
background #18b218 and foreground #b21818.

Does this make any sense?  How can I get rid of the color
modification?

Many thanks,

Steve

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

* Re: emacs -nw conflicts with (set-foreground-color "xxx")
  2007-10-09  4:27   ` sigma.sullivan
@ 2007-10-09  9:09     ` Peter Dyballa
  2007-10-09 21:50       ` Eli Zaretskii
  2007-10-09 21:46     ` Eli Zaretskii
  1 sibling, 1 reply; 8+ messages in thread
From: Peter Dyballa @ 2007-10-09  9:09 UTC (permalink / raw)
  To: sigma.sullivan; +Cc: help-gnu-emacs


Am 09.10.2007 um 06:27 schrieb sigma.sullivan:

> Does this make any sense?  How can I get rid of the color
> modification?

I don't know ... One thing that I can imagine being the cause is,  
that all these extra colours in your console application come from  
the X server. When GNU Emacs or some other ncurses based programme  
runs in this terminal emulation, it has no access to X11 and is  
restricted to the use of ANSI defined colours ("ESC [ 3 7 m ESC [ 4 0  
m" or such codes). It might be possible that an extended "termcap  
entry" describes capabilities to access much more colours, but then  
this entry's name would be needed to be defined as the environment  
variable TERM. An auxiliary environment variable TERMCAP or TERMPATH  
might point to that powerful entry.

Please check what your console application really offers "simple"  
ncurses based non-graphic or alpha-numeric programmes!


I'd make tests with GNU Emacs launched with -Q, i.e. to get an Emacs  
running that has none of your system's or your own customisation  
loaded. On the command line you can try -fg and -bg to set foreground  
or background colour, you can also make GNU Emacs load an ELisp file  
with the two simple statements, or you can make it to execute the  
same statements on the command line.

If the colours are still different from those that list-colors- 
display shows, than you've probably found something like a bug and  
should report it via Help menu -> Send Bug Report... Then describe  
the original cause and what you've did and found when testing GNU  
Emacs launched with -Q. You can start the bug report when still in  
emacs -Q ...


(Personally I don't see any reason why GNU Emacs, when running  
without windows inside a terminal emulation, should use other colours  
then those I've chosen for the host, i.e. the terminal emulation. Its  
colours are already chosen for ergonomic reasons and personal  
preferences. Nevertheless, I had problems that the default colours  
and faces from font-lock were far away from readable. For this  
purpose I positioned the cursor in some major-mode in such an  
unreadable text and typed C-u C-x =. In another window this text was  
described – and also its face was mentioned, offering a direct way to  
the customisation interface. This way I re-customised some colours  
and saved them in a file that gets loaded when GNU Emacs is running  
with window-system "nil." To prepare this work just remove this  
original section from your user init file, ~/.emacs for example,  
starting with

	(custom-set-faces
	  ;; custom-set-faces was added by Custom.
	  ;; If you edit it by hand, you could mess it up, so be careful.
	  ;; Your init file should contain only one such instance.
	  ;; If there is more than one, they won't work right.


and set right whatever you think needs correction. Then save your new  
customisation and put the section in another file. Load your  
customisation via, for example


       (setq custom-file (format "~/.emacs-Abrichtung-%d.el" ETyp))
       (load custom-file)
       (load (format "~/.emacs_%s" mWS))

where ETyp corresponds to something like emacs-major-version [I have  
a few Emacsen] and mWS corresponds to the window-system in which it  
runs.)


--
Greetings

              ~  O
   Pete       ~~_\\_/%
              ~  O  o

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

* Re: emacs -nw conflicts with (set-foreground-color "xxx")
  2007-10-09  4:27   ` sigma.sullivan
  2007-10-09  9:09     ` Peter Dyballa
@ 2007-10-09 21:46     ` Eli Zaretskii
  1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2007-10-09 21:46 UTC (permalink / raw)
  To: help-gnu-emacs

> From: sigma.sullivan@gmail.com
> Date: Tue, 09 Oct 2007 04:27:53 -0000
> 
> Thanks for the tip.  I tried list-colors-display in "emacs -nw" and
> got the following 8 colors:
> black, red, green, yellow, blue, magenta, cyan, white
> 
> This is odd, since I know the konsole can display far more colors than
> that.

Emacs cannot know how many colors can you console display.  It knows
only what the termcap/terminfo entry for that console tells it.  In
your case, it tells Emacs that 8 colors are supported.

> For example, if I put in my .emacs file
>     (set-background-color "yellow")
>     (set-foreground-color "black")
> then when I run "emacs -nw" the background is a dark brown-orange, and
> the foreground text is black.  xmag shows the background to be
> #b26818.
> This can make it difficult to read the text.
> 
> If I use
>     (set-background-color "green")
>     (set-foreground-color "red")
> then the colors I actually end up with, according to xmag, are
> background #18b218 and foreground #b21818.
> 
> Does this make any sense?  How can I get rid of the color
> modification?

It sounds like you are running in an xterm or some similar X-based
terminal emulator.  If so, the way to control the colors is to set up
the emulator to produce the color you want for every one of the 8
colors used by Emacs.  That is, set the terminal emulator to produce a
yellow color when you specify "yellow" in Emacs.  There should be some
configuration file or resources that can be used for that, but the
details depend on the emulator you use.

Emacs cannot help this in any way, because all it does is ask the
terminal emulator to display yellow color (actually, color number 3 or
something, i.e. it specifies the color by its ordinal number).

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

* Re: emacs -nw conflicts with (set-foreground-color "xxx")
  2007-10-09  9:09     ` Peter Dyballa
@ 2007-10-09 21:50       ` Eli Zaretskii
  2007-10-09 22:29         ` Peter Dyballa
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2007-10-09 21:50 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Peter Dyballa <Peter_Dyballa@Web.DE>
> Date: Tue, 9 Oct 2007 11:09:57 +0200
> Cc: help-gnu-emacs@gnu.org
> 
> (Personally I don't see any reason why GNU Emacs, when running  
> without windows inside a terminal emulation, should use other colours  
> then those I've chosen for the host, i.e. the terminal emulation.

Because it simply cannot know what you've chosen.

As I explained elsewhere in this thread, Emacs simply asks the
terminal to display color number N and _assumes_ that each number
corresponds to the color in the normal ANSI 8-color sequence.  There's
no general-purpose API (AFAIK) to query Posix-standard terminal driver
for the actual colors that correspond to each color number.

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

* Re: emacs -nw conflicts with (set-foreground-color "xxx")
  2007-10-09 21:50       ` Eli Zaretskii
@ 2007-10-09 22:29         ` Peter Dyballa
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Dyballa @ 2007-10-09 22:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs


Am 09.10.2007 um 23:50 schrieb Eli Zaretskii:

>> (Personally I don't see any reason why GNU Emacs, when running
>> without windows inside a terminal emulation, should use other colours
>> then those I've chosen for the host, i.e. the terminal emulation.
>
> Because it simply cannot know what you've chosen.
>
> As I explained elsewhere in this thread, Emacs simply asks the
> terminal to display color number N and _assumes_ that each number
> corresponds to the color in the normal ANSI 8-color sequence.  There's
> no general-purpose API (AFAIK) to query Posix-standard terminal driver
> for the actual colors that correspond to each color number.

I was trying to express that once in the terminal emulation colours  
are set right, there is no reason why GNU Emacs should use different  
ones. It would lose readability, I presume ...

--
Mit friedvollen Grüßen

   Pete

Got Mole problems?
Call Avogadro 6.02 x 10^23

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

end of thread, other threads:[~2007-10-09 22:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-08 18:10 emacs -nw conflicts with (set-foreground-color "xxx") sigma.sullivan
2007-10-08 20:44 ` Peter Dyballa
2007-10-08 21:40 ` David Hansen
     [not found] ` <mailman.1852.1191876273.18990.help-gnu-emacs@gnu.org>
2007-10-09  4:27   ` sigma.sullivan
2007-10-09  9:09     ` Peter Dyballa
2007-10-09 21:50       ` Eli Zaretskii
2007-10-09 22:29         ` Peter Dyballa
2007-10-09 21:46     ` 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.