ansi-term-color-vector is not set #11

Closed
tvaughan opened this Issue Apr 25, 2013 · 12 comments

Projects

None yet

2 participants

@tvaughan

I can set this after I load the theme but I can't figure out where to add this in color-theme-sanityinc-tomorrow.el.

(setq ansi-term-color-vector
  [foreground red green yellow blue purple aqua background])

References:
http://stackoverflow.com/a/14528611
https://github.com/sellout/emacs-color-theme-solarized/pull/78/files#L0R533

@purcell purcell added a commit that referenced this issue Apr 25, 2013
@purcell Simplistically set ansi-term-color-vector (see #11)
It would probably be better to define the term-color-* faces
b197303
@purcell
Owner
purcell commented Apr 25, 2013

Thanks Tom; let me know if the commit I've just made fixes things for you: b197303

@tvaughan

Thanks for the quick patch @purcell but this doesn't work for me. It looks like that block of code is never run. That whole progn block is never hit. Or so it seems. If I add some garbage to the top of this new version of color-theme-sanityinc-tomorrow.el emacs complains when I run M-x color-theme-sanityinc-tomorrow-night. But if I move that garbage into that progn block (or just before it) then emacs doesn't complain.

I wish I knew how to debug this better.

I'm running Ubuntu 12.10 and Emacs 24 from the Ubuntu 13.04 repos. I installed this theme from marmalade. There's no instance of this theme on my machine other than what's under ~/.emacs.d. My emacs setup is pretty vanilla. Please let me know if there's something else I can do to provide you with more to go on.

@purcell
Owner
purcell commented Apr 25, 2013

I haven't updated the theme yet on Marmalade, if that makes a difference to what you're testing.

Locally, I can confirm that the progn in color-theme-sanityinc-tomorrow--define-theme is taking effect: that's a macro, so after changing it, you need to re-evaluate the corresponding specific theme file, e.g. sanityinc-tomorrow-night-theme.el. That's probably why the garbage you inserted seemed not to have any effect.

Anyway, the theme sets ansi-term-color-vector set to a list of strings for me, but it turns out that's an unacceptable value: it should be a vector of faces, like the solarized example you referenced, but unlike the code in the stackoverflow answer to which you linked.

So I'll need to make a further commit instead setting the various ansi-term-* faces... please bear with me. :-)

@purcell purcell closed this in c104fa0 Apr 25, 2013
@purcell
Owner
purcell commented Apr 25, 2013

There -- that seems better. The ansi-term-color-vector var gets left alone, but the term-color-* faces are correctly set so that everything looks right. :-)

@tvaughan

Thanks! But this still doesn't work for me. As before, I copied the new version over the version I had under ~/.emacs.d/elpa/color-theme-sanityinc-tomorrow-1.9 and started a new instance of emacs24 (not a client) and ran M-x color-theme-sanityinc-tomorrow-night. I even removed the .elc's. How would you recommend I test this new version?

@tvaughan

FYI, this works in sanityinc-tomorrow-night-theme.el

(require 'color-theme-sanityinc-tomorrow)
(color-theme-sanityinc-tomorrow--define-theme night)
(setq ansi-term-color-vector ansi-color-names-vector)
@purcell
Owner
purcell commented Apr 26, 2013

Hang on... you don't have the color-theme library installed, do you? There's a line I forgot to remove, which would only stop it from working if you were using that rather than the built-in Emacs 24 theme support. The fix is in 514e82f.

In short, the way it should work is this: the value of ansi-term-color-vector should be left as the default: [term term-color-black term-color-red term-color-green term-color-yellow term-color-blue term-color-magenta term-color-cyan term-color-white]. And then the theme takes care of setting the various term-color-* faces.

So please try updating again, and make sure you don't have color-theme on your load-path, if you previously did.

@purcell
Owner
purcell commented Apr 26, 2013

Also, which Emacs 24 minor version do you have? It looks like the ansi-term color mechanism changed in Emacs 24.3, so it's possible that if you have 24.2 or lower, then none of this would work for you anyway.

@tvaughan

I appreciate your continued effort on this but still no luck.

I had color-theme installed as part of emacs-goodies-el.

tvaughan@beisbol:~$ sudo updatedb
tvaughan@beisbol:~$ locate color-theme | grep -v sanityinc
/usr/share/emacs/site-lisp/emacs-goodies-el/color-theme-library.el
/usr/share/emacs/site-lisp/emacs-goodies-el/color-theme.el
/usr/share/emacs/site-lisp/emacs-goodies-el/color-theme_seldefcustom.el
/usr/share/emacs24/site-lisp/emacs-goodies-el/color-theme-library.el
/usr/share/emacs24/site-lisp/emacs-goodies-el/color-theme-library.elc
/usr/share/emacs24/site-lisp/emacs-goodies-el/color-theme.el
/usr/share/emacs24/site-lisp/emacs-goodies-el/color-theme.elc
/usr/share/emacs24/site-lisp/emacs-goodies-el/color-theme_seldefcustom.el
/usr/share/emacs24/site-lisp/emacs-goodies-el/color-theme_seldefcustom.elc
tvaughan@beisbol:~$ locate color-theme | grep -v sanityinc | xargs sudo rm -f
tvaughan@beisbol:~$ sudo updatedb
tvaughan@beisbol:~$ locate color-theme | grep -v sanityinc

I'll update emacs next.

tvaughan@beisbol:~$ emacs --version
GNU Emacs 24.1.1
@purcell
Owner
purcell commented Apr 26, 2013

Okay. I strongly suspect that updating your emacs will fix this issue -- prior to 24.3, ansi-term didn't use those faces I've just defined (and which were added to the solarized theme in the commit you linked to).

@tvaughan

Yup. That did the trick. From here https://launchpad.net/~cassou/+archive/emacs. As a part of this process emacs-goodies-el was updated which re-installed color-theme. That didn't need to be removed after all. Thanks!

$ emacs --version
GNU Emacs 24.3.1
@purcell
Owner
purcell commented Apr 26, 2013

Yay, great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment