0

when im running EMACS from cygwin which in turn run from ConEmu,dosent display the emacs color themes.

but if i run the same configuration without conemu i can see the themes displayed properly.

how i can i setup my conEmu to display the 256 color properly and to show all the color themes in EMACs.

My Setup:

Environment: Windows 7
Command Prompt : ConEmu 
emulator : cygwin
editor : EMACs

Edit: I have used

alias emacs='TERM=xterm-256color emacs'

after which the ConEMU shows the windows with blank space inbetween. works well in cygwin prompt.

blackwind
  • 182
  • 1
  • 10

2 Answers2

2

If you are running emacs in a console window, it likely is using termcap/terminfo. In that case, it pays attention to the $TERM environment variable. Perhaps when you setup your coneum+cygwin configuration, the $TERM value is not the same as the other way you set it up.

Technically, termcap does not support 256-colors, so whatever $TERM emacs would use is a compromise (special value that just happens to work). This is mentioned in the ncurses FAQ: Why not make "xterm" equated to "xterm-256color"?

Some programs (such as PuTTY) allow one to set environment variables for their process. I do not see that in ConEmu's documentation. If it lacks that capability, I suppose you could set TERM as needed in your Windows environment, or in your .bashrc

On the general topic of Emacs with 256colors:

There is a hint in ConEmu's wiki which may be useful: it states that

Vim's executable must be named ‘vim.exe’;

which makes me suspect that ConEmu has some special feature which looks for this particular name when these other two configuration settings (from the wiki) are set:

Check options ‘Inject ConEmuHk’ and ‘ANSI X3.64 / xterm 256 colors’ on Features page; Check option ‘TrueMod (24bit color) support’ on Colors page;

If that is so, you could try a workaround, by

  • renaming emacs.exe to vim.exe
  • adding a batch file named emacs.bat, containing

    @echo off

    emacs.exe %*

If you happen to have a vim.exe already around, it is possible to fixup the batch file to use the actual pathname of emacs.exe (but this should be enough to start investigating a workaround).

Community
  • 1
  • 1
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
  • i enabled the 256 color mode, after which it runs like a charm in cygwin tty... but same config i.e updating cygwin (which was running on conemu) to 256 color mode, didn't work. – blackwind Mar 08 '15 at 03:22
  • But you did not comment on what the value of $TERM was. Likely the working configuration has TERM set to xterm-256color. (As noted, the regular definition for that will not work with *termcap*, but some packagers have a cut-down version which "works", e.g., using the capabilities matching t_AB and t_AF in the example cited for vim). – Thomas Dickey Mar 08 '15 at 10:18
  • updated the question: i updated $TERM , after doing this only i was able to see 256 colors in cygwin also, before that it supported only 8 color mode. but when i load cygwin through conEMU i get to see black dark empty line in between each line. – blackwind Mar 08 '15 at 11:13
  • Have you checked your solution of that is only your suppositions? – Maximus Mar 08 '15 at 13:38
  • I offered it as a possible workaround. Perhaps you can explain why it will not work. That would be helpful. – Thomas Dickey Mar 08 '15 at 14:09
0

Cygwin or Msys do not support 256 colors in ConEmu. They do not know that ConEmu can process xterm-256 and they do processing internally. Of course they bumps into standard console limitation of 16 colors.

Read more in wiki1, wiki2.

I know only one application - official Vim - which can be configured to use xterm-256 in ConEmu.

Maximus
  • 10,751
  • 8
  • 47
  • 65
  • Wiki contains no information relevant to this question. – Thomas Dickey Mar 08 '15 at 10:06
  • In particular, the comments about vim do not give the reader enough information to understand what issue is being addressed. – Thomas Dickey Mar 08 '15 at 10:21
  • HI Maximus, tnx for the reference, i had come across this VIM hack couple of days back, but i was not able to do the same for emacs. Both VI and EMACS are term editor right, so can a similar hack be done with EMACs. – blackwind Mar 08 '15 at 10:25
  • The two ConEmu wiki entries contradict each other: either Vim (and other termcap applications) can be configured to work with cygwin+conemu) or they cannot. Or perhaps (if so, the wiki should be improved), ConEmu has hard-coded behavior to know about "vim.exe" (?) – Thomas Dickey Mar 08 '15 at 11:00
  • @ThomasDickey If you read my answer and wiki carefully you will understand there is no any contradiction. Hint: *official* vim is not build with cygwin. – Maximus Mar 08 '15 at 13:13
  • Adding more information to the wiki is a constructive way of addressing the problem. – Thomas Dickey Mar 08 '15 at 13:21
  • @ThomasDickey wiki already has all possible information. Unless you can help write that "constuctive information" - I do not think it even can exists. – Maximus Mar 08 '15 at 13:32