Emacs: September 2007 Archives

emacs is über

| | Comments (2)

My current favorite emacs hack, thanks to SeanO. This extends find-file-at-point (which I have bound to C-x C-p) to automatically look a bit further for a line number and use it if available:

(defadvice find-file-at-point (around goto-line compile activate)
  (let ((line (and (looking-at ".*:\\([0-9]+\\)")
                   (string-to-number (match-string 1)))))
    ad-do-it
    (and line (goto-line line))))