The Free Geek

Ramblings of a Free Software Geek

GNU Emacs with XFT goodness Mon, 06 Nov 2006 17:56:48 +0000

Filed under: GNU/Linux,Programming,Ubuntu — Bon Goose @ 17:56:48

Personally I have been using the emacs-unicode-2 CVS branch of GNU Emacs for a long time now. This branch will become Emacs 23 in the future and it contains better Unicode handling code in addition to some cool features like antialiased fonts (courtesy XFT and FreeType), copy to clipboard, etc.

GNU Emacs with XFT

I usually build a custom version of the emacs-snapshot package with source from the emacs-unicode-2 branch and some simple customisation to enable the antialiased fonts. Some of my friends are using those packages and I thought it’d be good if share those packages with a larger audience.

So I have set up an APT repository with those packages which you can install on your Ubuntu Dapper machine. To do that, first add the following line to your /etc/apt/sources.list

deb http://people.ubuntu-in.org/~ghoseb/apt/ dapper main
deb-src http://people.ubuntu-in.org/~ghoseb/apt/ dapper main # for source

Then do sudo apt-get update to fetch the package list and then sudo apt-get install emacs-snapshot-gtk to install the customised GNU Emacs package.

If you already have the vanilla emacs-snapshot installed then only sudo apt-get upgrade will upgrade your current installation to the new one. And yes, this package can co-exist peacefully with your emacs21 package.

Now to enable antialiased fonts, add the following line to your ~/.emacs

(set-default-font "Bitstream Vera Sans Mono-8")

Now launch GNU Emacs as emacs-snapshot-gtk --enable-font-backend and enjoy the awesomeness :)

Leave a comment if any of you need Ubuntu Edgy packages, I will build them and add to the repository.

Update: I have added Edgy packages too ! Just add the following lines to your /etc/apt/sources.list and the rest is identical to the instructions for Dapper.

deb http://people.ubuntu-in.org/~ghoseb/apt-edgy/ edgy main
deb-src http://people.ubuntu-in.org/~ghoseb/apt-edgy/ edgy main # for source

About these ads
 

55 Responses to “GNU Emacs with XFT goodness”

  1. yang zhao Says:

    Yes! Let’s have some edgy packages! Although the dapper packages works alright in edgy. (eh, what will be the difference? :-/ )

    I think any one eager enough to use this new snapshot must have upgraded to edgy.

  2. [...] GNU Emacs with XFT goodness (tags: emacs linux ubuntu) [...]

  3. Hermeschris Says:

    Looks great! … and yes, I’d also be interested in edgy packages.

  4. Ipsen Says:

    Here’s what I did (and failed):

    1. Downloaded emacs-snapshot_20061027.orig.tar.gz

    2. ./configure –prefix=/usr/local –enable-font-backend –with-xft –with-freetype –with-gtk

    3. make bootstrap; make

    4. Ran emacs as:

    /usr/local/bin/emacs –enable-font-backend

    and the following error pops up in the *Messages* buffer:

    (/usr/local/bin/emacs –enable-font-backend)
    For information about the GNU Project and its goals, type C-h C-p.
    command-line-1: Unknown option `–enable-font-backend’

    5. Adding

    (set-default-font “Bitstream Vera Sans Mono-8″)

    to .emacs just gives an additional error, namely

    error: Font `Bitstream Vera Sans Mono-8′ is not defined

    6. Toolbar looks OK GTK like, but the main window is still using Type1 X font.

    Any help here? (Running Ubuntu 6.10 – the Edgy Eft)

    Best, Ipsen

  5. Baishampayan Says:

    Ipsen,
    From where did you fetch the above code? If that’s the vanilla emacs-snapshot source, then it won’t work. You need the source from the emacs-unicode-2 CVS branch to get it working.
    But then, just wait for Edgy packages … I am uploading them right now :)
    BG

  6. Ipsen Says:

    Got it from the link given above

    http://packages.debian.org/unstable/editors/emacs-snapshot

    Have a sick passion for compiling emacs, so if you don’t mind giving me a direction to the emacs-unicode-2 CVS branch, I’d love to have it.

    All the best

  7. Baishampayan Says:

    Ipsen,
    Ah, that is the vanilla emacs snapshot. You can use the source I used to build my packages. You can get that from http://people.ubuntu-in.org/~ghoseb/apt/pool/main/e/emacs-snapshot/emacs-snapshot_20061106-1.tar.gz
    Or if you wait for just one more hour you can use the packages I built for Edgy.
    BG

  8. Ipsen Says:

    Just did:

    cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs co -r emacs-unicode-2 emacs

    Compiles fine, but running emacs gives:

    Fatal error (6)Aborted (core dumped)

    Will try your source link (and report status).

  9. Ipsen Says:

    Just tried to compile the sources you pointed out above (emacs-snapshot-20061106). Also compiles out-of-the box. But running emacs, i.e.

    emacs –enable-font-backend

    gives

    Fatal error (6)Aborted (core dumped)

    But doing

    emacs –enable-font-backend –font Monospace-8

    pops up a nice looking editor. But I feel somewhat insecure suddenly…

    Best regards

    Any clues?

  10. Baishampayan Says:

    Ipsen,
    Most probably some issues with your installation. Try using strace. Also, I uploaded the Edgy packages. Try them out.

    BG

  11. Ipsen Says:

    Hi,

    Just installed your Edgy package. Emacs seg. faults here as well, if the you DON’T specify a font directly on commandline using the –font option. Any clues?

    My Edgy system is less than 5 days old, so had very little time to do any harmful things other than installing a few packages with apt-get.

    BTW: strace fails with:

    kill(7602, SIGABRT) = 0
    — SIGABRT (Aborted) @ 0 (0) —
    +++ killed by SIGABRT (core dumped) +++
    Process 7602 detached

  12. Baishampayan Says:

    Ipsen,
    No wonder, it segfaults here on my Edgy machine as well. Might be some odd bug. One last test, apt-get my Dapper packages on your Edgy machine and then try. Quite a few people are using those without any issues.
    This is very strange …

    BG

  13. pliz Says:

    Thanks for the build, packages and the repository. I ‘ve tried compiling my own version of emacs+xft but was getting too many segfaults. Lets see if your build is more stable :)

  14. Bruce Says:

    When I try updating in edgy I’m getting the following error:

    In toplevel form:
    w3mnav.el:51:1:Error: Cannot open load file: w3m
    emacs-install: /usr/lib/emacsen-common/packages/install/quack-el emacs-snapshot emacs21 failed at /usr/lib/emacsen-common/emacs-install line 28, line 7.
    dpkg: error processing emacs-snapshot-gtk (–configure):
    subprocess post-installation script returned error exit status 1
    Errors were encountered while processing:
    emacs-snapshot-gtk
    E: Sub-process /usr/bin/dpkg returned an error code (1)

  15. Bruce Says:

    Doing

    apt-get remove emacs*

    and then re-installing seems to work. Now I just have to figure out why it is segfaulting.

  16. jay Says:

    Huh, the first time I ran it, I got a “Fatal error (6)Aborted (core dumped)”, then I tried running it with –font Monospace-8 and a window appeared at least. But I didn’t get a new font (instead I got the same ugly font that I get with vanilla emacs, on my fresh ubuntu edgy, it’s not the usual one but a really horrible unusable one, and I don’t know how to change it.). Starting emacs-snapshot-gtk with only –enable-font-backend works now thought, after starting it with -font once (but still no pretty font.) Anyway, even though it doesn’t (yet) work for me, I appreciate what you are doing :-) !

  17. jay Says:

    gah, ignore what I just wrote, I mixed emacs and emacs-snapshot-gtk >_

  18. jay Says:

    Oops, my stupid smily ruined my comment. What I was trying to say: I forgot to call emacs-snapshot-gtk most of the time, so I now get a nice font, but it still aborts if I call it without -font Monospace-8.

  19. Baishampayan Says:

    Some fixes have been committed to CVS. I will fetch the new source and update the packages as soon as I get some time. Thanks for all the comments by the way …

  20. alaska Says:

    Thanks for the edgy packages! It works great except for one issue. If I click on a panel menu while emacs is focused, everything seems to freeze. Does anyone experience this problem?

  21. ipsen Says:

    Hi, Just tried out the Dapper version of your package (on an Edgy system). This time it works, i.e. you do NOT get a seg. fault error if the –font option is omitted.

    I’ll try it out in some innocent editing sessions and see if it seems to work out.

    Thanks for your efforts, hints and help.

    // Ipsen

  22. Squider Says:

    Thanks for the great edgy packages.

  23. You forgot to mention where your GPG signature is. Anyway, I found it myself.

    wget http://people.ubuntu-in.org/~ghoseb/public-key.asc -O- | sudo apt-key add -

    Thanks for the package.

    PS.: I found your .emacs file in your home page. I would like to share mine with you. http://svn.peadrop.com/emacs Enjoy!

  24. Fernando Says:

    Thanks for your packages, it will be nice not to have to build it by hand. But I have a question for you. Here:

    I’ve put a screenshot that has, on the left, your package, while on the right is a build I had just made a few days ago using this branch and patch:

    cvs up -Pd -r XFT_JHD_BRANCH
    wget http://www.forcix.cx/files/emacscvs.patch
    patch -p1

  25. Baishampayan Says:

    Alexandre: Many thanks :) You seem to be a real GNU Emacs geek.

    Fernando: XFT_JHD_BRANCH is no longer maintained. I used to use that before but now that the XFT patches have been merged with emacs-unicode-2 and is actively maintained, I have switched branches. The difference, I can see. Both are antialiased though the one from XFT_JHD_BRANCH has bolder fonts. Personally I am not aware of the reason behind this.

    Everybody: I will make better packages this time with a better source (some bug fixes) soon. Do watch this page (or do an apt-get upgrade once a week or so).

  26. Fernando Says:

    I think the tail of my message was cut out. In it, I mentioned a couple of things:

    1. Unfortunately, your build produces very thin characters, which on a 1600×1200, 14 inch screen, are very difficult to read.

    2. The XFT_JHD branch renders the fonts exactly like every other application on my system, so I wonder why your build does something different.

    I’d really like to use your builds, since the JHD branch segfaults occasionally. If there is any testing or information I can provide to help in diagnosing the problem, I’ll be glad to do so.

    Regards,

    f

  27. Baishampayan Says:

    Fernando: Yes, it’s apparent from the screenshot you showed me. If only I could determine the difference in the XFT patches between the two branches, I could understand why they behave differently.

  28. [...] GNU Emacs with XFT goodness « The Free Geek (tags: emacs ubuntu) [...]

  29. Fernando Says:

    Mmh… I’ll try to find the time to do a local build of the emacs-unicode branch and see if I get any different results. On my system, I’m using these
    patched xft packages to get decent fonts:

    http://ubuntuforums.org/showpost.php?p=1041769&postcount=1

    Since those include development libraries and I did the emacs build /after/in installing those packages, it’s very possible that this is causing the difference.

    In that case, there’s no point in sending you on a wild goose chase.

    Regards,

    f

  30. Fernando Says:

    I found the problem: my font size was set using :height 126, which apparently worked fine with the JHD branch.

    Changing that number to 130 now works with a manual build of the unicode branch. I’m going to switch then to your packages, so I can avoid having to track CVS by hand.

    It seems the interpretation of non-multiple-of-10 sizes changed somewhat.

    Thanks for the packages!

  31. Zed Says:

    If you change emacs.c from

    #ifdef USE_FONT_BACKEND
    enable_font_backend = 0;

    to

    #ifdef USE_FONT_BACKEND
    enable_font_backend = 1;

    you won’t have to specify –enable-font-backend on the command line. (I just built my own.)

  32. Bruce Says:

    I just built emacs from arch today using the code from emacs–unicode–0. It seems to be working for me so far (fingers crossed). Thanks for making the packages and inspiring me to get my own emacs fixed.

  33. Hendrik Says:

    $ emacs-snapshot-gtk –enable-font-backend
    Fatal error (6)Aborted (core dumped)

    This happened with Edgy.

  34. As with all? GNU stuff the long options start with — not -.
    so:
    emacs –enable-font-backend –font “Bitstream Vera Sans Mono-10″
    not:
    emacs -enable-font-backend -font “Bitstream Vera Sans Mono-10″
    HTH.

  35. Looks like wordpress mangles what I type.
    each long option should start with two hyphens, not one.

  36. [...] 当年从Emacs改用gvim的很重要的一个原因就是Emacs的字体怎么看都不顺眼。现在Emacs终于开始支持 antialiasing (2006年都快过完了,感觉还呆在上个世纪…)。已经习惯了vim,所以没有换回的打算,不过还是忍不住装了一下玩玩。必须要用最新的 cvs snapshot 才行,这里可以找到 Ubunty Edgy 的包。 [...]

  37. Lasse Says:

    This is fine. I recently started to have strange font problems in emacs and xemacs (just empty rectangles instead of reasonable symbols) and then found this site. I placed an alias in my .bashrc to start emacs-snapshot-gtk –enable-font-backend –font Monospace-13 due to segmentationfaults etc as mentioned above. Now it works fine for me and looks great and I finally have a good editor again and thank you very much!

    Lasse

  38. filippo Says:

    hi, i’m trying the new unicode/xft branch e i’ve got to say that it’s more stable than the last time i tried it (april?).. but i noticed that only the font i’ve set with set-default-font is antialiased.. every other font is set to classic ones like helv and courier or fixed.. by now i’m replacing each occurency of them in face configuration..
    do you know a better way to replace each helv with sans and each courier with mono?
    thanks, Filippo

  39. Hendrik Says:

    Now it worked! Thanks for this package!

  40. enno Says:

    Hello

    Just did

    apt-get install emacs-snapshot-gtk

    Works fine for me. What I miss is dired-x
    Where can I find a suitable version?

    Thanks
    Enno

  41. Hendrik Says:

    Hmm, after uninstalling and getting the package from the Ubuntu repository, I’m missing the black background and the colors. Is there a chance to get this package to the official repository? I think this would be better in terms of dependencies, or?

  42. Daniel Lucraft Says:

    I’ve installed emacs-snapshot-gtk and it’s great in that it looks nice with the menu bar and scrollbars and modelines and whatnot. I’m also pleased because it includes TRAMP, which I’ve been meaning to get working for ages.

    So thanks for all that.

    But, I’m getting the message ‘unknown option: enable-font-backend’ when I start up with that on the command line, and there’s no sign of antialiasing anywhere. Any ideas?

    (I got it from the Dapper repos)

  43. Alexandre Vassalotti Says:

    How often do you plan to update the package?

  44. Simon Says:

    I just installed Emacs with your ubuntu packages and had to use the -enable-font-backend -font monospace-10 commandline options to have it starting without crash.
    However, Emacs crashes at random, sometimes without me doing anything. Is this a problem with your packages or is it generally because it’s the development branch? And is there anything I can do to fix this?

  45. Simon Says:

    Update to my previous comment: using the Dapper packages seems to work.

  46. I decided to host my own Emacs XFT packages, due to the lack of updates. I will sync my package once per week with the upstream CVS branch.

    Here the address of the repository:

    http://debs.peadrop.com/dists/edgy/backports/

  47. [...] This weekend, however, I managed to screw up the fonts in Emacs. They were never great, but I’d managed to get them to a state where they didn’t kill my eyes or take up half the screen. As I started to poke at the problem this morning, I ran across the prospect of using Emacs with XFT fonts. More poking and I found a source for .debs of updated emacs-snapshot packages. Your mileage may vary, but I found, like other people in the comments thread, that the dapper packages actually work better on Edgy than the edgy ones. So after installing the packages I had lovely anti-aliased font support, but alas, planner-mode broke. So to save anyone else in this situation (ha!) some grief, you need to grab planner and muse from source when using them with Emacs 23 on Ubuntu 6.10. The “latest” tarball links in the Emacs Wiki work. [...]

  48. quux Says:

    Hi, I just installed your packages under Edgy… works perfectly! Thanks.

  49. Johan Says:

    Thanks for the nice packages!

    Every time I upgrade an Ubuntu distro something happens with my fonts in emacs. When searching for fixes, I stumbled over this site, and all my font problems went away! (Seems like a common story)

    Thanks also to Alexandre, for keeping us updated! I had a memory leakage issue with the first packages.

    Johan

  50. mixandgo Says:

    care to comment on how to make planner-mode work with it ?

  51. Vaidotas Says:

    I tried installing these packages on Dapper, but with no succes. All I got is this:

    emacs-install emacs-snapshot
    install/cedet-common: Handling install for emacsen flavor emacs-snapshot
    Loading /etc/emacs/site-start.d/00debian-vars.el (source)…
    Loading /etc/emacs/site-start.d/50cedet-common.el (source)…
    Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)…
    Skipping dictionaries-common setup for emacs-snapshot
    Loading /etc/emacs/site-start.d/50eieio.el (source)…
    Loading /etc/emacs/site-start.d/50festival.el (source)…
    Loading /etc/emacs/site-start.d/50psvn.el (source)…
    Loading /etc/emacs/site-start.d/50python-docutils.el (source)…
    Loading /etc/emacs/site-start.d/50vc-svn.el (source)…
    Loading /etc/emacs/site-start.d/51ede.el (source)…
    Loading /etc/emacs/site-start.d/51speedbar.el (source)…
    Loading /etc/emacs/site-start.d/52semantic.el (source)…
    Error while loading 52semantic
    Loading /etc/emacs/site-start.d/55ecb.el (source)…
    Error while loading 55ecb
    Wrote /usr/share/emacs-snapshot/site-lisp/cedet-common/cedet-autogen.elc
    Wrote /usr/share/emacs-snapshot/site-lisp/cedet-common/cedet-compat.elc
    Wrote /usr/share/emacs-snapshot/site-lisp/cedet-common/cedet-edebug.elc
    Wrote /usr/share/emacs-snapshot/site-lisp/cedet-common/cedet.elc
    Wrote /usr/share/emacs-snapshot/site-lisp/cedet-common/cedet-load.elc
    Wrote /usr/share/emacs-snapshot/site-lisp/cedet-common/ezimage.elc
    Wrote /usr/share/emacs-snapshot/site-lisp/cedet-common/fame.elc
    Wrote /usr/share/emacs-snapshot/site-lisp/cedet-common/inversion.elc

    In toplevel form:
    mode-local.el:762:17:Error: Invalid function: #

    In toplevel form:
    pprint.el:226:4:Error: optimizer error: missed tags ((23 TAG 2))
    Wrote /usr/share/emacs-snapshot/site-lisp/cedet-common/sformat.elc
    Fatal error (11)/usr/lib/emacsen-common/packages/install/cedet-common: line 42: 10663 Segmentation fault ${FLAVOR} ${FLAGS} ${FILES}
    emacs-install: /usr/lib/emacsen-common/packages/install/cedet-common emacs-snapshot emacs21 failed at /usr/lib/emacsen-common/emacs-install line 28, line 8.
    dpkg: error processing emacs-snapshot-gtk (–configure):
    subprocess post-installation script returned error exit status 139
    Errors were encountered while processing:
    emacs-snapshot-gtk
    E: Sub-process /usr/bin/dpkg returned an error code (1)

    Any ideas?

  52. holddigga Says:

    Vaidotas I am having the same problem, have you solved it yet?

  53. [...] Emacs from the repositories but the installation was never successful. Later I also followed posts GNU Emacs with XFT goodness and Emacs font [...]

  54. [...] lazyweb, I’d like an RPM like g33k provides for Debianish GNU+Linux someday. The blog post GNU Emacs with Xft Goodness in Fedora Copyright © David Crossland. As [...]

  55. [...] cvs snapshot 才行,这里可以找到 Ubunty Edgy [...]


Comments are closed.

 
Follow

Get every new post delivered to your Inbox.