Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. (defun github-current-line-numbers-range ()
  2. "Construct a github line number range from the current selection.
  3. If no region is active, then just use the current line."
  4. (if (use-region-p)
  5. (concat "L" (number-to-string (line-number-at-pos (region-beginning))) "-L" (number-to-string (line-number-at-pos (region-end))))
  6. (concat "L" (number-to-string (line-number-at-pos (point))))))
  7.  
  8. (defun github-link-to-source ()
  9. "Links to the current source."
  10. (let ((path somehow-get-path-of-current-buffer)
  11. (orgin-url somehow-get-base-github-repo-url)
  12. (tree somehow-get-branch-of-current-checkout)
  13. (range (github-current-line-numbers-range)))
  14. (concat origin-url "/blob/" tree "/" path "#" range)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement