The Shoes of the Fisherman's Wife Are Some Jive-Ass Slippers

tpot (at) frungy . org

rss

2006
Months
Sep

Tue, 26 Sep 2006

agulbra-switch-cpp-h

I was thinking the other day that my life would be so much better if I could be editing a C++ file in Emacs and by simply hitting a key, the header for that file would be loaded. Hitting the key again would swap back from the header to the implementation. Before breaking out the Emacs Lisp manual I did a quick search and it turns out that those crazy kids at KDE have such a function in their kde-devel-emacs.el file.

Copy this bit of elisp somewhere and bind it to a key:

; From kde-devel-emacs.el, by by David Faure <faure@kde.org>

(defun agulbra-switch-cpp-h ()
  "Switch to the corresponding .cpp, .C, .cc or .h file."
  (interactive)
  (let ((n (buffer-file-name))
        (c nil))
    (cond ((and (string-match "\\.h$" n)
                (progn
                  (setq c (replace-match ".cpp" t t n))
                  (file-readable-p c)))
           (find-file c))
          ((and (string-match "\\.h$" n)
                (progn
                  (setq c (replace-match ".cc" t t n))
                  (file-readable-p c)))
           (find-file c))
          ((and (string-match "\\.h$" n)
                (progn
                  (setq c (replace-match ".C" t t n))
                  (file-readable-p c)))
           (find-file c))
          ((string-match "\\.h$" n)
           (find-file (replace-match ".cpp" t t n)))
          ((string-match "\\.h$" n)
           (find-file (replace-match ".cpp" t t n)))
          ;((string-match "_[a-z]+[0-9]*.cpp$" n)
          ; (find-file (replace-match ".h" t t n)))
          ((string-match "\\.cpp$" n)
           (find-file (replace-match ".h" t t n)))
          ((string-match "\\.cc$" n)
           (find-file (replace-match ".h" t t n)))
          ((string-match "\\.c$" n)
           (find-file (replace-match ".h" t t n)))
          (t
           (error "%s is neither .h, .cc, .C or .cpp" n)))))

posted at: 17:35 | path: /software/emacs | permanent link to this entry

Thu, 21 Sep 2006

Operation Ride-A-Lot

I dropped Anna and the in-laws off at the airport on Monday (I feel a bit like a tour organiser) for a backpacking holiday. Now I'm on my own for a couple of weeks so I thought I would try and do more km on the bike than in the car. It's turning out OK so far, although I had to head in to Queanbeyan to see the accountant and buy some coffee related paraphernalia in Fyshwick so I've started 38km behind already.

Riding to work and to the pool and back over the last two days has put on 55km and with a few training rides with the triathlon club I should be able to put on a couple of hundred kilometres more without too much hassle. It's also dry and getting warmer so riding around Canberra is quite nice at the moment.

posted at: 09:25 | path: /triathlon | permanent link to this entry

Wed, 06 Sep 2006

On Safari

I subscribed to O'Reilly's Safari online library today, or rather convinced work to pay for it (woot). I thought about subscribing when it was first released (in 2001, apparently), but baulked because it "only" contained the O'Reilly titles. Now there are stacks more books available, about 650 as of May 2006.

Tim O'Reilly makes some interesting comparison with physical book sales in a blog post on O'Reilly Radar. (Warning: link contains references to wanky long tail stuff). According to the Safari logs, the graph of page views vs book sales is a lot flatter and longer for Safari, and actually tips up at the end of the tail.

Australia, and especially Canberra, doesn't have very many good technical bookstores compared to a Borders or Barnes & Noble in a decent sized US city so local book browsing is limited to the current new releases of .NET, VB and Cisco training books. Oh yeah, Safari's also searchable. Neat.

posted at: 20:46 | path: /computers | permanent link to this entry