There are a number of snippet packages that are available for emacs: snippet.el, smart-snippet, and the older skeleton and tempo packages that are a part of emacs. The snippet package was in the words of the developer:
A quick stab at providing a simple template facility like the one present in TextMate (an OSX editor).
The creator of smart-snippet, an extension to snippet.el, has now created the aptly titled yasnippet – Yet Another Snippet extension for emacs. It looks promising based on the screencast… I have not had a chance to play with it yet locally. The mirrored fields support looks cool though.
Recently, I have been doing more remote pair programming at my day job, and I was copying some code snippets into pastie. Pastie is a site that allows you to share code snippets with nice syntax highlighting. One thing led to another, and next I was searching for emacs integration with pastie. I found it here, but unfortunately the lisp package no longer seemed to work. It turned out that the package just needed to support a minor change to the pastie API. I have fixed it, and added support for sniffing more of the emacs modes associated with Ruby on Rails and java. Here is the updated version of pastie.el. (Note: After publishing I added it to the emacs wiki based on a user’s suggestion: pastie.el). The package has the following functions:
pastie-buffer – Posts the current buffer as a new paste at pastie.caboo.se. pastie-region – Posts the selected region as a new paste at pastie.caboo.se. pastie-get – Fetches the contents of a paste from pastie.caboo.se into a new buffer.
Every few months you see a thread on the emacs news groups polling to see the age or occupation of the users. Recently someone sent out a link on gnu.emacs.help to a site called BuddyMapping with a map for Emacs Users. I have always loved maps, and I am a sucker for these map mash-ups, especially when there is no registration required in order to add yourself.
I give up. During the past 6 years of my emacs career, my .emacs initialization file grew to embarrassing levels. As of this morning, it is well over 1000 lines and is a looming burden of disorganization. Startup time is poor, customizations exist for modes that I don’t use anymore (ahem, csharp-mode), and it has been this way for too long.
Today, I am declaring .emacs bankruptcy.
Akin to email bankruptcy, I’m blowing everything away and starting over. Only as I realize a need for something is it going back in. I’m also starting with a better organization scheme. My intent is to have a .emacs file with nothing but load-path additions and requires.
Tab characters used as indentation of source code is a pet peeve of mine. Add this to your emacs initialization to make sure all indentation uses spaces instead.
;; I hate tabs!(setq-default indent-tabs-mode nil)
Now, if you also use tab completion everywhere, someday, you’ll want to actually insert a real <tab> character (ASCII 9), but won’t be able too. Quoted-insert to the rescue. Type C-q C-i to insert a horizontal tab character.
Note: Even though, I’ve aired my religious preference on this topic, my intention is not to start a war but to teach those who like spaces how to configure emacs (Yes, I’ve read the heatedmaterial on thesubject).
For a newcomer to emacs, learning the default set of keybindings can be daunting. There’s no substitute for C-h b (describe-bindings) and C-h k (describe-key), but sometimes it’s just easier to learn visually.
When show-paren-mode is enabled a matching parenthesis is highlighted based on the location of point (i.e., when your cursor is on a parenthesis).
You can tweak the behaviour of this minor mode by adjusting show-paren-style and the show-paren-delay. There are three styles to choose from:
parenthesis – shows the matching paren
expression – shows the entire expression enclosed by the paren, and
mixed – shows the matching paren if it is visible, and the expression otherwise.
To obtain this behaviour, add the following to your .emacs file:
Rob recently pointed me to rcodetools and its included emacs integration. Specifically, I’ve only had the chance to play with xmpfilter, but so far, I’m very impressed. Let’s use it to annotate lines in a ruby buffer with intermediate results.
The emacs-rails package turns emacs into a Ruby on RailsIDE. To put it simply, I love the package. It gets me excited to see this much active development for an emacs mode. The emacs wiki has a laundry list of the functionality that the mode provides. I don’t think a single blog post can do the functionality justice, so I just want to hightlight a few of the features below (and expand on other features in later posts). [Read more →]
The delete-blank-lines function is a simple yet handy tool to have in your bag of tricks. It is bound to C-x C-o. There isn’t a whole lot of magic surrounding it’s usage, so I’ll just quote the built-in help directly:
On blank line, delete all surrounding blank lines, leaving just one.
On isolated blank line, delete that one.
On nonblank line, delete any immediately following blank lines.