Giving Emacs another try

I used Emacs for several years until 1995 when I started developing Windows software. I tried picking Emacs back up a few times since then, but each time I got frustrated and decided it wasn’t worthwhile. But things change and now I’m willing to give it another try. I’m well aware of the difficulties, but I think it may be worth the investment.

I’ve evaluated several editors on Windows, and I haven’t found anything as powerful or as configurable as Emacs. But the main reason I’m willing to try Emacs again is that I’m tired of using a different program for every kind of file I edit. I use a dozen programs, none of which I know very well. I want to learn one tool well and use it for many different tasks. As the Emacs guided tour says:

All of the basic editing commands (and there are lots of them) are available no matter what you’re trying to do: write code, read a manual, use a shell, or compose an email.

All the tools Emacs provides for opening, saving, searching, and processing text (and more) are available to you no matter what you’re doing.

Using Emacs is painful at this point, like the first day getting back to an exercise routine. But some old habits are starting to coming back, and I’ve discovered a few customizations that make Emacs more convenient.

I’m doing an experiment. I’ve committed to using Emacs through the end of April. After that I may decide that the quirks of Emacs are either too much to get used to or will take too much effort customize around. Or I may decide I want to keep using it and dive deeper.

Related posts

6 thoughts on “Giving Emacs another try

  1. Good for you!

    May I suggest a few things?

    1. Learn to use the built-in command line shell, eshell.
    2. Use emacsclient, which will allow you to push files into an existing emacs session from anywhere. I have command line aliases to do just this so all I do is type “edit x” and x pops into emacs. If you’re on Windows you can also add a right click menu option for all files to do this too.
    3. If you’re on Windows use the native emacs not the cygwin one.
    4. Map caps lock to control. You don’t have to stretch so far with your pinky finger. Who uses caps lock anyway? You can always map it back to control if you want…
    5. Emacs has a vi mode if you’re familiar with vi. I recently tried gvim for about 6 months and when I came back to emacs I put it in vi mode. I think vi’s editing commands require less effort to type. The emacs commands require you to constantly hold down control. If you’re not already familiar with vi then this may be more hurt than help… I came back because gvim doesn’t have anywhere near the ability to recognize syntax that emacs does. That and for elisp.
    6. Which brings me to my next point. Elisp is required for serious usage.

    What do you use for template generation? (i.e. if your creating a new file, say foo.h or foo.py, what do you use to insert common author, copyright, etc… information into the file?)

    Also I use a tool that given a set of paths will index all of the files in those directories. Then I have a command line utility called “managed-edit” (aliases me) that will take a partially complete file name, prompt me for suggestions based upon what’s in the index, and then blast my selection into emacs. This is highly useful because locating files on disk is a pain. (And something an IDE usually gives you for almost free.)

    If you want my template generation program or managed edit let me know. It’s a distributable python package and is well-documented and generally in good shape.

  2. Good luck with the change, it’s never easy.

    I think a lot of people don’t view a text-editors as serious tools, but they are. When it’s something that can become a full IDE and is as extensible as Emacs or Vim there become a lot of nuances and tricks to using it well. When you want to work with a tool of that sophistication, you’re going to have to put in some training time.

    I still remember making the switch to Vim a few years ago. It was pretty painful at first, but now I wouldn’t use anything else. I would argue it has been a net gain in productivity.

  3. Some more suggestions:

    – Use ido-mode. I don’t recall if it comes with Emacs. Its usage should be self-explanatory, and you could look it up on Emacswiki. Maneuvering buffers without it is a royal pain.

    – Use pc-selection mode. Allows you to select text using the shift keys (may be the default in 23.x).
    (pc-selection-mode) in .emacs (or init.el, or whatever your config file is).

    – Use transient mark mode. This is the default in 23.x. This will highlight a region while you select it.

    – IF you want menus, look at menu-bar+. However, pretty soon you’ll find yourself never using the menus anyway…

    – Ever hated it when you open two files with the same name (e.g. init.py), and the buffer for the second file is names init.py? Well, the following code will give a saner name. Try it out!

    Put the following in your config file:

    (require ‘uniquify)
    (setq uniquify-buffer-name-style ‘reverse)
    (setq uniquify-separator “/”)
    (setq uniquify-after-kill-buffer-p t)
    (setq uniquify-ignore-buffers-re “^\*”)

    – Here’s code to highlight region between parentheses (very quickly lets you know if you have the right number of closing parentheses, etc). You may have to change the colors to suit your setup.

    ;; Highlight region between parentheses
    (require ‘paren)
    (set-face-background ‘show-paren-match-face “#696969”)
    (set-face-foreground ‘show-paren-match-face “#def”)
    (set-face-attribute ‘show-paren-match-face nil :weight ‘extra-bold)
    (setq show-paren-delay 0)
    (show-paren-mode 1)

    – Use Predictive Abbreviation for autocompleting words, variables, etc while coding:

    http://homepages.cs.ncl.ac.uk/phillip.lord/download/emacs/pabbrev.el

    It works fine for me, but there are other options, such as the one found at http://www.emacswiki.org/emacs/PredictiveMode

    – Finally, and I cannot stress this enough, use Org Mode. You can watch its Google Tech Talk (the 35th most watched Google Tech Talk!) here:

    http://www.youtube.com/watch?v=oJTwQvgfgMM

    Like Emacs, using Org mode is a journey of its own. However, it has a much nicer learning curve. You can use it for simple tasks quite quickly. And many more features have been added since the video.

  4. @beetle B.

    Lots of good stuff there. I’m definitely going to give Org mode, predictive abbreviation, and ido-mode a try.

    Some of your suggestions made me go back to my “el” files and see what was in them. Like you I use transient mark mode, and parentheses matching.

    At that same level of usefulness is font-lock-mode (it automatically detects the file type and does proper syntax highlighting).

    (require ‘font-lock)
    (global-font-lock-mode t)

    This could be on by default in newer versions.

  5. Like you I use transient mark mode, and parentheses matching.

    Well, Emacs has had parentheses matching by default for a long time. But the default has been to simply highlight the parentheses. This actually highlights the whole region in between the parentheses.

    Some may not like it, though. But I thought I’d throw it out there.

    Many people also use ibuffer and icycles. I haven’t tried either, so I can’t comment, but people really swear by icycles. Supposedly makes Emacs friendly for the beginner, but is quite powerful and doesn’t get in the way of advanced capabilities:

    http://www.emacswiki.org/emacs/EmacsNewbieWithIcicles

Comments are closed.