BLOG

May 24 2009
Posted by chl @ 6:31pm UTC

Like all properly enlightened techy types, I use Emacs as my editor of choice when I’m doing real coding work. I’ve been doing this for a while now, I’ve seen a lot of editors come and go, but Emacs (and XEmacs) have always been here for me. Yes, it’s ridiculously annoying to learn how to use properly. In fact, I’d hardly say I know how to use it “properly” considering what it’s capable of. But even with my limited knowledge of it, I’ve simply never found anything that really compares.


This sort of statement often gets other nerds riled up. The Vi vs. Emacs debate has been going on I think literally forever now, and I don’t really want to rehash any of it here. Suffice to say that I assume eventually the Vi people will figure out that they’re in the wrong and switch.

More interestingly of late has been the OS X people who are deeply, madly, rabidly in love with Textmate. I tried it out, and immediately felt like this guy:

dilbert-unix
Honestly, it was cute, but it took me less than three minutes to want to use a feature (split panes) that Emacs will happily do for me that it just doesn’t have. Since I needed to get actual work done, it was back to Emacs.

But I will say this for Textmate: the fonts looked beautiful. I mean, they were really lovely. Now, I like being a power user and I like getting stuff done efficiently, and therefore I like Emacs. But I also like things to look nice. I spent some time today trying to figure out how to make Emacs in Ubuntu look as pretty. This took me longer than I feel like it should have considering how easy the answer is.

At any rate, since it wasted my time, I thought I’d write it down so perhaps you won’t have to waste any of yours. On my Ubuntu 9.04 install, the following does the trick.


chl@melian:~$ sudo apt-get install emacs-snapshot-gtk
chl@melian:~$ echo "Emacs.font: Monospace-10" > ~/.Xresources
chl@melian:~$ xrdb -merge ~/.Xresources

Do that, start up emacs, and voila! The fonts look just about as nice as they did in Textmate using OS X.

Screenshot-emacs-snapshot-gtk@melian.chrislea.com

Enjoy!

10 Responses to “Pretty Emacs fonts in Ubuntu”

  1. WimpyWillow says:

    Looks really nice :)

    But the first line of text in a buffer flickers for me when doing this so I removed the Emacs.font value again (since the normal emacs22 wasn’t even starting anymore with the Emacs.font value set).

    If someone else encounters this nice blog post but wants to restore his system again, here’s what I did:

    (Dunno if what I did was right but this seems to do the trick)
    xrdb -remove Emacs.font

    This could also potentially toast your computer because I had no Idea at all what I was doing, use at your own risk.

  2. Chris Lea says:

    @WimpyWillow Wow, that’s really interesting. For what it’s worth, I don’t see that sort of flickering at all. This makes me think at first guess that it may be something to do with the video drivers. I’m using the proprietary NVidia drivers that you can get from the Ubuntu repositories and an NVidia 8500 (I think) card in my rig. Sorry it didn’t pan out for you.

  3. WimpyWillow says:

    @Chris Lea
    It was very interesting to see though :) And I’m sure this bug will get fixed in time (maybe it already is in newer builds of Emacs).

    I’m using the proprietary ATI drivers with a Radeon HD2600 XT. I wanted to buy NVidia but I thought I was gone from using Linux forever, I tried it out now and then for weeks and sometimes months but never stuck with it. The ATI cards are usually cheaper and faster, so I bought the ATI. Two months after getting the ATI card, I switched over to Linux completely and I cursed myself for buying an ATI card countless times since then :)

  4. Pavan Mishra says:

    Thats great addition to my emacs working env.

  5. Olle says:

    Instead of using .Xresources you can actually put this in your ~/.emacs:

    (if (>= emacs-major-version 23)
    (set-default-font “Monospace-9″))

    Maybe a bit more convinient if .Xresources feels scary (it often does).

  6. плoxoЙ says:

    А комментарии тут реально интересные. Буду следить за комментами и далее ;)

  7. Alex says:

    Excellent post. To be honest this was the reason I was using carbon emacs in my mac. I love the fonts. Thanks, I am really happy to have found this. Great job.

  8. Tim Johnson says:

    You say:
    “”"
    Suffice to say that I assume eventually the Vi people will figure out that they’re in the wrong and switch.
    “”"
    and I say try editing mixed code html with emacs and you will love vim.
    I love both vim and emacs, and I would love to use the additional fonts.

    Is there a slackware solution?
    thanks
    tim

  9. Ynas says:

    Написано интересно, но для меня уже не очень актуально. Пишите еще!

  10. ben says:

    Where do I need to make changes if I want to black background?

    Thanks a lot.

    Ben

Leave a Reply

10 Comments

chrislea.com is proudly powered by wordpress
entries (rss) and comments (rss).

Switch to our mobile site