 ;;; Since I use rvm you'll need rvm.el from here https://github.com/senny/rvm.el
 ;;; Uncommenthing this _might_ work (untested)
 ;;; (defun rvm-use-default () ".") (provide 'rvm)
+
+;;; I bind some things to keys like this:
+;;; (global-set-key [(control f1)]		'view-file-in-browser)
+;;; (global-set-key [(shift control f1)]	'copy-file-url-to-clipboard)
 
 ;;; Code:
 

        ;; open either on github or a local file (the remove.origin.url stuff)
        (concat "open -a \"$(VERSIONER_PERL_PREFER_32_BIT=1 "
          "perl -MMac::InternetConfig -le 'print +(GetICHelper \"http\")[1]')\" \"$("
          "perl -e 'use File::Basename; $f = shift @ARGV; $d = dirname($f); $b = basename($f); "
          "$o = `git -C $d config --get remote.origin.url`; "
          "if ($o =~ qr!git(@|://)github.com[:/]!) { "
          "  $o =~ s!git(@|://)github.com[:/](.*).git$!https://github.com/$2!; "
          "} else { $o = \"\" }"
          "$p = `git -C $d rev-parse --show-prefix`; "
          "chomp($o, $p); "
          "$lc = `git log -1 --pretty=format:%h`; "
          "if ($o) { print \"$o/blob/$lc/$p$b\"; } else { print \"file://$f\" }' "
          (shell-quote-argument (buffer-file-name)) ")"
          (if (region-active-p)
            (concat "#L"
              (number-to-string (line-number-at-pos (region-beginning))) "-L"

          "\"")
        nil 0))))

(defun copy-file-url-to-clipboard (&optional file-name)
  "Put the url to access FILE-NAME in the copy buffer."
  (interactive (list (buffer-file-name)))
  (call-process-shell-command (concat (shell-command-to-get-file-url file-name) " | pbcopy")))

(provide 'github-markdown-server)
;;; github-markdown-server ends here
