- Quickly grab regions of code, functions, or whole buffers with a link back to the source to insert into org-documents or org-capture blocks
- include a link to the region or function in your git forge with git-link.el (requires installation of git-link)
Not yet on MELPA - clone it into your elisp load path for now!
Example Configuration with use-package:
(use-package show-your-work
:commands show-your-work-kill-snippet
:defer t
:bind (:map ctrl-x-map ("y" . show-your-work-kill-snippet))
:after (org-capture which-func))
Call show-your-work-kill-snippet
with your point inside a function or with a
region selected. Using this repo as an example, calling the function with
point on line 36 in ./show-your-work.el
will push the following org
markup
onto the kill ring:
[[https://github.com/0x6362/show-your-work.el/blob/main/show-your-work.el#L35-L37][show-your-work.el:35]] // ~show-your-work--git-link-available-p~
(defun show-your-work--git-link-available-p ()
"Check if git-link is available for use."
(fboundp 'git-link))
Similarly, with a region:
[[https://github.com/0x6362/show-your-work.el/blob/main/show-your-work.el#L35-L45][show-your-work.el:35]] // ~show-your-work--git-link-copy-url-only~
(defun show-your-work--git-link-available-p ()
"Check if git-link is available for use."
(fboundp 'git-link))
(defun show-your-work--git-link-copy-url-only ()
"Get a permalink via git-link if available."
(if (show-your-work--git-link-available-p)
(let (git-link-open-in-browser)
(call-interactively 'git-link)
(pop kill-ring))
(error "Install git-link.el to use this functionality")))
Because I have git-link
available in my emacs, a link to the file on the
currently active git branch on the remote git forge is included in the
snippet.