IDEs are all the rage in software development, but I’ve remained a devote Emacs user, or XEmacs to be more precise. Why? Primarily because XEmacs is primarily for editing files, and does the job extremely well. It can be customized to a great extent, where XEmacs is truly a platform in itself, allowing the user to tailor it to their needs. But even out of the box, XEmacs is phenomenally powerful, making it trivial to record keystrokes and record those as macros (hence the “mac” part of the name).

Some nifty XEmacs tricks:

  • Transposing two characters: control-t
  • Transposing two words: alt-t. This is all the more powerful in that words can be “dragged” forward by repeated alt-t sequences. And XEmacs mysteriously knows how to skip punctuation, making it very useful for when method arguments need to be reordered.
  • Transposing lines: switch the current line with the previous: control-x-control-t.
  • Reindenting code: highlight the region, then escape-ctrl-backslash (C-M-\ in Emacs-speak).
  • Inserting the basename of the current file. This is useful in Java code, where the file basename is the same as the public class in that file. This bit of Emacs Lisp does it:
  • (defun jep:file-split (file)
      "Split file name x.y by dot, returning the list (x y)."
      (let* (fn
    	 ;; extended so that foo.cpp => foo.cpp
    	 (re  "^\\(.*\\)[.]\\([^<]*\\)")
        (if (not (and (string-match re file)
                      (match-end 1) (match-end 2) ))
          (setq fn  (substring file (match-beginning 1) (match-end 1)))
          (setq ext (substring file (match-beginning 2) (match-end 2)))
        ; return a list containing the file name and the extension
        (if (and fn ext)
            (list fn ext)
    (defun jep:file-basename ()
      "Returns the file name, minus the directory and suffix."
      (let* ((bn (buffer-name))
             (namelist (jep:file-split bn))
        (if (or (null namelist) (= 1 (length namelist)))
          ;; first in the name list is the file name; second is the extension
          (setq fn  (nth 0 namelist))
    (defun jep:file-insert-basename ()
      "Inserts the basename at the current point."
      (let* ((fn (jep:file-basename))
        ;; Not doing a save-excursion, because we want to go to the end of what we
        ;; inserted.
        (insert fn)

That’s just a start; I’ll add more later.

Linux Network Woes

Much fun this fine evening.

I had to reboot the machine today — doing some work that required the electricity to that room to be shut off — and after rebooting, I noticed that the network connection would go down. There was nothing in /var/log/messages. I could restart the connection (/etc/rc.d/init.d/network restart), and ping my router ( for a while. But within 45 seconds to 3 minutes, the connection would be lost.

Oddly, I could do a broadcast ping (ping -b, and see other machines on my network.

After a while, I ventured over to my newest laptop, given to me yesterday at my company, which had a nice helpful error message, that there was another machine on the network with the same IP address.

I’m shocked … shocked, I tell you. Because for the first time, in my 12 years of Linux usage, I found Linux to be harder to diagnose than Windows (this was XP). Would it really have been that difficult for Linux to add a nice little message, saying the same thing?