31 October 2006

Emacs packages roundup

A lot of knowledgeable people swear by Emacs. But when you first open it up you can get scared. Its hard to open a file without entering a mysterious key combination, there is no syntax-highlight, no file browser, no auto-indent… So what’s the reason? There are actually three of them I believe:

  1. Emacs is a editor-building framework, not an editor itself. If you want to use it, you need to customize it. Using a plain Emacs doesn’t make much sense.
  2. A lot of the nice stuff is in the CVS version. Eg. a lot of people is using stable versions of Emacs with some ugly X11 toolkit on Linux, where actually there is a much better version with GTK2, Xft and lots of other nice stuff, but you need to grab it from CVS.
  3. You need to get to know the various packages Emacs provides to explore it full power

I want to dwell into point 3 now, for 1 and 2 check out EmacsWiki.org - the definitive Emacs resource.

Here we go, the Emacs packages Hall of Fame:

- Ido-mode makes opening files and switching between buffers sooo much easier. As you type the file path or buffer name, this package shows you possible completions - string containing the substring you entered. Its a bit hard to explain, take a look at Plentypopes screencast or my own Linux demo to get the idea.

- Tramp (or Transparent Remote file Access, Multiple Protocol) - Using Tramp you can edit files on remote hosts through ssh, scp, ftp, samba, whatever. You can also use it to edit files as the root user on your local box through sudo/su (to make it work with zsh add [ $TERM = "dumb" ] && unsetopt zle to your ~/.zshrc)

- Org-mode - Something like an outline on steroids. I use it for maintaining my ~/txt/todo.txt and ~/txt/notes.txt, but it has so many functions you can use it for a variety of different tasks - you can tag nodes, flag items as TODO in various places, display a summary of them, easy insert dates from calendar. Its part of Emacs-cvs or if you use an older version you can grab it from here. Check out also the article about using it for “Getting Things Done”.

- Psvn.el - This is a full-blown Subversion frontend and besides simple commit/update stuff You can do even more advanced things like create a branch. Emacs has also a very nice diff package integrated called Ediff, so it can also ease your life for merging.

- Msf-abbrev - Those snipplets everybody was so excited about in TextMate. You can simply look at a demo, the author didn’t knew about the GTK2/Xft version, through, so its a bit ugly.

- Nxml-mode - It makes simply the best XML/XHTML editor out of Emacs. It validates your documents, automatically closes the opening tag when you type in and completes tags according to the schema.

- Cua-mode - If you’re really addicted to C-c, C-x, C-v and selection with Shift cua-mode is for you. It has the advantage that the keybinding are changed only when the region is active, so it doesn’t collide with standard Emacs keybindings (which start from C-c and C-x quite often). Cua-mode provides also a very nice rectangular selection (so you can easily append some string to ten lines at once) and something called a “global mark” - you select a place where you want to insert stuff and everything you copy will be immediately appended to this place until you turn it off.

- Wdired - Wdired lets you edit your directories just like ordinary text files. That means if you want to change names of 10 files replacing foo with bar you just open the directory in wdired mode, and use emacses M-% (query-replace-regexp).

- Browse-kill-ring - In simple terms its a clipboard history for Emacs.

- Elscreen - If you know what GNU Screen is, Elscreen does the same for Emacs. One of the Emacs features I really like is the ability to split windows, so I can see 3, 4 or 5 buffers at once (where buffers are not only files, but also compilation windows, version control status etc.). But sometimes it would be comfortable to change the configuration to a different one, and then switch back 10 minutes later. Elscreen creates a new Emacs “screen” for you, so you can switch back and forth between as many configurations as you wish.

- Rails.el - For all you Rubysts on Rails out there this package is a blessing. It lets you switch easily between views/models/controller/migrations/whatever, generate them (using script/generate), it can open a sql console using the config data in the Rails project dir, launch and control webrick/mongrel from within Emacs. You can also embbed script/console, tail the logs, browse the docs, run rake and so on, all this without leaving your favourite editor.

- Xmpfilter - Another one for Ruby programmers. It filter the current buffer through xmp and either simply insert the result of evaluation of the selected lines in comments or it generates Test::Unit assertions. Sweet.

- Flyspell - This quite simply underlines spelling mistakes as you type. This is quite possible the only feature of MS Word that is nice.

- Htmlize - Creates HTML from syntax highlighted (font-locked in emacs-l33t-speech) buffers. Quite useful when you need code snipplets in your blog.

- Ecb - I don’t love it all that much, but many people do, so I included it. This makes Emacs look similar to popular IDEs, with a file / class browser on the left, the compile window on the bottom and so on.

- Hide-lines - You can use it to show or hide lines matching a regexp. After you do this the buffer will show only those lines, so you can use the various Emacs commands to operate on it, and than switch back to the normal whole-buffer view. Came handy a lot of times.

If you care, you can take a look at my .emacs config, site-lisp directory (with emacs packages that Gentoo maintains) and .elisp tree (with loose .el files from across the web).

Comments ():

Stifflog - Ruby Tutorial part 2 - the actual fun begins, 15 November 2006, 7:15 pm

[...] The most basic thing you will need when going thorughout this tutorial is a text editor. Well, we will do the very first contact with Ruby using its interactive interpreter, but when we finally cross the 5 line program length border a good editor can get useful. I personally simply recommend the best editor on earth - GNU Emacs. If you want a short recommendation - Matz (Rubys author) is using Emacs. Not enough? Check the entry about Emacs packages. For more informations look at emacswiki.org and RailsWiki Emacs page. [...]

Simao, 15 January 2007, 5:43 pm

Lisp is a very ugly language to script emacs.

I’m used to jedit’s beanshell.

But I like the idea of using Ruby to script emacs using http://www.rubyist.net/~rubikitch/computer/el4r/index.en.html but I never tried it.

Any ideas on that?

stiff, 15 January 2007, 7:42 pm

Elisp isn’t that bad… For scripting a text editor, with all the functions Emacs provides, its perfectly fine I think. I didn’t use beanshell (through I liked JEdit before I switched to Emacs), but for example the way vim is scripted is much more painful and its harder to write/debug extensions. I’ve seen el4r, but I don’t think its that attractive.

Simao, 26 January 2007, 12:38 am

I decided I’ll learn to use emacs because jedit keeps my right hand attached to my mouse.

I guess I’ll have to learn lisp then… =\

Yeah el4r isn’t that attractive, one has to know elisp anyway….

I have my pinky almost injured after this many ctrl, I switched ctrl to caps lock but I guess the pinky efford is all the same.

Beautify your Emacs at blik.it, 17 February 2007, 10:27 pm

[...] A lot of knowledgeable computer programmers praise Emacs. Others acknowledge Emacs’ power and flexibility but complain about its visual appearance. The thing is, freshly installed “vanilla” Emacs doesn’t have all the bells and whistles so common in other editors, like TextMate - for example, a MacOS only editor very poplary among Ruby programmers. In order to achieve a good visual apperance you have to customize it, just like everything else in Emacs, because this editor is not actualyy an editor itself. It is, as Stiff puts it, “an editor building framework”. [...]

How to beautify your Emacs at Blik.it - Web, Technology and Code, 17 February 2007, 11:11 pm

[...] A lot of knowledgeable computer programmers praise Emacs. Others acknowledge Emacs’ power and flexibility but complain about its visual appearance. The thing is, freshly installed “vanilla” Emacs doesn’t have all the bells and whistles so common in other editors, like TextMate - for example, a MacOS only editor very popular among Ruby programmers. In order to achieve a good visual appearance you have to customize it, just like everything else in Emacs, because this editor is not actually an editor itself. It is, as Stiff puts it, “an editor building framework”. [...]

Kenny, 2 March 2007, 7:58 am

It seens you install CUA-mode & ElScreen together, which key prefix you assigned to ElScreen?

stiff, 2 March 2007, 9:03 am

C-z - I use only the windowed version of Emacs and I don’t need to suspend it.

Kenny, 2 March 2007, 4:06 pm

But CUA-mode also use the C-z as Undo, so, I can’t use the C-z for ElScreen.
You disabled the C-z used by CUA-mode and use it for ElScreen?

Jeff, 25 March 2007, 10:19 pm

Excellent summary.

I’m addicted to org-mode and use it to manage my todos/projects/writing/goals/journals/ideas, etc. It’s fantastic. I can’t recommend it enough.

I’m intrigued by msf-abbrev. I’ll have to check that one out.

zeaster » Stiff asks, great programmers answer, 29 July 2007, 4:19 pm

[...] Stifflog - Emacs packages roundup, 31 October 2006, 10:44 am [...]

Generic Cialis, 15 July 2011, 8:55 am

Hi there,Really nice job,There are many people searching about that now they will find enough sources by your tips,Also looking forward for more tips about that

ベトプティック, 5 August 2011, 12:34 pm

Great tips, I would like to join your blog anyway,

Tag Heuer watch winder reviews, 13 August 2011, 1:38 pm

Great tips.I’m addicted to org-mode and use it to manage my todos/projects/writing/goals/journals/ideas, etc.

Curb Your Enthusiasm DVD, 30 August 2011, 4:59 am

very vivid and useful.. i think you can give more information for me for reference!

Hollywood Treasure Season 1 DVD, 9 September 2011, 9:56 am

It’s merely impossible to overcome the inherent obstacles, particularly in characters. As the quote shows, the leopard cannot change its spots. For ladies, to turn into a perseverance and vivid guy is much tough than the leopard change its spots, but there are some women hold this valuable character which get them standing out from a group of men. Patty in Damages Season 3 DVD is the exceptional one as a resolutely and capability lawyer who can kill a dog to impose the witness, also the host of that dog, to state the suspects, I mean use unordinary way to solve her circumstance regardless of moral or not.

discount pandora charms, 22 September 2011, 2:52 pm

Accounts fashion jewelry wholesale Pandora bracelets, gold embodies also used in the diligence and your budget will earmark, you may debate the doll face with a formula of pearls and precious stones of your choice, or may be based on chain or gold depending on your choice and the price of that part of a bracelet is not less than.

Damages Season 1 DVD, 29 September 2011, 9:40 am

http://www.collectcheapdvd.com
Hey, guys, Good news! In order to celebrate the arrival of Holloween as well as show our appreciate for your permamnent support and love for our site, you can enjoy 5% off on all orders. So look around and choose whatever you want.

Comment