samedi 20 octobre 2012

emacs-live + tmux: Yes we can!

emacs-live is gorgeous:

But under tmux it can look like this:

Let's fix it!

Note: I'm using Ubuntu Linux, if you're using another distro / OS, it may or may not work.

Does your terminal support 256 colors?

  • If it shows something like the following, you should be good (this is gnome-terminal):

Force tmux to 256 colors

  • In a terminal run tmux
  • And the script again:
  • I'm getting this:

  • If it's the case run tmux with the -2 option to force 256 colors:
tmux -2
  • After that:

Tell Emacs to use 256 colors

  • In the previousely setup tmux session, run Emacs in CLI mode: emacs -nw
  • Then M-x list-color-display
  • I'm getting:

  • We need to make Emacs aware of the 256 colors support
  • Exit Emacs
  • In the terminal:
export TERM=screen-256color
  • Run Emacs again, and M-x list-color-display
  • You're good if you get something like:

I want a really black background!

Things are better, but not perfect: Emacs have a grey-ish background instead of black.
  • In Emacs: M-x list-color-display:

  • Note the name of the black color, for me here it's color-16
  • Eval the following to get a black background: M-:
(set-face-background 'default "color-16")
  • You should have:

Finally ^_^

Date: 2012-10-20 18:23:37 CEST
Author: denis
Org version 7.8.09 with Emacs version 24
Validate XHTML 1.0

3 commentaires:

  1. Hi, really nice post.

    I got some minor difference though.

    The "color-16" was ok in no-window mode (emacsclient -nw) but preventing the "emacsclient -c" (emacs in client window mode) to launch.

    I reverted back to "black" (which do not have the grey-ish tone) like you. And now every client is ok.
    I even almost do not distinguish my client anymore (nw or not).

    Again, thanks.

    1. Hi Unknown,

      I tried to setup a function running when in term mode but without success.
      So I added to my emacs config the following:

      (defun quirk-black-background ()
      (set-face-background 'default "color-16"))

      Not ideal, but I can then invoke the "quirk" when needed

      I'm interested if you find a solution that works with emacs X-window + emacs terminal + emacs server + emacs client.

    2. BTW: I tried this:

      Without success in the following case:

      * emacs started with: `emacs --daemon`
      * then: emacsclient -nw


      * emacs started with: `emacs` and then `M-x server-mode`
      * then: emacsclient -nw

      In either case the emacsclient flash briefly (and I can see the greyish background for a 1/10 sec), but nothing more happen



Qui êtes-vous ?