Another Emacs Challenge

Over at the Emacs reddit, zoldberghoneydew presents an interesting problem and solution. The problem boils down to creating a hosts file of the form

host1    ip-address-of-host-1
...
host64   ip-address-of-host-64

where the address of host-n can be looked up in DNS with dig.

Zoldberghoneydew's solution is nice but a bit over complicated. The challenge is to produce this file with the minimum keystrokes possible.

This entry was posted in General and tagged . Bookmark the permalink.
  • I don't quite understand what is supposed to be the output. But this is how I see it:

    C-1 F3
    host
    F3
    C-i
    ip-address-of-host
    C-u F3
    C-6 C-3 F4

    • Phil

      Yes, it's a clear case for keyboard macro & counter. There's a missing RET, and the 63 should be 64, but otherwise that looks perfect to me -- I'd be awfully surprised if there's a more efficient solution.

    • jcs

      I don’t quite understand what is supposed to be the output. But this is how I see it

      Sorry, I wasn't as clear as I could have been. The idea is that you look up the host name with dig and replace ip-address-of-host-n with the actual IP address. See the original post if that's still not clear.