Remote editing on OSX
Many people develop for the web on their OSX box. I’ve been doing this for years, and I’ve been down many roads for finding the best solution for this. There seems to be problems with most of the solutions, and this blogpost will go through some of the ones I’ve personally experienced. More after the break.
There are several alternatives to editing remotely on OSX. Here’s a list (in no particular order):
- FTPing to your box and hitting “Edit with…”
- Using MacFUSE with sshfs to “mount” a remote directory
- Using tramp with Emacs
So what are the issues with these? Well.. Today, I bought my license for TextMate, which comes in at a pricey 50 euro. I hoped I could use it for working on Dr. Whatson, but the tests today show that it’s not really possible.
First, you’d load up your remote dir with sshfs and start editing it locally. Cool idea, but it doesn’t work properly. I have … runs a shellcommand … a whopping 63.000 files in my remote repository, most of these are XML files written to a cache and they’re not even in subversion. No matter, they’re in the dir we mount, so TextMate would have to load them all into the project. Try doing a “find .” in your local mount and see how slow that is. You could individually edit the files, but I don’t want to do that. I want it to work.
See now, there’s something called “Remote Project”—a bundle for TextMate that allows you to keep a local copy of your files, and simply hit a keybinding to sync with the remote copy. Cool. No. The rsync command it runs in the background, sucks my upstream dry and it won’t ever complete. Granted, I only waited for about 10 minutes, but that is 9.59 minutes too much.
OK, so what? FTP? It’s kind of pointless to run a dedicated FTP program in the background and constantly hit the “Edit with…” button, so that’s a big no-go as well.
Enter Emacs. Aquamacs Emacs to be specific. This is a native OSX port of ye good ol’ Emacs outside the terminal. Vetle Roeim points out that you cannot use a single window to edit all your files. Well, you can! I figured out how today. Also managed to run iswitchb as well, which is this excellent mode for switching between buffers. It’s oldskool and everything, but one should really take the time to learn it. It’ll stay with you for life. On that note, I still develop my local Django projects in TextMate.
I like having a central ~/.emacs where I can keep all my settings, but guess what, if you toss in your Aquamacs specific settings in there, you blow up your emacs in the terminal. Bummer. How to get around that? Well, that’s actually the reason why this blogpost is being written. Saving the best for last, so to speak;
(cond
(window-system
(custom-set-variables
'(your-aquamacs-specific-settings-here))))
(See, `window-system’ will evaluate to nil if you’re running in the terminal. Cool, eh?)
Viola.
Oh, Vetle?
'(one-buffer-one-frame-mode nil nil (aquamacs-frame-setup))
;-)
Yeah, thanks… I’m using Carbon Emacs now though, and it works great. A single window is default. ;) It seems that Aquamacs is less “emacsy” than Carbon Emacs, I also remember having problems with keybindings in Aquamacs. Carbon Emacs works like a charm for me, though, although I know you have issues with it. Carbon Emacs ftw. http://www.apple.com/downloads/macosx/unixopensource/carbonemacspackage.html