Archive for Emacs

Pretty Emacs Reloaded

Update: If you are using Ubuntu 8.04 LTS “Hardy Heron” or Ubuntu 8.10 “Intrepid Ibex”, use the packages in the PPA of the Ubuntu Emacs Lisp team, instead of the packages referenced here. For Ubuntu 9.04 “Jaunty Jackalope” and newer, use the packages in Ubuntu repositories.

My popular1 Pretty Emacs package just got a tad better. I transferred the package to the brand new PPA service provided by Launchpad. So, what’s new about the package? First, I glad to announce the long-awaited amd64 support. Also, I am adding Gutsy Gibbon to the list of supported distributions.

To use the updated package on Ubuntu 6.10 “Edgy Eft”, add the

following lines to your /etc/apt/sources.list file:

deb edgy main
deb-src edgy main

To use the package on Ubuntu 7.04 “Feisty Fawn”, add the following lines to your /etc/apt/sources.list file:

deb feisty main
deb-src feisty main

To use the package on the development version of Ubuntu “Gutsy Gibbon”, add the following lines to your /etc/apt/sources.list file:

deb gutsy main
deb-src gutsy main

Unfortunately, if you still use Ubuntu 6.06 "Dapper Drake", you will have to keep using the older package release from my orignal repository. I still support Ubuntu 6.06, but I won't update the package with newer snapshots.

After adding the repository to your software source list, upgrade your version of the package with:

sudo aptitude upgrade

If you do not have a previous version of the package already installed and you desire to install it, do this instead:

sudo aptitude install emacs-snapshot emacs-snapshot-el

When upgrading the package you might get the following warning message:

WARNING: untrusted versions of the following packages will be installed!

Untrusted packages could compromise your system's security. You should only proceed with the installation if you are certain that this is what you want to do.

This is due to a bug in the PPA system. I believe that it will be resolved quickly. So, you can safely ignore the warning message for the moment.

Final note, thank you everyone for trusting me and giving me some great feedback about the package. I like to give special thanks to Romain Francoise and Michael Olson for their work respectively on emacs-snapshot and emacs22, during this summer.

  1. A rough estimate tell me there is over 30 000 people using my package, where 88% of them are Feisty Fawn users and 11% are Edgy Eft users. 

Blogging with Emacs

This is my first blog entry with my brand new toy, the weblogging mode for Emacs. It uses the XML-RPC interface of your favorite blogging platform to manage your blog. In other words, it transformes Emacs into a thermonuclear blog editor.

Even better, the installation is simple and easy. Here’s the instructions how to get it working. First, check out the source code of weblogger into your .emacs.d directory:

cd ~/.emacs.d/
cvs -z3 \
  co -d weblogger weblogger/lisp

Then, make Emacs load this mode on startup by adding these two lines to your .emacs configuration:

(add-to-list 'load-path "~/.emacs.d/weblogger")
(require 'weblogger)

Now, you probably want to reload your configuration with M-x eval-buffer (assuming your .emacs is still open). Finally, setup weblogger for your blog with M-x weblogger-setup-weblog. This command will ask you a few simple questions, like your username and password for your blog. It will also ask you for the location of the XML-RPC interface of your blog. If you’re using WordPress, it will be somewhere like If you’re using another blog publishing platform like Blogger or MovableType, it will be somewhere else, so check your documentation.

And you’re done! You can now start new a new post with M-x weblogger-start-entry. Weblogger also includes a whole set of other commands for managing your blog. Look them up, with C-h a weblogger RET. Happy blogging!

Pretty Emacs: Compile guide for unsupported platforms

If you are using a platform other than a i386, you will need to compile my Emacs packages yourself. So, here a simple guide how to do this.

  1. First, make sure you have the source repository enabled, by adding deb-src gutsy main to your /etc/apt/sources.list.
  2. Install the build-dependencies and some packaging tools:
    sudo apt-get update
    sudo apt-get build-dep emacs-snapshot
    sudo apt-get install dpkg-dev devscripts fakeroot emacsen-common
  3. Download the source package and compile it with:
    fakeroot apt-get --compile source emacs-snapshot
  4. Finally, install the newly built packages:
    sudo dpkg -i emacs-snapshot*.deb

Note, this final step may fail if you have an older version of the package already installed. If it is the case, just do it again.

Back in Business

A burned video, a zapped hard drive and a corrupt RAM module later , I have now, finally, got my system running again (and no, my computer was not struck by a lightning).

For the fans of my Emacs package, I just uploaded a new release, and I will continue to provide weekly releases. Unfortunately, it seems, due to a licensing issue, Romain Francoise orphaned emacs-snapshot and its related packages. Therefore, this means I will have to work harder and fix packaging bugs myself, instead of relying on his bug fixes.

A week before I lost my system, I had promised a special Python quiz, in the issue #31 of Ubuntu Weekly News. I have not forgotten my promise. So if you’re one of the lovers my twisted Ubuntu quizzes, get ready for an awesome quiz. Date and time, when the quiz will be held, will be announced, as usual, in the #ubuntu-trivia channel on FreeNode.

On the final note, I would like to mention that will start posting more frequently on my blog. My current roadmap includes some cool tips-and-tricks, fun script recipes, more stuff about Ubuntu. So, stay tuned!

Bad luck

This week I wasn’t really fun. I first lost my video card — I now have a beautiful snow display. Then, I burned a hard drive in an attempt to access some of my data (luckily, it was my younger brother’s hard drive with his Windows installation). However, it won’t whine about it in a blog post; this isn’t my style.

I just wanted to notice the users of my Emacs package that I won’t be able to update it, until I get my system back on.

Tips on Emacs

Update: Please take the content of this post with a grain of salt. I wrote this at a time I was easily impressed. I still think Emacs is great editor, but it is not the only one. Look around, do your own experiments and pick the editor that fits your needs best. Although I don’t like the evangelizing tone of this post, I still believe in its conclusion: mastering an editor is an extremely worthwhile investment if you are doing a lot text editing.

Here a few Emacs tips and some gospel for those who are still using a butter-knife editor. First, the most important skill you must develop is touch typing. This is what make the most difference in your productivity. I found out that Emacs is really pleasant when you are able to type, at a rate above 50WPM. One thing is sure, being able to type fast, make any typing task more pleasant. From my own experience, when you get good with the keyboard, you start spending less time reading about other people achievements and start creating your own cool stuff. And learning to type fast is easy. Find some online typing material and spend 15 minutes per day, working on your typing skills. You will never regret it.

Most IDE do a lot of code generation, because some programmers are too lazy to learn touch typing. So, they need snippets, IntelliSense, automated refactoring, etc. They’re all nice features. But, do they really make you more productive? I don’t think point-and-click programming is really productive. That is where Emacs comes in. Emacs, and also Vim, are different in the way they attack the problem of rapid development. They both try to make editing easier, and this is a truly challenging task.

Emacs gives you the power to make your editor. Some people may argues that, this feature made Emacs an operating system. Yet, it is this flexibility that made Emacs so powerful. Almost all the commands in Emacs are coded with Emacs Lisp — a full programming language built in Emacs. Even the cursor behavior is coded in Emacs Lisp. How many of these point-and-click IDE have you seen, which allowed you to change how you move the cursor? I bet the number is near zero. An example of this power, is a mode called chop. This mode makes your cursor behaves like a binary tree. It allows you to reach any line on your screen in O(log2 n) steps, where ‘n’ is the screen’s height. In plain English, this means you can reach any line, on a 130 lines screen, in less than 7 keystrokes. However in reality, the number steps is much smaller, because Emacs has a full set of other tools for moving your cursor, where you want it.

Now the interesting part, how to get good with Emacs. Learning Emacs is the same thing as learning touch typing. You need to practice a lot and frequently. The first thing you need to master is the keyboard shortcuts. There is a lot of shortcuts, in Emacs. There’s probably more than your brain can hold. But with some training, we will see that Emacs’ keyboard shortcuts are easy to remember. They all follow the same structure. Like touch typing, there’s also tools for learning the keyboard shortcuts. I highly recommend keywiz, which run within Emacs. This tool analyzes all the keyboard shortcut in Emacs, even the one you changed, and generate quizzes about them. Again, same idea as touch typing, practice about 15 minutes per day on a daily basis.

As your journey progresses, you will find the need to change some of the default behaviors of Emacs. This is done by putting stuff in your .emacs — the most precious file of any Emacs user. Trust me, you don’t want to lose this file. So, make sure you do regular backups or use a version control system, like Subversion, to protect it. How to use this file is an art itself. Some people like to keep all their configuration in a single file, some don’t; some others don’t care if it’s messy, some don’t; and so on. Personally, I like to separate the different components into smaller files. And, I like to use customize for the on/off type of settings. But, that is just question of personal taste. There isn’t a better .emacs. The best one will always be yours. You will, although, want to see how the others configured their Emacs. That is normal. We are all curious creatures, after all. A final note about .emacs, don’t spend too much time playing on it. Configuring Emacs is fun and addictive, but it won’t help your productivity by much, if you can’t touch type or use the keyboard shortcuts.

The last, but not the least, thing you need to know, is Emacs Lisp. This is probably… No, this is the greatest feature of Emacs. And, it’s also the hardest to master. Learning a programming language is not the same thing as learning touch typing. Dumb practice won’t help you. You will need to sit down and think. Lisp, and all its parenthesizes, freak most people, who got some programming experience. Unlike some people says, Lisp is easy to learn. There’s nothing exceptional about learning Lisp. You learn it as any other programming language. Get a book, read it attentively, write some code, repeat. That’s my general algorithm for learning programming languages, and it works. I learned several programming languages, including Lisp, this way. One more thing, knowing Lisp do not make you a superior programmer. What makes you a superior programmer is your ability to learn new ideas. So, don’t get caught by this lie from Lisp evangelists.

Emacs is still a great tool, even if you don’t learn Emacs Lisp. In fact, many Emacs users never learn it and are still more productive than the majority of the other editors users. You can always copy-and-paste some Emacs Lisp code found on the web.

However, I haven’t said yet why you should learn Emacs Lisp. The reason is that if you know it, you can add features to your editor, on-the-fly, without even restarting Emacs. Did ever wished your editor had a particular feature? Well with Emacs, when you know Emacs Lisp, you just add it. Emacs evolves with you. So, if you do a lot of programming, you will end with a lot of programming helpers and macros. On the other hand, if you write a lot of web articles, you will probably end up with a lot of text manipulation utilities. It is just beautiful, how Emacs can adapt to your editing needs.

Finally, mastering a good editor is a lifetime investment. You better choose one that can evolve with you or you will end up using many different editors poorly. Remember, that being productive isn’t that important, but the fun of mastering something is. You will smile when you will transform a painful editing task into a trivial one. So, enjoy your journey in the world of Emacs.

Don’t use fake emails

<p>this is the error I get when trying to get your repositories</p>


<p>Please help</p>

I just got this comment, on my post Pretty Emacs. The error message was probably truncated by the HTML filter of WordPress. Unfortunately, when I tried to send an email to the author of this comment, I received a delivery error which told me that the author’s email address didn’t exist. So, I am stuck with a help request from a ghost.

I really care about the errors you get with the packages in my repository. If you stumble on a bug in one of my packages, it is my fault. And it is my responsibility to fix it. So please, don’t fake your email address when you leave a comment.

Pretty Emacs

Update: If you are using Ubuntu 8.04 LTS “Hardy Heron” or Ubuntu 8.10 “Intrepid Ibex”, use the packages in the PPA of the Ubuntu Emacs Lisp team, instead of the packages referenced here. For Ubuntu 9.04 “Jaunty Jackalope” and newer, use the packages in Ubuntu repositories.

Emacs is my editor of choice. In fact, I should say it’s my framework of choice, but that’s for another post. Until recently, I disliked the poor font backend of Emacs. So, I was always using Emacs within a terminal window to get a decent looking interface. However, this grungy font era is over, since Emacs’s hackers added recently to my favorite editor a XFont backend, thus making possible to use good looking fonts, like Bitstream Vera Sans Mono.

Screenshot of Emacs with XFT support

I made a package that makes the installation, as painless as possible. So, feel free to use it. However, please note that this is an alpha release of Emacs, therefore it should only be used for testing. (From my experience, it’s rock solid.)

Still interested? Then, here the instructions. First, add my repository into your software source list, by adding the following lines to /etc/apt/sources.list:

deb feisty main
deb-src feisty main

If you are running Ubuntu 6.10 (Edgy Eft) or the current development version of Ubuntu (Gutsy Gibbon), change feisty for edgy or gutsy.

Finally, run either apt-get or aptitude to fetch and install the packages:

sudo aptitude update
sudo aptitude install emacs-snapshot emacs-snapshot-el

Now, you need to specify the font you want to use in your Xresources file.

echo "Emacs.font: Monospace-10" >> ~/.Xresources
xrdb -merge ~/.Xresources

Here, I use the default monospace font, but any other monospaced font should work too. For example, if you want to use Lucida Sans Typewriter instead, change Monospace-10 for Lucida Sans Typewriter-10 in the above command.

And that’s it! Now, launch Emacs and enjoy the good looking fonts.

If you need support with the package, just email me at

Update: Il y a, maintenant, une version en français de ce guide sur le wiki de Ubuntu-fr.