A network of sites, tools, and technology to bring ideas into reality.
The Digital Tumbleweed
Thoughts and ramblings of an enthusiast
Useful Emacs Modes
M-x flex
One thing to keep in mind is that while I use and love emacs, I think it’s important to have an editor you like and are comfortable with. Whichever is up to you. I have heard many-a-thing about many-an-editor and I don’t care to be a missionary for emacs so what I will say this; use an editor that you are comfortable with, but that is powerful. One that allows you to modify the text on your screen in a few simple keystrokes. The two main ones that come to mind here are emacs and vi(m). But, if you can make Notepad++ or others do this, then enjoy. You will never know everything there is to know about your editor, however you can strive to become a more efficient user. When I made the switch from TextPad to emacs I cut down my coding time by probably 20%. Thats huge in the grand scheme of things. If you think about the number of hours I work, and take 20% of that, you’ve freed a huge chunk of time I can be focusing on other things like YouTube and Facebook. The productivity gains are wonderful. ;D
Since I’m an emacs guy I’ll talk about a few of the modes that I am really keen on and how they help me or _will_ help me based on my experience with other modes.
js2-mode
As you saw with my post about the Axiom Stack, I tend to do some JS development. I’ve made due with some JS modes and tried to find something that I liked but this one seems to take the cake. One thing that has irked me about other JS modes for a while is their lack of understanding of the regexp. When I throw a regexp in there and use something to the effect of str.replace(/\’/g, ”) the mode blows up and I then lose all syntax highlighting for the rest of the buffer. js2-mode fixes this. *WOOT*
Yagge wrote this mode as a direct port of the Rhino code. That means that there is full JS support up to JS 1.7. Can you say list comprehension? I CAN and js2-mode can see it…therefore so can you!
Eventually his hopes are to turn this into something that can function much like IntelliJ or Eclipse. As a start, he’s really gone beyond what I expected when my friend at zen-hacking.com pointed this out to me.
The indentation is a bit wonky but true indentation is a complicated feature to include. There are a number of things that people “prefer” making indentation a very difficult task. However, I can only see this feature getting better with time.
I’ve been using it since it came out and am very impressed. Just starting out it surpasses the other JS modes out there. I recommend giving it a try.
You can find this mode at: http://code.google.com/p/js2-mode/
yasnippet
Today, my friend at zen-hacking.com stumbled upon a mode called yasnippet. This is a snippet mode if you couldn’t guess it from the name. What does this mean? You can stop having to write boilerplate code. Instead, you type something as simple as “class”, then tab, and the boilerplate appears before you. This mode adds another feature that is found in editors like eclipse. Also, it’s scalable. As it stands, there are a number of modes already handled such as cc-mode, python-mode, and ruby-mode. But, should you write a language for your day-to-day operations, you too can build snippets of boilerplate. Check out this video: http://www.youtube.com/watch?v=vOj7btx3ATg
You can find this mode at: http://code.google.com/p/yasnippet/
hippie-expand
This mode is a very useful mode for helping you code faster. How so? Hippie-expand records the things you’ve previously typed and, with a command, will expand whatever you are typing into what it matches. This is extremely handy as it cuts down on the amount that you must recall at the time of typing and it cuts down on the sheer amount of typing that one must do.
I think the obvious point here is that with this mode you become more productive. You can focus more on the algorithm or problem at hand and in coming up with a solid solution, rather than having to focus on remember what that farkin’ variable name was. You can just type the start of the word and then whatever key command it is and you are scrolling through your set of variable names.
You can find this mode at: http://www.emacswiki.org/cgi-bin/wiki/HippieExpand
Fin
No, this isn’t a mode. These are three of the modes that I use that I find to be extremely helpful. What modes do you use? Two that I would like to get working better are Remote File Editing (tramp-mode) and Version Control (vc).





I finally decided to write a comment on your blog. I just wanted to say good job. I really enjoy reading your posts.
Tina Russell
@tina russell
Thanks for the kind words. Glad you enjoy. I think soon I’ll be writing a series on hardware (as I’ve just purchased parts for a new machine *rubs hands together*). So, hopefully I’ll be a bit more active.
HippieExpand works with XEmacs. The others do not
Thanks for the tips. I don’t expand my emacs environment very often anymore. Gotta get back into it.
Another that I have started to use quite a bit per recommendation by that dude over at zen-hacking.com is i-switchb mode. It’s great if you just need the mini-buffer to switch between buffers rather than adding a new buffer or having to use the mouse to switch through. This one allows you to basically do hippie-expand in the mini-buffer. There is one called icicles but I had a hard time getting everything to work correctly. In fact I had a hard time byte-compiling everything which pushed me towards i-switchb.