Archive | emacs
Getting Emacs more like TextMate
So I got to thinking over a short break from work (and blogging) that
I should re-evaluate my Emacs usage on OSX.
[Aquamacs's](http://aquamacs.org/) latest is based on Emacs 22 and
I’ve been doing more and more tweaks of Emacs at work to try to get it
like my TextMate setup at home. There are a few things that I don’t
like about TextMate,like having to use the mouse when you are loadingwe
a new file.
I have spent some time last night and this morning trying to get my
Emacs setup like my TextMate, so I can do 95% of the thing I do in
Emacs that I do in TextMate. I’m not quite there yet, but here are
the things I enabled/downloaded to get things going. And, yes, the
fact that I had to download extra packages for Aquamacs and not for
TextMate does give TextMate a +1.
* [Blogging](http://peadrop.com/blog/2007/05/11/blogging-with-emacs/) with [Markdown](http://jrblevin.freeshell.org/software/markdown-mode/)
* [Icicles](http://www.emacswiki.org/cgi-bin/wiki/Icicles), i.e. mega-buffer and command management
* [Skeleton Pairs](http://www.gnu.org/software/emacs/manual/html_node/autotype/Inserting-Pairs.html)
This is my first post using Aquamacs, with weblogger and Markdown.
And it failed — I ended up copying and pasting it into WordPress’s
admin.
And thus the smackdown begins . . .
Inserting Pairs of Characters in Emacs
It all started with this post from SJS on how to make Emacs get some TextMate behaviors. I added my own changes to enter “)” after entering “(“. Then SJS emailed me privately to say that Emacs has had this all along — you just had to enable it.
And it works great, too. Slicker than TextMate, even.
Powered by ScribeFire.
Having Cygwin, NTEmacs and SVN to all play nice
Let’s just say that my development environment it is a little messed up.
The Company has an ancient Cygwin version installed that is somewhat broken and not all the tools are there. That said, it has bash and I can’t complain. But I can’t install any other Cygwin packages on it, because I don’t have permissions to their directories. I need Emacs, so I installed NTEmacs to go with it. Then I wanted to use SVN to keep some scripts, and other work-related project in. I couldn’t install Cygwin’s SVN package, of course, so I installed the Win32 build. But I ran into a big problem in the fact that SVN uses Windows paths to make it’s temporary comments file instead of Unix-like path. Also, NTEmacs doesn’t understand full Cygwin paths (it knows “src/java/file.java” but not “/cygdrive/c/src/java/file.java”). So something needed to be done.
I ended up getting gnuserv to work on Windows — not an easy feat. I put gnuserv.exe, gnuclient.exe, and gnuclientw.exe in my $HOME/bin directory. Of course, Windows doesn’t really understand ~/bin very well. So I put the whole mixed Windows path name in as EDITOR in my .bashrc. Like so:
EDITOR="h:/bin/gnuclient"
Then I make sure that the following is in my $HOME/.emacs file:
(require 'gnuserv) (setq gnuserv-frame (car (frame-list))) (gnuserv-start)
As you probably guessed h:\ is my home directory.
Now then, when I want to edit a file from the command-line, or when I do an svn commit, it opens up in my already-running NTEmacs. When I’m done with the file, I save it and do C-x # and then I get my command-line back.
Emacs Notes
I’ve been blogging about TextMate recently, but Emacs is still my editor of choice for my day job, and it more than adequately fits the bill. I’m still not sure which I like better overall, but this post is about Emacs, not comparing it with TextMate.
So I have been doing quite a bit with Emacs lately. Here are some items:
- I’ve been reading the all-things-emacs blog a lot lately and two of their recent posts talked about packages that I didn’t have in my Emacs. I looked around and discovered that they are in Emacs 22, the development version and I was using Emacs 21. After debating in my mind for a morning, I installed NTEmacs 22. And now I wonder what took me so long. Font support is better, it loads files much faster, and how it checks parentheses is better. And that’s just the beginning of what I’ve found. The one bad thing is that Power Macros doesn’t seem to work. Which is bad for me.
- I’ve been spending my day fighting fires. And Murphy’s Law was getting in my way, including Eclipse getting stupid on me. I didn’t have time to deal with it, so I just shut it down and edited my Java project in Emacs. And I felt liberated.
- In the midst of fighting said fires, I had a chance to play with Icicles, which is a key completion library for Emacs. You can read about it, but you really need to try it. It fixes some things that have been annoying me for a while (like using C-n, C-p in the mini-buffer) along with other goodies. It’s going to totally change switching buffers and finding functions for me.
Eclipse vs Emacs: who wins?
When I started doing Java development, I thought I was going to use Emacs less and less and Eclipse more and more. But I was wrong — I find myself copying text out of Eclipse all the time to put into Emacs. In Emacs, I write a keyboard macro to wrangle the text into submission, run that macro on every line, and then paste it back into Eclipse. Messy? Yep. Quicker than doing it manually? Yep.
However, although I love Emacs, it doesn’t handle all the little nits that you need for J2EE development like Eclipse does. And auto-completion and running unit tests inside Eclipse is just gravy on top of that.
Of course, I use Eclipse’s Emacs key bindings, which makes things easier. But just because it has the same keystrokes doesn’t make it a replacement. I can’t do keyboard macros inside Eclipse, nor can I write some Lisp function (or another language) quickly to get some other dirty work done.
Just yesterday I ran into a seemingly simple problem that uncovered a whole nest of issues.[1] I was switching from JSP to Action class to another JSP , trying to get a handle on the problem. Eclipse was bogging down. It was slow, and then it was telling me that I had problems in my JSP that I didn’t have (this was probably Aptana’s fault). I finally got tired of it, shut down Eclipse, and aimed Emacs at the files. In a short time (and a short time before I had to head home) I discovered the issue, and thought how to best fix it in the evening.
If I left the story here, Emacs would be the winner. But there is more . . .
This morning, I fired up Emacs right away and started working. I thought I had a fix, so I tried to a build. It failed building the JSP’s and gave me the line numbers with the errors. Try as I might, I couldn’t figure out what was wrong. So I fired up Eclipse and opened the JSP. Right away, it said what the problem was All Hail Aptana!). I fixed it and the build went.
So, really, which is the better tool? Neither one. And both. Because without the both of them, I wouldn’t have been able to solve it. I used them together to approach the problem and correct it.
Another interesting thing to note — Eclipse is not really an IDE and Emacs is not really an editor. They are both frameworks — Eclipse is a framework around Java and SWT while Emacs is a framework around Lisp. I just happen to use the IDE and the editor written in those frameworks.
[1] Actually it was a small problem that someone dealt with badly, and that caused a delicate balance in the code. I broke that balance.
