Emacs: 7 months later

In my final post about my switching to Emacs, a commenter, Scott, asked me, “It has been a while since you started using Emacs. I’m just curious. How is your experience so far now that you have more experience and a more complete configuration?” My reply was getting quite long, so I figured it would be best suited as a new post.

The short answer is, mostly the same since I wrote that Vim vs. Emacs (part 3). Once you use something a lot, you notice all kinds of things that could use improvements. Some of them are just minor annoyances. For example, many interactive commands in Emacs (but not all!) require you to type out “yes” instead of just “y” as a confirmation. Others are more serious, like the need for a real replacement of SuperTab from vim.

I actually didn’t have much free time to work on configuring Emacs during the school year, and once the summer started, my computer died, and I’ve been working of an old laptop running Linux until I can get a new one. Fortunately, I had the foresight to put all my Emacs configuration online on GitHub, so it was easy to get my configuration again. I’ve noticed that in Linux, the Alt key (i.e., Meta) is used for other things, so it doesn’t work so well in Emacs (e.g., pressing Alt without any other keys sometimes activates a menu that removes the keyboard focus, and also C-M shortcuts don’t seem to work at all).

I’ve memorized very few keyboard shortcuts, even ones that might be useful to me (e.g., I don’t remember the shortcut to jump to a matching parenthesis). Usually, if I am using some mode or something and I want to know how to do something, I just Google it, and generally find the answer within a few seconds.

There are several major configuration issues that I’ve yet to address, either due to lack of time or because I couldn’t find a suitable solution. A SuperTab replacement is one. This is actually a big one, because scrolling through a file just to see what’s there is getting older and older, as is searching just to jump to a function definition. If anyone knows of a good way to do this, please let me know. I mainly need it for Python files, but having it other modes as well would be nice. Basically, I just want something that shows me all the class and function definitions in the file, in order, that I can easily select one and jump to it.

Related to searching, searching in Emacs sucks. I’m using isearch+, which is an improvement, but it still bugs me that search does not wrap around by default. Also, for some reason, pressing delete doesn’t delete the last character you typed, but the last character that it matched. That may sound minor, but I use it a lot, so it’s really gotten on my nerves.

Regular expression searching in Emacs is useless. I can never get it to work (usually because of differences between () and \(\)). What I really want is an interactive, user friendly, regular expression search/search and replace tool. There’s regexp-builder, but that’s useless because once you build the regular expression, you have to manually copy it and paste it into the real regular expression search function to actually use it. And it doesn’t work with search and replace.

This last semester I had a semester long project in C. For that, flymake-mode was a godsend. It requires a bit of manual configuration (you have to add something to your Makefile, and you have to add some stuff to .emacs as always to enable it by default), but once you do that, it just works. If you don’t know what this is, basically, it highlights the compiler errors in your source in real time, as you type it. So instead of doing something stupid twenty times, and then compiling and finding them all, you do something stupid once, see the error, and don’t do make the mistake any more. It’s also nice to close your editor and know that your code will compile.

The Python mode I am mixed about. On the one hand, it’s really awesome how smart it is about indentation. On the other hand, the syntax highlighting is just shy of what I want (granted, it’s pretty good, but I want better than that). For example, I want to be able to color docstrings, single quoted strings, and double quoted strings differently. It would also be awesome to get some coloring in docstrings itself. I’m thinking markdown mode for any text that’s in a docstring, except for doctests, which are colored in Python mode (or some variant).

Some things I’ve not really cared much about yet because I haven’t used that type of file yet. For example, I’m currently writing this post in Emacs, and just now noticing the deficiencies in html-mode (e.g., I want an easy way to select text and turn it into a link, just like in the WordPress editor).

Finally, I’ve been trying to write my own theme. That process has been slow and slightly painful. Emacs is currently in the process of moving to themes, though, so this is to be expected. When Emacs 24 is actually released I think it will be fair to judge how well this feature works.

That’s my wishlist (or most of it anyway). But there are positive things too. auto-complete-mode, which I mentioned at the top of my previous blog post, is absolutely awesome. I think this extension alone has made me more productive.

Some things I take for granted, like automatic spell checking of strings and comments in Python (not enabled by default, but not hard to configure either). Thanks to someone on an Emacs mailing list, I have the perfect automatic clearing of trailing whitespace, that automatically leaves your whitespace before the cursor in the buffer, but still writes the clear to the file (see my .emacs file from my dotfiles repo linked to above for details).

I’ve been hoping to learn Emacs lisp, so that I could remedy many of these problems on my own, but so far I haven’t really had the free time. Lisp is a very confusing language, so it’s not easy to jump into (compared to the language vim uses, which I found easy enough to hack on without knowing at all).

Ultimately, I’m quite pleased with how user friendly Emacs is, and with how easy it is to find out how to do almost anything I want just by Googling it. Configuration is an uphill battle. Emacs has a ton of great packages, many of which are included, but almost none are enabled by default. Just today I discovered Ido mode, thanks to David Li. I feel that in the long term, as I learn Emacs Lisp, I can make it do whatever I want. It provides a good baseline editing experience, and a good framework for configuring it to do whatever you want, and also enough people use it that 99% of the things you want are already done by somebody.


12 Responses to Emacs: 7 months later

  1. Matt says:

    ;; y/n instead of yes/no
    (fset ‘yes-or-no-p ‘y-or-n-p)

  2. Nei says:

    re. html editor: select text and C-c C-c h then you can type in the link target

    • Nei says:

      as for the re-builder, first change syntax to string with C-c TAB and then remember it’s \( \). if you’re pleased with the result use C-c C-w to copy and in the query-replace-regexp you can paste it with C-y — still to hard? write your custom elisp and put it on a key binding ;-)

      about isearch, just hit C-s again at the end and it will “wrap around”. And if you want to edit your search string, just type M-e first and then you can delete the last char or whatever.

      for code navigation I highly recommend you set up semantic and then you can use something like eassist-list-methods to get a pop-up menu with quick jump to all the methods, or if that isn’t enough check out ecb

      • Aaron Meurer says:

        I know that you can press C-s again. But that’s not the point. I have to press C-s up to four times just to determine if a string is really in a document or not.

        Thanks for the url tip.

        For regular expressions, that doesn’t really solve my problem. I want something user-friendly and interactive. If I was an elisp wiz, I might try to do it on my own. But I can’t imagine that I’m the only one who’s felt this deficiency.

        I’ll checkout semantic or ecb. I vaguely remember trying semantic before but giving up because it was too hard to setup.

        • Le Wang says:

          Emacs’ regexp syntax takes a little bit getting used to, but with so many libraries dependent on it at this point, it won’t change.

          For your isearch problems, you’re using the wrong tool. See `occur`. Helm has interactive interactive occur.

          Also check out helm for your general incremental completion needs. Ido is for the kiddies. ;)

  3. […] As readers of this blog may remember, back in 2011, I decided to move to a command-line based editor. For roughly two weeks in December, 2011, I exclusively used Vim, and for the same amount of time in January, 2012, I used exclusively Emacs. I had used a little of each editor in the past, but this was my first time using them to do true editing work. My experiences are chronicled in my blog posts (parts 1, 2, 3, and 7 months later follow up). […]

  4. Scott says:

    When I used Emacs (a two-year period beginning in 2002), it was to compose prose text. I loved that I could make corrections so quickly without having to move my hands away from the keyboard, but I found that Emacs’ key bindings caused a burning pain in my hands after about forty-five minutes of typing. Still, I persisted. I wanted to learn Lisp to customize my .emacs file, but found it sufficiently complex to dissuade me from bothering with it, even though I bought a book specifically aimed at teaching Emacs Lisp. As I gained more experience with it, I noticed that Emacs did not fit into either Windows or Linux. To be fair, Vim doesn’t fit into Windows either, but it is a nice fit on any Linux system. Emacs felt like a strange glob of goo in Windows and like a monster on an ant hill in Linux. It was not designed for either of these systems. Eventually, I concluded that I was not the target audience to which Emacs (or its Lisp interpreter) was aiming, and I abandoned it. And again, in all fairness, Vim is not aimed at authors of prose any more than Emacs is; I was simply lucky to be a touch typist (Vim is best used in combination with touch typing) and to have approached learning it in a way that was likely to succeed: memorizing the tactile feel of commands rather than their alphabetic symbols.


  5. I have used both emacs and vim. Emacs was when I was starting to get back into programming – and it had a way of letting you know that your C++ or Java was off. Then when I started work, the only thing available at work was vim. I definitely got an appreciation for the simple key strokes with great power. Now I am coming full circle getting interested in Lisp programming, so picking up emacs again, but only because of the close integration with Lisp (Slime/swank). What has made it bearable is the evil plugin for emacs. Sweet – I have the best of both worlds. It is the scalpel on top of the Swiss army knife. The Evil plugin approximates the Vim environment by 99%.

    For more information I refer you to another Vim fanatic turned Emacs/Evil editor:
    Shinobu’s Secrets -> Some thoughts on Emacs and Vim (about halfway down the page):

    Also for more to get into vim look into my comments at shortcutworld.com for emacs and for vim (especially about Derek Wyatt’s supreme videos from beginner to advanced)

    Furthermore checkout what Ryan McGeary is doing:
    He has great productivity insights for emacs.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: