Skip to content

Instantly share code, notes, and snippets.

@davidsnyder
Last active December 30, 2015 09:29
Show Gist options
  • Save davidsnyder/7809500 to your computer and use it in GitHub Desktop.
Save davidsnyder/7809500 to your computer and use it in GitHub Desktop.
Change the dev-root and stick this somewhere in .emacs.d/
(defvar dev-root "/Users/davidsnyder/Development")
(defun git-current-branch ()
(substring (shell-command-to-string "git branch | grep '\*'") 2 -1))
(defun ics-github-link ()
(interactive)
(let ((path (split-string (file-relative-name (buffer-file-name) (dev-root)) "/")))
(message (concat
"https://github.com/infochimps/"
(car path)
"/blob/" (git-current-branch) "/"
(mapconcat 'identity (cdr path) "/")
(format "#L%d" (line-number-at-pos))
))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment