RR Text Editors and IDEs with Gary Bernhardt
00:49 - Gary Bernhardt Introduction
03:30 - Who uses what for programming?
06:36 - IDE vs Text Editor
- IDE (Integrated Development Environment)
09:05 - Differences Between IDEs and Editors
10:41 - Pragmatic Programmer
- "Evil Wizards"
12:34 - Developer Studio
18:03 - Destroy All Software
19:02 - Emacs
21:23 - Vim
23:06 - TextMate
- Growing in Sublime Text 2
- Can script in Ruby
24:00 - Modern Editors
27:00 - Textmate Using Default Mac Key Bindings
30:21 - Getting Started with Text Editors
32:10 - Emacs 24
33:50 - Remote Editing System
- Tramp Mode
36:30 - Vim Golf
37:25 - Emacs Naming
40:00 - Emacs Documentation
41:30 - #emacs on freenode.net
44:18 - Arguments Between Emacs & Vim
45:09 - CPU-bound
JAMES: Alright, we are talking about editors today, is that the plan?
CHUCK: Yes Editors and IDE’s.
JOSH: My plan is to subvert the conversation every chance I get.
JAMES: So today, the role of David Brady will be played by Josh Susser.
CHUCK: Hello everybody and welcome to the Episode 40 of the Ruby Rogues Podcast. This week on our panel we have guest a rogue, its Gary Bernhardt from Destroy All Software.
CHUCK: Gary, you want to introduce yourself since you haven’t been on the show before?
GARY: I suppose I could do that. I run Destroy All Software like you said. I think I'm mostly known for using UNIX and Vim, and to some extent TDD very quickly and so I guess I'm appropriate for the topic at hand.
CHUCK: Alright. Okay. Also in our panel we have Josh Susser.
JOSH: Hello, good morning! Today I’ll be playing the part of David Brady.
CHUCK: (That’s kind of scary.)
JOSH: (Just you wait.)
CHUCK: Also on our panel, we have David Brady.
DAVID: Hey! Ctrl-u for Alt-x, involve, David Brady.
CHUCK: I feel better already!
DAVID: It is an Emacs joke. And that's why I can’t play the part of David Brady. I’VE GOT A DOG IN THIS FIGHT! LET’S GO!
CHUCK: So, David will be playing the part of Josh Susser. Also on our panel we have Avdi Grimm.
AVDI: Good morning, I am Avdi and today I will be representing the WordStar Editor.
DAVID: Too early in 2004.
CHUCK: We also have James Edward Gray on the podcast.
JAMES: Hey everybody! I am participating in this call via Emacs’ “Skype Mode”.
CHUCK: How do you do that? Ctrl- (I don’t even know), “Ctrl-chat”?
Anyway, I am Charles Max Wood from TEACHMETOCODE.COM and as you can tell, we are going to talk about text editors and IDE’s today. So, we have kind of had some discussions, some friendly banter back and forth about the Emacs and Vim and some of the other IDE’s out there. So, we thought we would get in and talk about it. Gary’s done some--
DAVID: Wait, Ctrl-chat? You hold down Ctrl and then push the “Chat” key?
CHUCK: Yeah, don’t you have one?
AVDI: Only Indian keyboards have that.
DAVID: I want this! Do I have to learn Sanskrit because I will?
JAMES: Please don't encourage him.
DAVID: You can take the David Brady out of David. You can put David Brady into Josh Susser (oh, that's kind of awkward) but you can’t get David Brady out of David Brady, that is the important thing.
JOSH: Get out of my head David.
DAVID: Yeah, I'm in your head. I’M IN YOUR HEAD, MESSING WITH YOUR THOUGHTS!
CHUCK: Alright so really quickly, I'm a little curious as to who uses what, primarily. So let’s go around the panel real quick and just see what you used for most of your programming. James, what do you use?
JAMES: So, I use Textmate primarily. It's probably not too shocking since I wrote a book on it. Lately I have been teaching myself Emacs and I will admit that it is growing on me and I have enjoyed working with it and maybe I’m using it some now- maybe someday I might even switch.
CHUCK: James, none of us wants to hear about what is going on you.
JAMES: That's a good point.
CHUCK: Avdi, what are you using?
AVDI: I used primarily Emacs.
CHUCK: Alright. David?
DAVID: Emacs forever man!
GARY: I only use Textmate actually. I think that (not to get this started too early) but, this whole Vim thing is so ridiculous! Did you know that, that editor, the way it was designed with the whole modal thing, was because they had 300 baud modems and it's like, Aahh! I just can't understand it! I need something pretty and I need something that requires me to click my mouse as many times as possible. So I use Textmate EXCLUSIVELY.
DAVID: LET THE TROLLING BEGIN!
CHUCK: Clicky, clicky! Alright.
GARY: I don’t know what you're talking about.
CHUCK: I missed something.
AVDI: Somebody’s got a game face on.
JAMES: Yeah and if you believed that-
CHUCK: Josh, what are you using?
JOSH: BBEdit forever (because it doesn't suck). No, I used a lot of BBEdit and then Textmate came out. Yeah, Textmate crushed BBEdit for me and Textmate is still my go-to text editor. I've been using RubyMine a lot lately (as I said on the picks last week), which is kind of nice as an IDE. But I still like Textmate for the pure character manipulation power.
JOSH: And I have to disclaim that, while I can type a few things in Vi, I have haven't used Vimacs since it was written in TECO.
GARY: Nice reference Sir.
CHUCK: TECO? Isn't it the URL shortener for Twitter (.co)?
JOSH: Very good sir.
DAVID: Also written in Emacs by the way.
CHUCK: Yeah, because Emacs is a language and an editor.
DAVID: Emacs is an operating system on itself. In fact, it would be a complete finished robust operating system. All it lacks is a good text editor.
CHUCK: Alright well I’ll chime in. I actually use Vim. I think I have said that on the podcast before so no shock there, right?
JAMES: So, you have a have a slow modem?
CHUCK: It is plugged in to the back of my head.
DAVID: Guys I was worried that this wouldn't be a very good episode.
JOSH: Just wait, we’ve only just got gotten started.
DAVID: ♫We’ve only just begun ♫
CHUCK: We haven't started throwing stones yet.
JAMES: So should we talk about the IDE versus Text Editor thing?
CHUCK: Yeah, let’s go in to that first and then we can all fight over which text editor is better.
JAMES: I think Gary already settled it, really.
JOSH: We can spend the rest of the episode drinking.
DAVID: So, Josh normally we turn to you for a definition. Could you please give us the rules for the drinking game?
JOSH: Yes, every time you have to type a regular expression to find a file by name, you have to drink.
JAMES: So Josh, since you do love definitions, how about IDE versus Text Editor?
JOSH: So an IDE is Integrated Development Environment. And I have been using that TLA since 1984. The first IDE I ever run across was Smalltalk. And I think that was one really one of the first IDE’s around, if not, although maybe beat Smalltalk to it. An IDE is basically, everything you do program in one place. You know, you edit the text; you have the ability to compile and run tests, all that good stuff, all in one place, like debugging.
And so, Smalltalk had a kind of crappy text editor, but the IDE features made programming in Smalltalk great and really productive. So, the other side is text editor where the focus is, hey, we are editing files. Your program consisting of a bunch of files and files system and let’s go edit those things. I can’t come up with a better definition that.
DAVID: Did Lisp actually have an IDE or did it have a TIATI? A “t-i-a-t-i”, which is basically you fire up the Repl and this is all there is.
JOSH: Actually, the InterLisp-D IDE that ran on Xerox machines in the 80’s was pretty freakin’ awesome.
JOSH: Yeah. Basically, everything that you could do on a Smalltalk environment, they have the equivalent in Lisp the environment. And actually, the two teams stole liberally from each other.
DAVID: Josh, I am so jealous of you. You and I are about the same age and yet, you had like, the productive childhood.
CHUCK: I was going to say I remember the 80’s; elementary school was really fun.
DAVID: Okay, moving right along.
AVDI: So what are the differences that is, that has always separated editors from IDE's (and I think this is actually less true these days) is, it used to be like, what you guys are talking about, there was a Smalltalk IDE which is actually kind of Smalltalk itself and a IDE. And the thing about IDE’s is that, traditionally they were bound to a single programming language and is getting to be less that way.
Now you have RubyMine, you know we have the JetBrains IDE supporting multiple languages; you have Eclipse, supporting multiple languages. But that was actually one of the things that turned me off to IDE’s in place. It used to be, you go in a big programming shop and you go into a particular team and it will be like, “Okay, we are using this language, so we are all using this IDE”. And you know, you’d spend six months or a year programming on that and learning it and you know, maybe adding some expansions to it, stuff like that and then you move to another team it's like, “Okay, we all use THIS IDE here”, (which is you know, a completely different environment), and so you’d lose everything and that was considered completely normal.
JOSH: So that is a great point but, I guess I need to amend my definition of IDE then. An IDE is a crutch for people using Java, so that the language is useable.
JOSH: Oh man.
DAVID: So it’s sort of like, for languages with very high ceremony, the IDE is like a portable cathedral.
GARY: The other that you have to bring up with IDE is the classic chapter in The Pragmatic Programmer: Evil Wizards (because that has always been kind of identified with IDE’s), is the idea that, it is something that will generate a lot of code for you.
That's not necessarily tied to an IDE, but it’s sort of traditionally is. The idea of something that will generate some magic code for you that you don’t need to think about, you just need to not touch it and it will work.
JOSH: Right. Well one thing that I have seen with a lot of the IDE’s, I’ve talk to people that swear by their IDE’s, albeit RubyMine, I know a few people who used to use NetBeans when its supporting Ruby and things like that.
DAVID: I know a lot of people who swear AT their IDE’s.
CHUCK: You must have been sitting near me when I used one. Anyway, a lot of times, what they tell are things like, auto completion, sometimes, you know, it will parse their code and picks up errors and things like that. The other thing that I heard people talk about is like, the built-in debuggers.
CHUCK: Right, refactoring and some of these other tools that are built into it. And I have yet to find anything that that IDE will do, that I can’t do from either Vim (with specific plug-ins) or the command line.
DAVID: Go to a symbols definition or go to methods definition. Oh look, if you run C tags you can do that with any text editor.
CHUCK: Right and so it was kind of an interesting discussion. But the thing that drives me crazy about IDE’s is that, I have yet to find one that doesn't bog down my computer when I run it. Whereas in the text editor it's usually a little more like, Wait and they run and then you know, I can everything else from the command line and my machine is still snappy. It still responds so.
GARY: So that depends on how large of a file you're trying to open in Textmate.
JAMES: That is very true, yeah.
DAVID: So, I actually started with the granddaddy of them all, which was Developer Studio. And Josh, to give and add to your point, I’ve actually in job interviews had questions like, “Which key do you press to compile your code? “ I mean literally, interview questions were like, “Do you know developers studio?” You know, forget about language, “Do you know the tool?”
I was hip deep in developer studio when The Pragmatic Programmer came out and they had that line about know your editor and I'm like, “Alright! Let's get out the plasma torch and the screw driver! I'm going to rip the face off this thing!” And I ended up, I made my own wizards for Developer Studio, I compiled my own plug-ins for it, that I would distribute to the team and would put little, you know, it will add buttons to the Developer Studio that they can click, it would run things.
I integrated basically our own version of Make, using Python and then bolted it into Developer Studio for the team to use. I loved Developer Studio! Man, I had that thing singing and dancing and doing back flips for me. Then the whole “open source revolution” came along and I threw it all out to switch to Vim and then to Emacs. I think it’s why I bounced off of Vim and right into Emacs was because (and we’ll get into this when we start talking about the philosophy of “Vim versus Emacs”) but, I’d come from this environment where the tool did everything and anything that the tool couldn’t do, you could embed it the tool and it would subsume it and it would become part of it. It was bored, we are bored, we will assimilate all of your tools.
And I went to Vim and VIM DOES NOTHING! And it does it very fast and it does it very efficiently. And if you wanna do anything else, GO SOMEWHERE ELSE! And then I went to Emacs and they are like, “Welcome home child! We can subsume everything. We’ve got a web browser right here in the text editor, let’s go.”
JAMES: I think that's actually kind of an interesting point though, like people’s usage of text editors seems to vary quite a bit. Like know some people who, they program, they never use any short-cuts that are built in to the editor. My example is, do you type “and” (a-n-d) in Ruby? I never typed “and”, period. You know some people do. They always type ”and”, you know.
DAVID: I type “do” and that I type” tab” or “enter”.
DAVID: And Emacs goes, “Hey! You need an AND here!” there it is.
JAMES: Right exactly. What were you going to say Gary?
GARY: I’ve typed in every single “and” that has ever gone in to every single Ruby code I wrote.
JAMES: So see, there's very different ways that people use the editor.
DAVID: James you're saying that you wouldn't need that level of power in your editor, if you programmed in Python?
JAMES: Yeah I guess that's true.
CHUCK: Yeah, because back to days when you type “tab”.
JAMES: Wait a minute did we just—go ahead.
AVDI: An editor is a device which makes programming in Ruby bearable by putting in all of that voluminous boilerplate.
DAVID: Although as what we are about to see when Gary and I actually get into it, an editor is a tool that makes other programmers insufferable.
JAMES: What I was going to say is that, then there are other people like, (I think like me and Dave) who really added a key, my favorite description of preparing your editor's configuration is kind of like crafting your own lightsaber. And then you want to have it exactly the way you want it. And I want it known that I type three keys and this series of steps happens, you know, and we like the editor to be like extension of ourselves, where we train it the way we like to work and move that way.
DAVID: That was absolutely-- I don't want to put words in Gary’s mouth, but I feel like, the Vim philosophy, is it’s the toolbox. You should be able to throw it in the back of your pickup truck. And it is a standard toolbox if you rode to work with Carlos today and you get out, you grab his toolbox and it should be the same tools, everything where you expect it. You moved to a different machine and there it is.
And Emacs is not like that. Emacs is like a workshop. When you move to a new house, you have to set up your workshop because you want the table saw over here, year you want the drill press over here. I’ll admit it, I don’t just have a “.emacs file”, I have a “.emacs directory” and it's got half a megabyte. It's got half a megabyte of crap in there, all kinds of third party packages and crap.
AVDI: I'm not sure that I like that analogy very much
AVDI: I think Vim is really, it’s more of a chainsaw and the last thing you want on a chainsaw is, controls that you are not used to because then it will cut your hand off.
AVDI: And Emacs is more like a chainsaw that has other little chainsaw inside of it and just shoots them in random directions all the time. So it doesn't matter if you change the controls, because you're going to get your hand cut off anyway.
JOSH: Not your hands, maybe more like half a leg, yeah.
JAMES: So, Gary you recently did on Destroy All Software (I know we've mentioned several times on the show), you recently did an episode where, you being a Vi user, kind of went back and showed some Emacs and said, I used be an Emacs user and these are the reasons why I used Emacs and then these are the reasons why I switched to Vim and prefer it. And I found that episode in very, very cool.
AVDI: Me too.
JAMES: Could you maybe tell us a little bit about the why on both sides.
GARY: Basically I think that Emacs is an absolutely crap editor, having used it in- but it is really good programming environment. It has everything in it. And when you get down into programming in it, it is so nice and Vim is so awful to program. Like “save-excursion” is the only word I need to say to make the difference clear.
AVDI: You should probably explain what that does though.
GARY: Yeah I don't know if I can. Save excursion is like, you're writing a script in Emacs and you wanted to manipulate the buffer in some way. So you say, “save-excursion” and then you do a bunch of editing commands in your code (in your Lisp code) and when the save excursion is done, everything is back the way it was before you did those commands. So, it’s like a get-stash or something for your editing.
In Vim, you do all of that manually. It is so tedious and awful and that really, that is a wonderful microcosm of difference between the two editors right there. Emacs has all this nice things in it and Vim is like a chainsaw really. And it's your problem to take care of everything.
JAMES: Yeah I would say (and feel free to correct me if I’m wrong Gary), I used Vim a little but I'm definitely not an expert but, I would say that people tend to favour them for the out-of-box experience. The way Vim is with its modes and moving around in it and stuff. They like that and they like it and that they’ll go to another server and it will be the same out-of-the-box experience with that server and it work pretty well, where Vim kind of hurts is, the whole Vim script thing. I mean it’s like if you wanted to customize your editor, seriously, would you rather learn Vim script or Lisp? You know THAT kind of thing.
GARY: I think that's very true. And I mean even an Emacs user, if he’s serious about UNIX, knows Vim because he is going to associate it to a server eventually.
DAVID: Absolutely true. I’m just going to come out here as the “token Emacs guy” on the group.
AVDI: We’ll give you a token too, so you can play later.
DAVID: I'm the token Emacs guy; you're the actual Emacs character who has a character arc in the story.
JOSH: Yeah but he doesn’t have a “lisp”. Sorry.
DAVID: No you have to know Vim. You have to. I mean it's not optional and I would disagree though that, and that is actually one of the things, for me, picking up a blank editor, I’d rather pick up a blank Emacs than pick up a blank Vim. And I can sum it up in one word: NO-HL-SEARCH.
CHUCK: No HL search. Can you explain that?
DAVID: When you search a something in vanilla Vim, it highlights, everywhere in the file, the thing you're searching for. You search for “the” (t-h-e) and it lights up all through the file. And then you're done searching. So you go back to the command mode or into normal mode or whatever the non-edit visual mode or whatever, I don't know the modes, whatever, you kids.
Anyway, you are done searching and it stays highlighted. You can start typing and go to the insert mode and start working and it stays highlighted! IT WON’T STOP BEING HIGHLIGHTED! And the hilarious thing is half of the novice Vim users out there don’t know how to turn it off. And so I have seen three different Vim users do this. They just get in the habit of searching for herp, derp. Just because it doesn't appear in the document and now I'm searching for something that doesn't exist. And that has the effect of turning off the highlighting!
GARY: I have HL search on but I have return remapped to—
DAVID: I was going to ask you about that because I have seen that in the Destroy All Software screens – or Destroy All Software, where, like you will do something and I see this “maps to no HL search”. And I’m like, ooh, that is a friendly thing.
GARY: Yeah, it is unfortunate.
JAMES: So Gary, what about, you know (I think Gary doesn’t consider Textmate and the other similar editors as serious) but, I will say that, you know there is a lot of popularity in Textmate now and maybe waning in Textmate and growing in things like Sublime Text 2 and these are more gray-centered editors but it is interesting some of the old things they bring to the table.
For example, Textmate is very Emacs-ish in a way that it does a lot of things. And I would say one of the major advantages to Textmate is you can basically script the damn thing in Ruby which is great. It’s one of the reasons I fell in love with it. With Sublime Text 2, (I’ve only worked at very briefly so I’m not great at speaking to this) but, I know that it has like a vintage mode and stuff. And so it’s bringing in like Vim stuff you know, in some ways and many of its own features and stuff. But what do we think about really like the modern era of editors?
CHUCK: So, my take on this, really, I used Vim, so, and I used to use Textmate. Textmate used to be my primary use thing. The problem that I always had and that kept driving me back to Vim (and I actually tried Emacs for a while, Dave was teaching it to me when we were working together.) But, I started out as a systems administrator and I got really used to the power of just being able to use the keyboard and not have to mess around with the mouse too much because to me it feels like the your contact switch to go back and forth. And so, using a text editor like Vim or Emacs where I can do everything from the keyboard versus something like Textmate or Sublime Text, where you wind up interacting with GUI and using the mouse and stuff. It felt like I could get more done doing it the other way. But that being said, there are some powerful features to Textmate that I really did like.
JAMES: You know that argument always surprises me. Maybe it's just because I am the guy that wrote about Textmate. But I used Textmate and pretty much all day every day and I never touch a mouse. So I don’t know if we just don’t do good job of showing how to use Textmate keyboard driven or what. That is the interesting thing.
CHUCK: Well I think I there are two things there, I think one is, I don't know, I mean, unless people really go out and like buy your book or something, that people really know that. But I don’t think it’s part of the cultures of the people either that used Textmate were Vim and Emacs are much more about customizing it so that you can get the work done in a certain way.
DAVID: I am going to go ahead and show for James here and say, If you don’t own the Textmate book and you use Textmate, you are an idiot because James book does exactly that. I mean, he get into, I mentioned in last week’s episode that I have book marked. I have my copy bookmarked to the page that shows you like the Cmd-f, Cmd-shift-g for you know, find next, replace, you know, replace and find next, and all of the find and replace commands in Textmate.
My editing philosophy is when in Rome, speak Italian and unless in you ancient Rome, then speak Latin. Anyway, if I am editing pair of programming on a Mac with somebody who is fluent in Textmate, we use Textmate. If doing my own stuff, I use Emacs and if I'm shelled in to a server and I need to edit an account file really quickly I used Vim. There’s a lot to be said for knowing, having a passing fluency in a lot of editors, because it helps you communicate and work with other people.
JAMES: Yeah, I think that is true. David talks about like the shortcut in Textmate, for like finding texts and stuff. That’s another reason why I actually kind of like it. One of the things that it does bug me about Sublime Text 2, Textmate adopts the normal Mac convention so, what David has just said, Apple-f to find, Apple-g to find again, that works basically on every single Mac program. And that is awesome because you just learn at once and you just use it everywhere you know. Whereas Sublime Text has its own shortcuts for everything and that kind of bugs me because when I go there it’s not the same thing.
GARY: I think that's really important and that is one of the reasons why I resisted using RubyMine for years. With RubyMine you can set up the key bindings whatever way you want and all of the RubyMine setup at Pivotal (when I started working there) were all configured for people who are used to working in Unix or Windows. I couldn’t type the regular Mac keys, like home. That took you to the beginning of the line. Why would home do that, right?
AVDI: I'm kind of like the opposite. For me the editor commands are more important than the operating system command. The editor command is the one I wanna stay consisted. I don’t care as much about the operating system specific stuff. And I think that reflects the fact that, I mean, I started using Emacs when I was at a windows shop and I brought that configure- and you know this is part of the reason I started doing it, you know, I use that configuration on Windows for years then I brought all those configuration files to my Linux system, and you know when you use that, then I brought those configuration files to my Mac and used the same Emacs behaviour on the Mac for a couple of years and then I brought those configuration files back to Linux and it was the same system that I have been developing the whole time. So for me it was much more important that my development environment stay consistent than that of my development environment stay consistent with the operating system that it happened to be hosted in.
JAMES: That's very true. In Emacs though, you may be running your shell and stuff like that inside of Emacs right, though which then you know, kind of adds to that consistency. But in your shell, in your coding or whatever, you are using the same key commands everywhere.
AVDI: Right absolutely.
JAMES: So I think that's actually the same argument made from a different way. That's one of the things Emacs does in my opinion.
AVDI: Right I mean people made a joke about Emacs being an operating system but it’s not a joke. I actually trace that very seriously. It’s not an operating system, but it is an operating environment, it’s a desktop environment for programmers. I think if you go to it, that's a big part of the reason that you do, is that you want this programmer’s operating environment, where things can be consistent across operating systems and that assist you in various interesting ways.
DAVID: So for the record, the joke, the official joke there is that Emacs is an operating system, Linux is its device driver.
CHUCK: So really quickly I want to ask, I know that there are different ways of getting started with some of these text editors. For example, when I was earning Emacs, I was using Aquamacs and for Vim on my Mac I use MacVim. If you're getting started with this on Windows or Linux, are there other packages or good ways of getting these particular text editors?
GARY: Your computers come with both installed so and like even if you're using a system that doesn’t come with, I mean obviously anyone who knows the system is going to have some version of Vi installed probably been these days. Actually, does anybody even use the older versions of Vi anymore?
DAVID: *** that's all.
GARY: And you know, they are going to have the Emacs packaged as part of the standard package repository so you just install it.
JAMES: That said, Mac always tends packaging of Vimacs is quite embarrassing. it’s like how many years old? It’s very, very old.
DAVID: Centos takes the cake. Absolutely takes the cake. I was working on a shop last year. A year and a half (chuck you and I are working there together in the Centos shop) and the packaged rpm version of Emacs was 2006. It was like Emacs version 20 and I ranted and railed and said, “Please get me a current version of Emacs!” and so he went out there and he found somebody who had built a custom bundle of Emacs and he says, “Here you go!” .He installed it and it was like it was Emacs 22 or 21. I'm like, “Dude, we’re in Emacs 23 now. Can I please have Emacs 23?” and yeah.
JAMES: And nowadays I'll I would even recommend going to straight to 24 even though it's the development version. Because it includes that packaging system and to me, that's awesome. Because now you can just go into the packaging system and install stuff, without having to do that manual dance for that which is just crap.
DAVID: Okay this is kind of funny story, but that the IT guy at that shop was so paranoid and so security minded that he would not allow C compilers on any of the production machines. So, I would get on one of the developer machines that had a compiler, I would download Emacs and I would build it compile it in my home directory. Then I would SCP whole thing up to the production machine because it was the same kernel and he find out I was doing this and so he locked me out of C compiler on the development machines.
AVDI: So, one of the things in Emacs, you should never have to do that. You should never have to put it on a production machine.
DAVID: Well you're absolutely right anyway my solution to it is I went out and got a, I have VMware Fusion. So I went and I got an ISO of Centos of the same kernel version and set up a virtual machine with a compiler, built Emacs and copied it up to the production machine again. It’s developers versus IT, man! That should be another episode Dev Ops versus oh--
JOSH: I've been on both IDE’s, so I'd be interested to talk about it because-
AVDI: So one of the things about Emacs is that he should never have to copy it to your production server or any server because it has the most mature remote editing system. Tramp Mode has been in developments since something like 1996 and it's very, very mature. Basically you point it at a server (and has various space you can specify what server you want to point it at) and it'll go through a series macanations where it figures out what techniques is available to edit file, edit things remotely there. If you can shell in using SSH, it will shell in. If it can only SCP files back and forth, it will figure that out and it will start SCP-ing the file up wherever you save it. If it can rsynch it will rsynch.
And you can actually watch it as you point on the server and to tell what remote file you want to edit. You can see it basically trying things out on. And if needs to, it will install, it will open up a shell session and install little shell functions in that ephemeral shell, just so it has consistent environment. So it is a really, really mature remote editing system. It's really sad when I see people trying to use Emacs on a remote system, when they could just be using their local Emacs set up.
DAVID: Yeah I admit that I am not as fluent in Tramp Mode as I ought to be, but the few times that I tried it, it was really, really slow, it was painful latency. I'm like, you know what if I'm working on your server, give me a recent Emacs.
JOSH: You know I would think that Tramp Moding, that thing that leaves a tattoo on the lower back of your operating system.
DAVID: And so you flip the DVD case over and it's down, right below the midriff yeah
JOSH: That's right, yeah.
AVDI: For the record I do not believe Tramp Mode is one of these rude, inadvertently or deliberately rudely named things. I think there are referring to like, hobos.
AVDI: It's not.
This comes up in the Ruby community, you know where it's like this dubiously named gems and I don’t think it’s a good stuff.
DAVID: Yeah, you get on, there is like, I'm editing files here but I am basically Emacs homeless on this server. That really is the whole spirit behind Tramp Mode, yeah.
JAMES: So this kind of goes back to what Chuck asked about, you know, is there good ways to get started and he mentioned some of the like pre-packaged systems which come with lots of settings. I tend to avoid those because I find that by customizing it, I'm actually learning things about it and stuff like that.
I will say that I spent a large chunk of that last year in finally getting from familiar with them and I found out an easier process to get familiar with them. One of the great things in doing that was the Vim Golf site. You can go in there going there and it will give you some challenge and ask you to do it in you know the fewest number of keystrokes and it would record it and put it up there. It would show you a where you fell on the list but you can see the people little bit below to you and a little bit above you and what keystrokes they did. Then you are like, wait what does that do? And you go try and go, oh, and you kind of advanced your knowledge that by step and I find out kind of useful.
Emacs on the other hand, I find much more frustrating (this year I'm getting familiar with it) as far as learning things, a lot of them you think is the naming. Emacs does have a lot of this creative naming, you know, like “Tramp” and one of the ones I remember recently is “HippieExpand”. I was looking for good auto completion and it just didn't know how to say that. It wasn't until I learned that in Emacs, the auto-completion is called HippieExpand. And after I learned that, then I knew it. That's also, it's kind of, and Emacs has pretty stupid defaults in my opinion. For example, it comes with an auto completion command bound to “Ctrl+ /” I think,
JAMES: (Is it Meta-slash? Yeah you are right.) Meta-slash but HippieExpand does all of that and more. For example, it literally calls the default auto-completion command as part of what it does plus other things. So like, I can’t imagine why you would not just replace that bind game with HippieExpand and that plus a lot better. So, it's kind of weird and I find it more frustrating to learn. I mean with Emacs, it will give you many built in manuals and stuff that's kind a like Skyrim where you can just load it up and sit there and read books for days. It’s pretty much the same but, it’s pretty daunting. There's basically a manual on how to read manuals in Emacs.
AVDI: It’s not that bad!
JAMES: Yeah, it’s that bad, right? I mean Ctrl-h-i, info and you push a key to take the tutorial where it walks you through how to read a book in Emacs, right?
AVDI: Yeah but it’s a really easy system, you know, you press “n” you go to the next page, you press “p” to go to the previous page, press “u” to go up.
DAVID: Also like Skyrim, if you are running Emacs, if you are running the HD texture pack, you are missing out on half of Emacs.
AVDI: The things that I do like about it is that it’s very, very introspective and so, you can ask Emacs about anything and it can give you an answer, so you can say like “apropos” and “expand”. It will tell you all the functions, all the variables that it know about, that have the word “expand” in them. You can also do things like, you hit a key and it does something and you are not sure what it just did. There are ways of looking at the log of the things that you just did, but you can also ask it, what was that key bound to? It will send you to the documentation of the function. Everything that you do in Emacs is a foot list function. It will send you to the documentation of the function that is bound to the key that you just hit.
JAMES: I have to agree. Emacs’ documentation blows anything else I’ve seen out of the weather. I mean like, if you're coming from Ruby where, we are famous for a fairly bad documentation, Emacs is almost exactly the opposite of that. I mean like, at any given time you have one major mode active and several minor modes typically and you can just hit a keystroke and Emacs will explain every single mode active in the current window.
That's very amazing. I mean, if you ask it, what is this variable? It will tell you what that variable is, and what its current setting is.
AVDI: And it'll give you a link if it's possible, it will give you a link to the page where you can visually adjust the setting of that.
JAMES: That's amazing.
DAVID: So much of Emacs is almost like this really complicated neural net. You're like negotiating with another brain in order to achieve the editing of your files. So my answer to the question of how you get started with Emacs is, you really need to go hang out in the Emacs channel on freenode.net.
The reason why is because the reason when you're looking, when you hit that moment where James said where, I know kind of what I want, but I have no idea intuitively what it’s called. I don’t know where to begin looking; I don't know the name of the thing to search for.
I had an indentation problem, where I had one file that was indenting four spaces and I wanted it to indent two. I looked at, you know “see basic offset” was set to two and “SH indent” was set to two and I could not figure out. Somebody came out and said well, there is this other indentation variable that is being inherited and matched by the mode that you're in and it should be set to blah, blah. And I thought like I never would have found out without somebody who knew what I was looking for already. The guys in the Emacs channel are really, really newbie friendly.
CHUCK: Cool. Well, I’m to cut off the Emacs love here and get to the picks.
DAVID: We have not let Gary talk at all for like the last twenty minutes, which is probably safe, because we were talking about the editor of all evil.
JOSH: And we sound smarter for having him here.
GARY: I do love the Emacs, don't get me wrong. Actually there is something interesting which is that, (sorry to cut off your cutting of Chuck), somebody was talking about how Emacs has, it shifts this one type of completion and there is another type the Hippie whatever.
And what you are seeing there is the fact that Emacs is older than most or may be all of us (maybe not D. Brady)
CHUCK: Why because he refers to Hippies?
GARY: Yeah exactly. No, I mean this is a very old system and it has changed. And these two editors have backwards compatibility rules in them, in the community, that are so strong compared to what we're used to. In fact I don’t think a lot of people realize this but, Emacs is not on version 24, Emacs is on version 1, that “24” is the minor version, it is Emacs 1.24. So that tells you just how little they break backwards compatibility.
DAVID: It’s because when Richard Stallman tells you, GET OFF MY LAWN! People get off his lawn.
JOSH: That is exactly true.
DAVID: NO NEW FEATURES!
JOSH: So, you know, Vim and Emacs have been a big focus here (and were talking about Textmate too, a little bit) but the big complaints that I often see people making about, why are people arguing between Vim and Emacs they are both like 70s technology! Why are we still using these as our premier editors? And it seems like both of these things; they are optimized to work on environments where you don't have a bitmap display. All you have is the character level display and so you don’t need a very big pipe to talk to them and you don't need to be dealing with the inconsistencies across operating systems of how mouse events work and crazy things like that. So I think that playing to that playing to that lowest common denominator is what makes them ubiquitous, but I think it’s also what drives me crazy about it.
So, I was hoping Gary has something piffy to say about that.
GARY: Well I don't know about “piffy” but I do have something to say, which is that, even in Vim in my terminal, I encountered situations where I'm actually CPU bound just editing text, just moving around. The idea of using an editor that's much slower than Vim just makes me, (I'm already frustrated just thinking about it) because I'm already CPU bound in some situations. So, for me it's all about speed and the fluidity with which I can interact with the text.
JAMES: That said, I watched Gary edit in Vim all the time, (thanks to Destroy All Software) and he is about 5000 times faster than I am, so I can definitely would bother.
CHUCK: Yeah I was going to say that, that nice chip in your computer that has like A-cores and this core does like billions of operations a second. Yeah, Gary can outpace those.
DAVID: I think also, I would add to Gary’s answer that why are we still using these 70’s editors to edit text? And the answer is, is that, yeah, we have these high-res displays and we have windowing systems and we have pointing systems and yet the way we program computers is still by manipulating character strings. And so these old tools for manipulating character strings are the best to do it, because all the fancy editors, all it really added is high-res displays and windowing systems. They haven’t really, appreciably, readdressed the problem of manipulating character strings.
GARY: That's very true and also I would add to that, I think that when I am using Vim, I like the way that text looks, better than anything I have ever seen in another editor. Because I'm using a lot of G 16 point, its anti-alias, I have colours set to exactly the RGB I want. It can look like whatever you want and also the Emacs, especially, has a windowing system that is so much more powerful than whatever GUI editor you want to use. It is night and day. And Vims is pretty powerful as well. So even though, those arguments I think are just a result of people seeing, “Oh, it’s text, it’s not windowing.” But window can mean more than one different thing.
JAMES: I actually want to add to that just a tiny bit because some of my answers to that question like use these arcane text editors as opposed to the big GUI versions. I have learned from watching Gary’s Destroy All Software screen cast and one is, I would say is the tight, tight UNIX integration is so good, right? Like for example, just be able to suspend the app and then do something in the shell real quick and then foreground it again and you know, just like you would with any other shell app, so it just flows naturally or Gary constantly involve his working with remaps, Vim command, to run a certain task that he is doing right now. So he’ll just stop and re-map it to run his tests or something and do that right on the file.
And then like what he was saying with the windowing system, I used to used Tmux all the time for basically everything that I do in the shell, and as I am getting into Emacs, I am doing that less and less because Emacs can split windows, manage frames all that. So, you know, so I tend to just had Emacs do it.
CHUCK: One thing that the reason why I kept coming to Vim too is that I was a systems administrator for five years, mainly managing Linux systems. So the thing is, my mental map is Vim. That's just the way that it works and I get Emacs and I get Textmate and I get some of these other things but, you know ultimately if it fits my work flow better than any of the others do. and you know that's fair enough to say about any other text editor .if it fits your workflow, if it makes you work faster and better more efficiently or whatever it is than by all means you know, use that and figure out how to use the tool to you know further that.
I just think it's interesting you know people go and attack this without actually really understanding, okay you know this really fits into this guy's workflow because it provide these tools and he interacts with it in this way and it provides these different interfaces and it works with the way he thinks. And so, I mean if an IDE works best for you, and then by all means go for it! If it's Emacs, if it's Vim, if it's Textmate, if it’s Sublime Text, if you want to use Notepad on Windows for heaven’s sake, go ahead!
GARY: I actually kind of take issues with that. I think that the idea that certain tool fits my brain is almost always an excuse for I know that this thing and I don't want to take the time to start over. My view of software development tools is (specially old ones like UNIX, C stuff, Vim, and Emacs) is that the guys who are working on this today, had been using it probably since before I was born (in most cases) and there is a really good reason that they have made these decisions, and I don't understand that reason.
And for me to say, that doesn't fit my brain because I looked at it for two weeks and these guys are working on it for like 30 years, I think that is a tremendously arrogant thing to say. So, my approach to Vim for example, is still to this day, I use very few plugins and I actually do a very small amount of customization, relatively speaking. My Vimrc is long but because that's because there is bunch of old experiments that are sitting in it and it’s only like 700 lines. So I don't know, I'm really think that, it's a much better approach to just chill out and accept the thing for what it is, and end try to learn why it is that way.
CHUCK: That's interesting I'm going to have to think about that.
DAVID: I think I can hybridize both of what you said. Because, I'm kind of with Chuck, where I want to say Emacs fits my brain, but you are right, it's very arrogant and very curmudgeonly, to just say, I don't like this other thing because the thing, because that I have, I like it so much. I actually spent a year and a half using Vim and moving in to in and really understanding it and then I went over to Emacs.
When I got into Emacs, what I found is, I really didn’t like mode-based editing. I just didn't care for it. And there's a big difference between, saying, “this is isn't for me” and saying “this is dumb”. You know it's really easy to say mode-based editing stupid or conversely having them find a control or an alt or a Meta or a shift or whatever, to edit everything is stupid.
No, it's if you are if you've used both and you know both, it's totally fair to say, I feel so much more empowered and enabled and engaged when I'm in this method versus the other. And that’s somebody that, we can party. You can sit down and we can party, even if you’ve settled on Vim.
GARY: Absolutely, I totally agree, when I said that, I didn't mean the person who’s spent a year and a half. It’s more like a person who spent a few weeks or even a month or two that's just not long enough.
DAVID: The person who failed saving throw against changing editors.
AVDI: Don’t be afraid to say that tool A does most of the jobs that I want but tool B actually has some really useful stuff as well. I have RubyMine licensed and use it from time to time, because it has some re-factoring stuff in it, that isn't at Emacs or that I haven't a good package for, in Emacs. If this choice is, “I'm not going to do that re-factoring because it’s tedious”, versus “I am going to do it because it's just a quick key binding”, then I'm going to fire up RubyMine and I'm going to do re-factoring in RubyMine, where it can be done quickly because it's more important that I keep my code refactored, than I just in some editor religion.
JAMES: I think that is a great point. If you listen to anybody on this podcast, most of us have used multiple editors and admit that we do that in different situations. Even being a Textmate guy or whatever. When I log in to a server, I use Vi. That's what I use.
DAVID: When I edit code on my phone, I use Vim, because my phone doesn’t have an Alt key.
CHUCK: Good point alright, now we really need to get to the picks. I think I’m solidly in an hour now.
DAVID: Okay, so I have one very quick story which would make every one cringe but I think it’s funny and its relevant to Ruby. I went to Lone Star Ruby Conf in 2008 and we were going around the table in the green room and Matt was the guest of honor (it’s actually when I met James for the first time) and we were talking about what editors we use (by the way, matt uses Emacs).
Anyway, I mentioned that I used the Dvorak keyboard layout and Matt just kind of paused with the fork halfway through his mouth and then he looked at me and he’s like, “But all the keys are in different places!” I'm like, Yeah. He’s like, “But how do use Emacs? Do you map the keys to where they are in the QWERTY keyboard?” I'm like, “No, I just go where the keys are in the new place”.
And I happened to have a Bluetooth keyboard in my backpack. On Apple keyboards you can pop the keys up very easily. So I popped them all up and I rearranged them into a Dvorak layout and I handed this Bluetooth keyboard and he took it like I was handing him a snake. He’s looking at this and I can see, in his mind, he is trying to figure out, How to do Ctrl-x, Ctrl-s? How do I do Ctrl-x, Ctrl-f? Like how do I- and he I looked up to me and he said, I’ll never forget this, he said and I quote, “Uh?” He just made this little inarticulate cry of dismay and then he handed the keyboard back to me.
So that is my story. Anyway,
CHUCK: Alright, thank you Dave. Picks, let’s start with Avdi.
AVDI: Picks today, let’s see, apropos, the topic at hand I think I’ll pick Emacs Wiki. It's a wiki about Emacs and it is a large wiki full of Emacs information and usually if you have information about how I do it get better expansion or something like that, you can always refer to Emacs Wiki and find what you're looking for.
And programming related, I did something which I had rarely had time to do recently. I have red and finished a novel and it was American Gods by Neal Gaiman and I thoroughly enjoyed it, so I recommend that novel for the like, three people that haven’t read it yet.
JOSH: I haven't read that for a long time, but you are not pronouncing his name correctly.
AVDI: Oh, sorry and I know he listening, so, what is the correct pronunciation?
JOSH: Neal Gaiman.
AVDI: Gaiman, okay.
JAMES: One of the great things about Neal Gaiman books is the audiobooks, where he typically reads them himself and they are fantastic.
JOSH: I know and he is great at that.
CHUCK: Alright Josh, what are your picks?
JOSH: I got one pick this week and it's an actual physical object. It’s the Jawbone Jambox. It’s a cute little box, that’s like the size of a couple of iPhones stacked up, something like that. And it’s a remote speaker that you can Hook up to your iPhone or whatever little music device that you have. It is actually more than a speaker for your iPhone; it will be a speaker phone for your Phone, which is pretty cool.
So I got it so I can listen to music when I'm in the shower, in bathroom or whatever and I don’t Have my stereo in there. It’s great to be able to rock out in the morning or anywhere, in the park I can bring music and have it amplified. You know, it’s like 200 bucks. So it’s not an impulse buy for most people but I’ve been enjoying it. The one drawback with it is that apparently all of the Apple iTunes and Bluetooth’s software just really don’t work well with how the Jambox is set up. So a lot of people are complaining online about having problem using it hooked up to their Mac. But if you are just using it with your iPod or your IPhone, what other kind of phone you have, it’s really great and I like the sound quality and they put a lot of design sense into it. So it’s a really nice device to use, so I’ve been enjoying that a lot.
CHUCK: Alright cool. Dave, what are your picks?
DAVID: Three ones, real quick. Two of them about Emacs on their apropos and one of them that is just flat awesome. The first one is EL4R which is a thingy for Emacs (whatever Emacs call its thingies). It’s a thingy for Emacs that lets you script Emacs in Ruby instead of scripting it from Emacs Lisp.
So it basically gives you access to the Lisp API and all of the hoops and all of the methods call. You know how like in JRuby you can require Java and can just start calling, you can start loading jar files and calling java and things. EL4R gives you the ability to write Ruby scripts that control Emacs. I just still do everything in Emacs Lisp because I found that I ended up with EL4R. I still needed to know the full Lisp API and I just figured I just had to blow it and just learn Emacs Lisp. But you are holding out on going to Emacs because you don’t want to learn Emacs, take a look at EL4R. It lets you do everything in Ruby.
The second thing is why the YASnippet, which is yet another snippet program which will basically give you Textmate-like snippet expansion. You save a file called “def” under text mode, you know in, snippet/text/ruby and now you put in the contents of the file and then whenever you type “def” and hit Tab, it will inject the will inject the content of that file into your thing. So it’s basically Textmate snippet expansion.
And then the third thing which is flat awesome is, I found the other day, that if you go to the official Portal 2 website, which is thinkwithportals.com/music.php, you can get the complete Portal 2 soundtrack, all three CDs. They got ring tones; they got all of the sound, all that music from the game. The music is so good as coding tunes and I've been listening to it while I’m programming, that I have had an irresistible urge at the end of the day to fire a Portal 2 and play some more of it and I just actually finished Portal 2 last night at midnight again for about the nineteenth time because I had to, because I've been listening to the music, because it's so great.
CHUCK: Alright, James what are your picks?
JAMES: I’ve got a couple, I mentioned recently that we are going to go to Ruby Conf and talk there and I recommended that people check out that conference. I'm only planning to, probably attend one other conference this year and that’s Aloha Ruby Conf, which is going to be in Hawaii (which is obviously the reason I want to attend it). It looks like a great conference and they have their registration and their call for speakers right now, so if you think that, that would be a fun place to go then, you might wanna look into that.
The other things I wanted to recommend more techie, I mentioned that I loved Tmux and I really do, if you want to see the coolest Tmux thing ever, then you absolutely need to look at the new integration they did with iTerm2 and Tmux, and I have mentioned iTerm2 in the past and that's like absolutely the best terminal in the Mac, hands-down. And they now have integration, where when you do things like, split a window in iTerm2 that actually sends the Tmux command and puts the window in Tmux and so basically, the main things this Tmux session, using the normal things that you do in iTerm and its just absolutely amazing and some of the coolest hacking I’ve seen in a long time in my opinion. So you should check that out.
And then we have talked a lot about shells and UNIX integration and the various aspects of that. It occurs to me, I never recommended a book that actually taught me the shell and that book is “From Bash to ZShell”. it is a really good book that walks you through bash and what it is and then goes into the ZShell and basically what it does differently, so it's kind of a great way to learn both at the same time and what their strengths are and then you can decide which one is better for you after having evaluated on them. And it teaches a lot of great stuff, that I learned how to write shell loops and due process management and stuff like that from this book. So if you have it up on your shell, and you want to get caught up, it's like one-stop shopping for that. So, those are my picks.
CHUCK: Cool. Gary what are your picks?
GARY: I have two. The first is apropos of two of the four people before me using the word “apropos”. Emacs meta-x apropos. Just go into Emacs, type Emacs return at your shell, type Escape-x, apropos, enter and then some word like “window” and just see what happens. And that will, in one fell swoop, show you the power of Emacs that you're missing, if you are not an Emacs user.
The other one is totally unrelated to editors but, TestRocket by Peter Cooper, which is one of the most adorable pieces of Ruby code I have ever seen in my life. Just Google TestRocket and look at the examples and look at the implementation and that is it.
CHUCK: All right.
My picks this week first off, I started exercising. I actually entered the weight loss contest. That means I have to start going back to the gym and then doing all that stuff to eat healthy. So I went out and I bought this Speedo Aquabeat which is an mp3 player that is water proof. It has the headphones that are water proof and I bought as swim cap so that they’ll stay in my ears, because that was the problem that I had with them. But they sound really good. So I can get in the pool and I can swim, not nearly as far as I would like to in a half hour. But I could swim a decent distance and the music or whatever I'm listening to, just kind of helps me find the rhythm and swim and do that kind of stuff. That’s one thing that I’ve really been, picking up.
DAVID: Chuck I have this image of you consuming your podcast while swimming and until you build up your stamina, stick to Grammar Girl in writing excuses. Don’t try to listen to like Ruby Rogues or you’ll drown.
CHUCK: Because I cannot stay in the pool for an hour. Is that what you’re telling me?
DAVID: Exactly yeah.
CHUCK: Yeah. Well I used to be in the swim team in high school. it's kind of funny because my form was really good and I'm really out of shape, which means that I am swimming in such a way to where I should be able to take advantage of all of the water resistance that I am pushing against. But I am so out of shape that it wears me out really, really fast (anyway kind of interesting).
Real quickly to wrap this up, I did neglect to mention our sponsor. We are sponsored by New Relic. So go check them out, they got really cool tool. You can check them out a NEWRELIC.COM. Also we would be reading on the 22nd of this month, “Land of Lisp”. So if you haven't gone and bought it, go and buy it. We did get a discount code and I don't remember what it is off the top of my head.
DAVID: Ruby Rogues!
CHUCK: Ruby Rogues. And you have to buy it at publisher's site which is, (I don’t remember). Anyway, I’ll put the information.
DAVID: Ruby Rogues where we are so together, you cannot believe it.
DAVID: You can’t just buy it from LANDOFLISP.COM?
CHUCK: Maybe you can.
CHUCK: But anyway, so yeah you can buy it.
DAVID: We’ll put a link in the show notes.
You go to NOSTARCH.COM and use the promo code “RUBYROGUES”, you get 30% off the book. It's good through the end of July, so after we’ve read it to you. Yeah, we are going to have a con right on and are going to talk about it and have a good discussion about it, so looking forward to that. Other than that we are in iTunes so go on and give us a review. I wanna thank Gary again for coming on to the podcast. See you next week.
GARY: Of course.