This week I went to the keynote by James Gosling at the Sun Tech Days here in Sydney. At the end of his presentation, I was left in know doubt that he has really drunk the Kool-Aid. Especially when he asked people to stop using Emacs and use Netbeans instead.

Now, as my four readers will remember, I am a long time user of Emacs. I would agree that using Emacs for developing Java code is madness, but as a general purpose editor, nothing beats Emacs. For example, in the last week I have been going through log files looking into some production support issues. I even ended up writing the report on the issues using Emacs Muse (and this blog entry).

It was also a real irony for me listening to Gosling, as this week I have been reading Writing GNU Emacs Extensions by Bob Glickstein. I cannot recommend this book highly enough to get a good overview on how to extend Emacs, or just to understand what is in that .emacs file. Bizarrely I have had the book in my bookshelf for over eight years before actually reading it.

After reading the book, I wrote my first Lisp function, including:

(oli-filter-buffer-non-matching (regie)
  "Copies the contents of the current buffer and filters it for non matching lines"
  (interactive "sRegexp of lines to keep: ")
  (let ((buffer (get-buffer-create (concat "filtered-"
                                           (format-time-string "%y%m%d%H%M%S"
                                                               (current-time)))))
        (curr-buff (current-buffer)))
    (progn
      (set-buffer buffer)
      (insert-buffer curr-buff)
      (delete-non-matching-lines regie)
      (switch-to-buffer-other-window buffer))))